### Question:
YammerAdapter implements ApiAdapter<Yammer> { public boolean test(Yammer yammer) { try { yammer.userOperations().getUserProfile(); return true; } catch (RestClientException e) { return false; } }  boolean test(Yammer yammer); void setConnectionValues(Yammer yammer, ConnectionValues values); UserProfile fetchUserProfile(Yammer yammer); void updateStatus(Yammer yammer, String message); static final String EMAIL_PRIMARY_TYPE; }### Answer:
@Test public void testShouldSucceedWhenApiCanRetrieveUserProfile() { UserOperations userOperations = mock(UserOperations.class); when(yammer.userOperations()).thenReturn(userOperations); YammerProfile yammerProfile = mock(YammerProfile.class); when(userOperations.getUserProfile()).thenReturn(yammerProfile); boolean isApiOK = apiAdapter.test(yammer); assertTrue(isApiOK); }
@Test public void testShouldFailWhenApiIsUnableToRetrieveUserProfile() { UserOperations userOperations = mock(UserOperations.class); when(yammer.userOperations()).thenReturn(userOperations); when(userOperations.getUserProfile()).thenThrow(new RestClientException("unable to retrieve user profile")); boolean isApiOK = apiAdapter.test(yammer); assertFalse(isApiOK); }