]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-424: Added (currently commented-out) negative tests of create and update with...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 16 Sep 2009 22:58:36 +0000 (22:58 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 16 Sep 2009 22:58:36 +0000 (22:58 +0000)
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java

index fd750835cb57e789957c3021ccf50e8060fe80bf..6db1f4eb5f9165e98515c7f4f133632c86e2451e 100644 (file)
@@ -98,16 +98,10 @@ public class AcquisitionServiceTest extends AbstractServiceTest {
     }
 
     // Failure outcomes
-
-    @Override
-    @Test(dependsOnMethods = {"create"},
-        expectedExceptions = IllegalArgumentException.class)
-    public void createNull() {
-        ClientResponse<Response> 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() {