You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/02/20 15:18:15 UTC

svn commit: r1731406 - in /webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om: OMTestSuiteBuilder.java factory/TestCreateOMTextFromDataHandlerProvider.java

Author: veithen
Date: Sat Feb 20 14:18:15 2016
New Revision: 1731406

URL: http://svn.apache.org/viewvc?rev=1731406&view=rev
Log:
Increase test coverage.

Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1731406&r1=1731405&r2=1731406&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Sat Feb 20 14:18:15 2016
@@ -477,7 +477,8 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMNamespaceWithNullURI(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMProcessingInstructionWithoutParent(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMText(metaFactory));
-        addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory));
+        addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory, false));
+        addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory, true));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextFromOMText(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextWithNullParent(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestFactoryIsSingleton(metaFactory));

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java?rev=1731406&r1=1731405&r2=1731406&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java Sat Feb 20 14:18:15 2016
@@ -18,6 +18,8 @@
  */
 package org.apache.axiom.ts.om.factory;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import javax.activation.DataHandler;
 
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
@@ -25,6 +27,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.util.UIDGenerator;
 
 public class TestCreateOMTextFromDataHandlerProvider extends AxiomTestCase {
     static class TestDataHandlerProvider implements DataHandlerProvider {
@@ -46,16 +49,26 @@ public class TestCreateOMTextFromDataHan
         }
     }
     
-    public TestCreateOMTextFromDataHandlerProvider(OMMetaFactory metaFactory) {
+    private final boolean nullContentID;
+    
+    public TestCreateOMTextFromDataHandlerProvider(OMMetaFactory metaFactory, boolean nullContentID) {
         super(metaFactory);
+        this.nullContentID = nullContentID;
+        addTestParameter("nullContentId", nullContentID);
     }
 
     protected void runTest() throws Throwable {
         TestDataHandlerProvider prov = new TestDataHandlerProvider();
         OMFactory factory = metaFactory.getOMFactory();
-        OMText text = factory.createOMText(null, prov, true);
+        String contentID = nullContentID ? null : UIDGenerator.generateContentId();
+        OMText text = factory.createOMText(contentID, prov, true);
         assertFalse(prov.isDataHandlerCreated());
         assertEquals(text.getDataHandler().getContent(), "Data");
         assertTrue(prov.isDataHandlerCreated());
+        if (contentID == null) {
+            assertThat(text.getContentID()).isNotNull();
+        } else {
+            assertThat(text.getContentID()).isEqualTo(contentID);
+        }
     }
 }