From: Aron Roberts Date: Wed, 16 Sep 2009 22:58:36 +0000 (+0000) Subject: CSPACE-424: Added (currently commented-out) negative tests of create and update with... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=478ce437ee7b823618a66a292ba6abccaab05a68;p=tmp%2Fjakarta-migration.git CSPACE-424: Added (currently commented-out) negative tests of create and update with empty payload to Acquisition service tests, removed obsolete createNull test. --- diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java index fd750835c..6db1f4eb5 100644 --- a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java @@ -98,16 +98,10 @@ public class AcquisitionServiceTest extends AbstractServiceTest { } // Failure outcomes - - @Override - @Test(dependsOnMethods = {"create"}, - expectedExceptions = IllegalArgumentException.class) - public void createNull() { - ClientResponse res = client.create(null); - } - // Placeholders until the two tests below can be uncommented. + // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + public void createWithEmptyEntityBody() {} public void createWithMalformedXml() {} public void createWithWrongXmlSchema() {} @@ -298,12 +292,57 @@ public class AcquisitionServiceTest extends AbstractServiceTest { // Failure outcomes - // Placeholders until the two tests below can be uncommented. + // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + public void updateWithEmptyEntityBody() {} public void updateWithMalformedXml() {} public void updateWithWrongXmlSchema() {} /* + @Override + @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"}) + public void updateWithEmptyEntityBody() { + + // Perform setup. + setupUpdateWithEmptyEntityBody(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getResourceURL(knownResourceId); + String mediaType = MediaType.APPLICATION_XML; + final String entity = ""; + int statusCode = submitRequest(method, url, mediaType, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("updateWithEmptyEntityBody url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + @Override + @Test(dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithEmptyEntityBody() { + + // Perform setup. + setupCreateWithEmptyEntityBody(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + String mediaType = MediaType.APPLICATION_XML; + final String entity = ""; + int statusCode = submitRequest(method, url, mediaType, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("createWithEmptyEntityBody url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + @Override @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"}) public void updateWithMalformedXml() {