@Test public void testRequestWellFormed() throws BoxRestException, AuthFatalFailureException { GetAllGroupsRequest request = new GetAllGroupsRequest(CONFIG, JSON_PARSER, null); this.testRequestIsWellFormed( request, BoxConfig.getInstance().getApiUrlAuthority(), BoxConfig.getInstance().getApiUrlPath().concat(GetAllGroupsRequest.getUri()), HttpStatus.SC_OK, RestMethod.GET); }
@Test public void testRequestIsWellFormed() throws BoxRestException, AuthFatalFailureException { String id = "testid123"; DownloadFileRequest request = new DownloadFileRequest(CONFIG, JSON_PARSER, id, null); testRequestIsWellFormed( request, BoxConfig.getInstance().getApiUrlAuthority(), BoxConfig.getInstance().getApiUrlPath().concat(DownloadFileRequest.getUri(id)), HttpStatus.SC_OK, RestMethod.GET); }
@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); }