|
|
@@ -2,17 +2,16 @@ package de.jplag;
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
-import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
-import de.jplag.exceptions.BasecodeException;
|
|
|
import de.jplag.exceptions.ExitException;
|
|
|
|
|
|
-public class ParallelComparisonTest extends TestBase {
|
|
|
+class ParallelComparisonTest extends TestBase {
|
|
|
|
|
|
/**
|
|
|
* The simple duplicate contains obvious plagiarism.
|
|
|
@@ -111,7 +110,7 @@ public class ParallelComparisonTest extends TestBase {
|
|
|
void testMultiRootDirSeparateBasecode() throws ExitException {
|
|
|
String basecodePath = getBasePath("basecode-base");
|
|
|
List<String> paths = List.of(getBasePath("basecode"), getBasePath("SimpleDuplicate")); // 3 + 2 submissions.
|
|
|
- JPlagResult result = runJPlag(paths, it -> it.withBaseCodeSubmissionName(basecodePath));
|
|
|
+ JPlagResult result = runJPlag(paths, it -> it.withBaseCodeSubmissionDirectory(new File(basecodePath)));
|
|
|
assertEquals(5, result.getNumberOfSubmissions());
|
|
|
}
|
|
|
|
|
|
@@ -119,17 +118,10 @@ public class ParallelComparisonTest extends TestBase {
|
|
|
void testMultiRootDirBasecodeInSubmissionDir() throws ExitException {
|
|
|
String basecodePath = getBasePath("basecode", "base");
|
|
|
List<String> paths = List.of(getBasePath("basecode"), getBasePath("SimpleDuplicate")); // 2 + 2 submissions.
|
|
|
- JPlagResult result = runJPlag(paths, it -> it.withBaseCodeSubmissionName(basecodePath));
|
|
|
+ JPlagResult result = runJPlag(paths, it -> it.withBaseCodeSubmissionDirectory(new File(basecodePath)));
|
|
|
assertEquals(4, result.getNumberOfSubmissions());
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- void testMultiRootDirBasecodeName() {
|
|
|
- List<String> paths = List.of(getBasePath("basecode"), getBasePath("SimpleDuplicate"));
|
|
|
- String basecodePath = "base"; // Should *not* find basecode/base
|
|
|
- assertThrows(BasecodeException.class, () -> runJPlag(paths, it -> it.withBaseCodeSubmissionName(basecodePath)));
|
|
|
- }
|
|
|
-
|
|
|
@Test
|
|
|
void testDisjunctNewAndOldRootDirectories() throws ExitException {
|
|
|
List<String> newDirectories = List.of(getBasePath("SimpleDuplicate")); // 2 submissions
|
|
|
@@ -153,7 +145,7 @@ public class ParallelComparisonTest extends TestBase {
|
|
|
String basecodePath = getBasePath("basecode", "base");
|
|
|
List<String> newDirectories = List.of(getBasePath("SimpleDuplicate")); // 2 submissions
|
|
|
List<String> oldDirectories = List.of(getBasePath("basecode")); // 3 - 1 submissions
|
|
|
- JPlagResult result = runJPlag(newDirectories, oldDirectories, it -> it.withBaseCodeSubmissionName(basecodePath));
|
|
|
+ JPlagResult result = runJPlag(newDirectories, oldDirectories, it -> it.withBaseCodeSubmissionDirectory(new File(basecodePath)));
|
|
|
int numberOfExpectedComparison = 1 + 2 * 2;
|
|
|
assertEquals(numberOfExpectedComparison, result.getAllComparisons().size());
|
|
|
}
|