@Test public void testGetUserInfoByEmail() throws UnsupportedEncodingException{ String email = "ilya@users.yammer.com"; String encodedEmail = StringUtils.replace(email, "@", "%40"); mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("testdata/yammer-users"), APPLICATION_JSON)); YammerProfile yProfile = yammerTemplate.userOperations().getUserByEmail(email); assertYammerProfile(yProfile); }
public YammerProfile getUserByEmail(String email){ URI uri = buildUri("users/by_email.json", "email", email); YammerProfileList profileList = restTemplate.getForObject(uri, YammerProfileList.class); if(CollectionUtils.isEmpty(profileList)){ return null; } return profileList.get(0); }
UserTemplate extends AbstractYammerOperations implements UserOperations { public YammerProfile getUserByEmail(String email){ URI uri = buildUri("users/by_email.json", "email", email); YammerProfileList profileList = restTemplate.getForObject(uri, YammerProfileList.class); if(CollectionUtils.isEmpty(profileList)){ return null; } return profileList.get(0); } }
UserTemplate extends AbstractYammerOperations implements UserOperations { public YammerProfile getUserByEmail(String email){ URI uri = buildUri("users/by_email.json", "email", email); YammerProfileList profileList = restTemplate.getForObject(uri, YammerProfileList.class); if(CollectionUtils.isEmpty(profileList)){ return null; } return profileList.get(0); } UserTemplate(RestTemplate restTemplate); }
UserTemplate extends AbstractYammerOperations implements UserOperations { public YammerProfile getUserByEmail(String email){ URI uri = buildUri("users/by_email.json", "email", email); YammerProfileList profileList = restTemplate.getForObject(uri, YammerProfileList.class); if(CollectionUtils.isEmpty(profileList)){ return null; } return profileList.get(0); } UserTemplate(RestTemplate restTemplate); List<YammerProfile> getUsers(int page); List<YammerProfile> getUsers(int page, String sortBy, boolean reverse, Character letter); YammerProfile getUser(long id); YammerProfile getUser(String userId); void updateProfile(long userId, UserInfo userInfo); YammerProfile getUserProfile(); YammerProfile getUserByEmail(String email); }
UserTemplate extends AbstractYammerOperations implements UserOperations { public YammerProfile getUserByEmail(String email){ URI uri = buildUri("users/by_email.json", "email", email); YammerProfileList profileList = restTemplate.getForObject(uri, YammerProfileList.class); if(CollectionUtils.isEmpty(profileList)){ return null; } return profileList.get(0); } UserTemplate(RestTemplate restTemplate); List<YammerProfile> getUsers(int page); List<YammerProfile> getUsers(int page, String sortBy, boolean reverse, Character letter); YammerProfile getUser(long id); YammerProfile getUser(String userId); void updateProfile(long userId, UserInfo userInfo); YammerProfile getUserProfile(); YammerProfile getUserByEmail(String email);  }