Author: tommaso
Date: Wed Jul 18 22:21:23 2012
New Revision: 1363153

URL: http://svn.apache.org/viewvc?rev=1363153&view=rev
Log:
[CLEREZZA-695] - minor refactoring to uima.casconsumer tests

Modified:
    
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ClerezzaCASConsumerTest.java
    
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ao/AnnotationOntologyCASConsumerTest.java

Modified: 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ClerezzaCASConsumerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ClerezzaCASConsumerTest.java?rev=1363153&r1=1363152&r2=1363153&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ClerezzaCASConsumerTest.java
 (original)
+++ 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ClerezzaCASConsumerTest.java
 Wed Jul 18 22:21:23 2012
@@ -35,7 +35,6 @@ import org.apache.uima.util.CasCreationU
 import org.junit.Test;
 
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
 
 /**
  * TestCase for {@link ClerezzaCASConsumer}
@@ -43,37 +42,28 @@ import static org.junit.Assert.fail;
 public class ClerezzaCASConsumerTest {
 
   @Test
-  public void configurationTest() {
-    try {
-      
AnnotatorTester.doConfigurationTest("src/main/resources/ClerezzaCASConsumerDescriptor.xml");
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getLocalizedMessage());
-    }
+  public void configurationTest() throws Exception {
+    
AnnotatorTester.doConfigurationTest("src/main/resources/ClerezzaCASConsumerDescriptor.xml");
   }
 
   @Test
-  public void simpleRunningTest() {
-    try {
-      AnnotatorTester annotatorTester = new 
AnnotatorTester("src/test/resources/TestClerezzaCASConsumerDescriptor.xml");
-
-      /* create a mock CAS */
-      CAS cas = createCAS();
-
-      cas.setDocumentText("Clerezza is an Apache project");
-      cas.setDocumentLanguage("en");
-
-      AnnotationFS annotation = cas.createAnnotation(cas.getAnnotationType(), 
0, 9);
-      cas.addFsToIndexes(annotation);
-
-      /* execute ClerezzaCASConsumer on the created CAS */
-      annotatorTester.performTest(cas);
-
-      MGraph createdGraph = TcManager.getInstance().getMGraph(new 
UriRef("mytest-clerezza-uima-graph"));
-      assertNotNull(createdGraph);
-    } catch (Exception e) {
-      fail(e.getLocalizedMessage());
-    }
+  public void simpleRunningTest() throws Exception {
+    AnnotatorTester annotatorTester = new 
AnnotatorTester("src/test/resources/TestClerezzaCASConsumerDescriptor.xml");
+
+    /* create a mock CAS */
+    CAS cas = createCAS();
+
+    cas.setDocumentText("Clerezza is an Apache project");
+    cas.setDocumentLanguage("en");
+
+    AnnotationFS annotation = cas.createAnnotation(cas.getAnnotationType(), 0, 
9);
+    cas.addFsToIndexes(annotation);
+
+    /* execute ClerezzaCASConsumer on the created CAS */
+    annotatorTester.performTest(cas);
+
+    MGraph createdGraph = TcManager.getInstance().getMGraph(new 
UriRef("mytest-clerezza-uima-graph"));
+    assertNotNull(createdGraph);
   }
 
   private CAS createCAS() throws ResourceInitializationException, CASException 
{

Modified: 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ao/AnnotationOntologyCASConsumerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ao/AnnotationOntologyCASConsumerTest.java?rev=1363153&r1=1363152&r2=1363153&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ao/AnnotationOntologyCASConsumerTest.java
 (original)
+++ 
incubator/clerezza/trunk/uima/uima.casconsumer/src/test/java/org/apache/clerezza/uima/casconsumer/ao/AnnotationOntologyCASConsumerTest.java
 Wed Jul 18 22:21:23 2012
@@ -36,7 +36,6 @@ import org.apache.uima.util.CasCreationU
 import org.junit.Test;
 
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
 
 /**
  * TestCase for {@link ClerezzaCASConsumer} using {@link AOMappingStrategy}
@@ -44,8 +43,7 @@ import static org.junit.Assert.fail;
 public class AnnotationOntologyCASConsumerTest {
 
   @Test
-  public void simpleRunningTest() {
-    try {
+  public void simpleRunningTest() throws Exception {
       AnnotatorTester annotatorTester = new 
AnnotatorTester("src/test/resources/TestAnnotationOntologyCASConsumerDescriptor.xml");
 
       /* create a mock CAS */
@@ -62,9 +60,6 @@ public class AnnotationOntologyCASConsum
 
       MGraph createdGraph = TcManager.getInstance().getMGraph(new 
UriRef("mytest-clerezza-ao-graph"));
       assertNotNull(createdGraph);
-    } catch (Exception e) {
-      fail(e.getLocalizedMessage());
-    }
   }
 
   private CAS createCAS() throws ResourceInitializationException, CASException 
{


Reply via email to