Преглед изворни кода

Refine exception-expecting test cases with the specialized exception classes.

Timur Sağlam пре 4 година
родитељ
комит
8d52c68e31
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      jplag/src/test/java/de/jplag/BaseCodeTest.java

+ 6 - 4
jplag/src/test/java/de/jplag/BaseCodeTest.java

@@ -6,7 +6,9 @@ import java.io.File;
 
 
 import org.junit.Test;
 import org.junit.Test;
 
 
+import de.jplag.exceptions.BasecodeException;
 import de.jplag.exceptions.ExitException;
 import de.jplag.exceptions.ExitException;
+import de.jplag.exceptions.RootDirectoryException;
 
 
 public class BaseCodeTest extends TestBase {
 public class BaseCodeTest extends TestBase {
 
 
@@ -16,7 +18,7 @@ public class BaseCodeTest extends TestBase {
         verifyResults(result);
         verifyResults(result);
     }
     }
     
     
-    @Test(expected = ExitException.class)
+    @Test(expected = BasecodeException.class)
     public void testTinyBasecode() throws ExitException {
     public void testTinyBasecode() throws ExitException {
         runJPlag("TinyBasecode", it -> it.setBaseCodeSubmissionName("base"));
         runJPlag("TinyBasecode", it -> it.setBaseCodeSubmissionName("base"));
     }
     }
@@ -41,17 +43,17 @@ public class BaseCodeTest extends TestBase {
         assertEquals(85f, result.getComparisons().get(0).similarity(), DELTA);
         assertEquals(85f, result.getComparisons().get(0).similarity(), DELTA);
     }
     }
 
 
-    @Test(expected = ExitException.class)
+    @Test(expected = RootDirectoryException.class)
     public void testInvalidRoot() throws ExitException {
     public void testInvalidRoot() throws ExitException {
         runJPlag("basecode", it -> it.setRootDirectoryName("WrongRoot"));
         runJPlag("basecode", it -> it.setRootDirectoryName("WrongRoot"));
     }
     }
 
 
-    @Test(expected = ExitException.class)
+    @Test(expected = BasecodeException.class)
     public void testInvalidBasecode() throws ExitException {
     public void testInvalidBasecode() throws ExitException {
         runJPlag("basecode", it -> it.setBaseCodeSubmissionName("WrongBasecode"));
         runJPlag("basecode", it -> it.setBaseCodeSubmissionName("WrongBasecode"));
     }
     }
 
 
-    @Test(expected = ExitException.class)
+    @Test(expected = BasecodeException.class)
     public void testBasecodeWithDots() throws ExitException {
     public void testBasecodeWithDots() throws ExitException {
         runJPlag("basecode", it -> it.setBaseCodeSubmissionName("." + File.separator + "base"));
         runJPlag("basecode", it -> it.setBaseCodeSubmissionName("." + File.separator + "base"));
     }
     }