UserTemplate implements UserOperations { public UserCredentials createUser() { return createUser(null); } UserTemplate(RestOperations restOperations); UserCredentials createUser(); UserCredentials createUser(UserConfig userConfig); void modifyUser(String userId, UserConfig userConfig); void resetPassword(String userId); void deleteUser(String userId); String recoverAccount(String emailAddress); String recoverAccount(String emailAddress, String udid);  }
@Test public void createUser_noConfig() { masterKeyMockServer.expect(requestTo("https: .andExpect(method(POST)) .andRespond(withResponse(jsonResource("data/user-credentials"), responseHeaders, HttpStatus.CREATED, "Created")); UserCredentials credentials = urbanAirship.userOperations().createUser(); assertEquals("https: assertEquals("someuser", credentials.getUserId()); assertEquals("somepassword", credentials.getPassword()); masterKeyMockServer.verify(); }
@Test public void createUser_completeConfig() { masterKeyMockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(body(readCompactedJsonResource(jsonResource("data/user-config-complete")))) .andRespond(withResponse(jsonResource("data/user-credentials"), responseHeaders, HttpStatus.CREATED, "Created")); UserConfig userConfig = UserConfig.builder().airmail(true).alias("alias").deviceTokens("token1", "token2").tags("tag1", "tag2").udid("udid").email("someuser@somedomain.com").build(); UserCredentials credentials = urbanAirship.userOperations().createUser(userConfig); assertEquals("https: assertEquals("someuser", credentials.getUserId()); assertEquals("somepassword", credentials.getPassword()); masterKeyMockServer.verify(); }