@Test public void fetchProfileFirstNameOnly() { UserOperations userOperations = Mockito.mock(UserOperations.class); when(github.userOperations()).thenReturn(userOperations); when(userOperations.getUserProfile()).thenReturn(createProfile(123456L, "habuma", "Craig", "Plano, TX", "SpringSource", null, "cwalls@vmware.com", null, null)); UserProfile profile = apiAdapter.fetchUserProfile(github); assertEquals("Craig", profile.getName()); assertEquals("Craig", profile.getFirstName()); assertNull(profile.getLastName()); assertEquals("cwalls@vmware.com", profile.getEmail()); assertEquals("habuma", profile.getUsername()); }
public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setEmail(profile.getEmail()).setUsername(profile.getLogin()).build(); }
GitHubAdapter implements ApiAdapter<GitHub> { public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setEmail(profile.getEmail()).setUsername(profile.getLogin()).build(); } }
GitHubAdapter implements ApiAdapter<GitHub> { public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setEmail(profile.getEmail()).setUsername(profile.getLogin()).build(); }  }
GitHubAdapter implements ApiAdapter<GitHub> { public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setEmail(profile.getEmail()).setUsername(profile.getLogin()).build(); }  boolean test(GitHub github); void setConnectionValues(GitHub github, ConnectionValues values); UserProfile fetchUserProfile(GitHub github); void updateStatus(GitHub github, String message); }
GitHubAdapter implements ApiAdapter<GitHub> { public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder().setName(profile.getName()).setEmail(profile.getEmail()).setUsername(profile.getLogin()).build(); }  boolean test(GitHub github); void setConnectionValues(GitHub github, ConnectionValues values); UserProfile fetchUserProfile(GitHub github); void updateStatus(GitHub github, String message);  }