LinkedInAdapter implements ApiAdapter<LinkedIn> { public UserProfile fetchUserProfile(LinkedIn linkedin) { LinkedInProfile profile = linkedin.profileOperations().getUserProfile(); return new UserProfileBuilder() .setName(profile.getFirstName() + " " + profile.getLastName()) .setEmail(profile.getEmailAddress()) .build(); }  boolean test(LinkedIn linkedin); void setConnectionValues(LinkedIn linkedin, ConnectionValues values); UserProfile fetchUserProfile(LinkedIn linkedin); void updateStatus(LinkedIn linkedin, String message);  }
@Test public void fetchProfile() { ProfileOperations profileOperations = Mockito.mock(ProfileOperations.class); Mockito.when(linkedin.profileOperations()).thenReturn(profileOperations); Mockito.when(profileOperations.getUserProfile()).thenReturn(new LinkedInProfile("50A3nOf73z", "Craig", "Walls", "Spring Guy", "Software", "https: new UrlResource(null, "https: UserProfile profile = apiAdapter.fetchUserProfile(linkedin); assertEquals("Craig Walls", profile.getName()); assertEquals("Craig", profile.getFirstName()); assertEquals("Walls", profile.getLastName()); assertNull(profile.getEmail()); assertNull(profile.getUsername()); }