@Test public void testRequestIsWellFormed() throws BoxRestException, IllegalStateException, IOException, AuthFatalFailureException { String name = "testname"; String login = "******"; String role = "testrole"; String language = "tetstlan"; String title = "testtitle"; String phone = "testphone"; String address = "testaddress"; String status = "teststatus"; boolean sync = true; int space = 123; boolean seeManaged = true; boolean exemptLimit = true; boolean exemptLogin = true; String key1 = "testkey1"; String value1 = "testvalue1"; String key2 = "testkey2"; String value2 = "testvalue2"; LinkedHashMap<String, String> codes = new LinkedHashMap<String, String>(); codes.put(key1, value1); codes.put(key2, value2); CreateEnterpriseUserRequest request = new CreateEnterpriseUserRequest( CONFIG, OBJECT_MAPPER, BoxUserRequestObject.createEnterpriseUserRequestObject(login, name) .setRole(role) .setLanguage(language) .setSyncEnabled(sync) .setJobTitle(title) .setPhone(phone) .setAddress(address) .setSpaceAmount(space) .setTrackingCodes(codes) .setCanSeeManagedUsers(seeManaged) .setStatus(status) .setExemptFromDeviceLimits(exemptLimit) .setExemptFromLoginVerification(exemptLogin)); testRequestIsWellFormed( request, BoxConfig.getInstance().getApiUrlAuthority(), BoxConfig.getInstance().getApiUrlPath().concat(CreateEnterpriseUserRequest.getUri()), HttpStatus.SC_CREATED, RestMethod.POST); HttpEntity entity = request.getRequestEntity(); Assert.assertTrue(entity instanceof StringEntity); BoxUserRequestObject userEntity = BoxUserRequestObject.createEnterpriseUserRequestObject(login, name) .setRole(role) .setLanguage(language) .setSyncEnabled(sync) .setJobTitle(title) .setPhone(phone) .setAddress(address) .setSpaceAmount(space) .setTrackingCodes(codes) .setCanSeeManagedUsers(seeManaged) .setStatus(status) .setExemptFromDeviceLimits(exemptLimit) .setExemptFromLoginVerification(exemptLogin); assertEqualStringEntity(userEntity.getJSONEntity(), entity); }
@Test public void testUri() { Assert.assertEquals("/users", CreateEnterpriseUserRequest.getUri()); }