You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/09/15 13:31:39 UTC

[13/13] incubator-joshua git commit: Fixed failing unit test: Added missing KenLM guard.

Fixed failing unit test: Added missing KenLM guard.


Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/5d697489
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/5d697489
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/5d697489

Branch: refs/heads/master
Commit: 5d69748957378e99377765d5ce20daaf207eaa64
Parents: 7fc205f
Author: Michael A. Hedderich <mi...@users.noreply.github.com>
Authored: Thu Sep 15 14:40:46 2016 +0200
Committer: Michael A. Hedderich <mi...@users.noreply.github.com>
Committed: Thu Sep 15 14:40:46 2016 +0200

----------------------------------------------------------------------
 .../apache/joshua/decoder/cky/SourceAnnotationsTest.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/5d697489/src/test/java/org/apache/joshua/decoder/cky/SourceAnnotationsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/SourceAnnotationsTest.java b/src/test/java/org/apache/joshua/decoder/cky/SourceAnnotationsTest.java
index 000ba7e..ce09506 100644
--- a/src/test/java/org/apache/joshua/decoder/cky/SourceAnnotationsTest.java
+++ b/src/test/java/org/apache/joshua/decoder/cky/SourceAnnotationsTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertEquals;
 
 import org.apache.joshua.decoder.Decoder;
 import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.util.io.KenLmTestUtil;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
@@ -55,13 +56,15 @@ public class SourceAnnotationsTest {
     joshuaConfig = new JoshuaConfiguration();
     joshuaConfig.readConfigFile(JOSHUA_CONFIG_PATH);
     joshuaConfig.source_annotations = sourceAnnotations;
-    decoder = new Decoder(joshuaConfig, "");
+    KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
   }
 
   @AfterMethod
   public void tearDown() throws Exception {
-    decoder.cleanUp();
-    decoder = null;
+    if (decoder != null) {
+      decoder.cleanUp();
+      decoder = null;
+    }
   }
 
 }