UsersTemplate extends AbstractVKontakteOperations implements UsersOperations { @Override public VKontakteProfile getProfile() { return getProfiles(null).get(0); } UsersTemplate(RestTemplate restTemplate, String accessToken, String uid, boolean isAuthorizedForUser); @Override List<VKontakteProfile> getProfiles(List<String> userIds); @Override VKontakteProfile getProfile();  }
@Test(expected = VKontakteErrorException.class) public void getProfile_expiredToken() { mockServer .expect(requestTo("https: .andExpect(method(GET)).andRespond(withResponse(jsonResource("error-code-5"), responseHeaders)); vkontakte.usersOperations().getProfile(); }
@Test public void getProfile_currentUser() { mockServer .expect(requestTo("https: .andExpect(method(GET)).andRespond(withResponse(jsonResource("list-of-profiles"), responseHeaders)); VKontakteProfile profile = vkontakte.usersOperations().getProfile(); assertEquals("24840", profile.getUid()); assertEquals("John", profile.getFirstName()); assertEquals("Doe", profile.getLastName()); assertEquals("http: assertEquals("http: assertEquals("http: }
@Test(expected = MissingAuthorizationException.class) public void getProfile_unauthorized() { unauthorizedVKontakte.usersOperations().getProfile(); }