clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1363156 - /incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
Date Wed, 18 Jul 2012 22:23:21 GMT
Author: tommaso
Date: Wed Jul 18 22:23:21 2012
New Revision: 1363156

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

Modified:
    incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java

Modified: incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java?rev=1363156&r1=1363155&r2=1363156&view=diff
==============================================================================
--- incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
(original)
+++ incubator/clerezza/trunk/uima/uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
Wed Jul 18 22:23:21 2012
@@ -29,8 +29,6 @@ import javax.ws.rs.core.MediaType;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.fail;
-
 /**
  * Testcase for {@link UIMABaseMetadataGenerator}
  */
@@ -38,48 +36,32 @@ public class UIMABaseMetadataGeneratorTe
   private static final String TEXT_TO_ANALYZE = "Italy, the defending champions and four-time
World Cup winners, suffer a shock World Cup defeat to Slovakia, who win a remarkable game
3-2 to book their place in the last 16";
 
   @Test
-  public void testConstructor() {
-    try {
-      new UIMABaseMetadataGenerator();
-    }
-    catch (Exception e) {
-      fail(e.getLocalizedMessage());
-    }
+  public void testConstructor() throws Exception {
+    new UIMABaseMetadataGenerator();
   }
 
   @Test
-  public void testGenerateMethodWithUnsupportedMediaType() {
-    try {
-      UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator();
-      String textToAnalyze = TEXT_TO_ANALYZE;
-      MGraph mGraph = new SimpleMGraph();
-      GraphNode node = new GraphNode(new UriRef("test"), mGraph);
-      MediaType wrongMediaType = MediaType.valueOf("multipart/form-data; boundary=AaB03x");
-      baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), wrongMediaType);
-    } catch (Exception e) {
-      fail(e.getLocalizedMessage());
-    }
-
+  public void testGenerateMethodWithUnsupportedMediaType() throws Exception {
+    UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator();
+    String textToAnalyze = TEXT_TO_ANALYZE;
+    MGraph mGraph = new SimpleMGraph();
+    GraphNode node = new GraphNode(new UriRef("test"), mGraph);
+    MediaType wrongMediaType = MediaType.valueOf("multipart/form-data; boundary=AaB03x");
+    baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), wrongMediaType);
   }
 
   @Test
-  public void testGenerateMethodWithsupportedMediaType() {
-    try {
-
-      ExternalServicesFacade externalServicesFacade = new ExternalServicesFacade();
-      Map<String, Object> parameterSettings = new HashMap<String, Object>();
-      parameterSettings.put("apikey", "04490000a72fe7ec5cb3497f14e77f338c86f2fe");
-      parameterSettings.put("licenseID", "g6h9zamsdtwhb93nc247ecrs");
-      externalServicesFacade.setParameterSetting(parameterSettings);
-      UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator(externalServicesFacade);
-      String textToAnalyze = TEXT_TO_ANALYZE;
-      MGraph mGraph = new SimpleMGraph();
-      GraphNode node = new GraphNode(new UriRef("test"), mGraph);
-      baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), MediaType.TEXT_PLAIN_TYPE);
-    } catch (Exception e) {
-      fail(e.getLocalizedMessage());
-    }
-
+  public void testGenerateMethodWithsupportedMediaType() throws Exception {
+    ExternalServicesFacade externalServicesFacade = new ExternalServicesFacade();
+    Map<String, Object> parameterSettings = new HashMap<String, Object>();
+    parameterSettings.put("apikey", "04490000a72fe7ec5cb3497f14e77f338c86f2fe");
+    parameterSettings.put("licenseID", "g6h9zamsdtwhb93nc247ecrs");
+    externalServicesFacade.setParameterSetting(parameterSettings);
+    UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator(externalServicesFacade);
+    String textToAnalyze = TEXT_TO_ANALYZE;
+    MGraph mGraph = new SimpleMGraph();
+    GraphNode node = new GraphNode(new UriRef("test"), mGraph);
+    baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), MediaType.TEXT_PLAIN_TYPE);
   }
 
 }



Mime
View raw message