Skip to content

Commit

Permalink
Improve ComparisonReportWriterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nestabentum committed Aug 11, 2022
1 parent 5fe9968 commit 33ad244
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class ComparisonReportWriterTest extends TestBase {

@Test
public void test() throws ExitException {
public void firsLevelOfLookupMapComplete() throws ExitException {
JPlagResult result = runJPlagWithDefaultOptions("PartialPlagiarism");
var mapper = new ComparisonReportWriter(Submission::getName);

Expand All @@ -23,6 +23,30 @@ public void test() throws ExitException {
firstLevelOfMapContains(stringMapMap, "A", "B", "C", "D", "E");
}

@Test
public void secondLevelOfLookupMapComplete() throws ExitException {
JPlagResult result = runJPlagWithDefaultOptions("PartialPlagiarism");
var mapper = new ComparisonReportWriter(Submission::getName);

Map<String, Map<String, String>> stringMapMap = mapper.writeComparisonReports(result, "");

secondLevelOfMapContains(stringMapMap, "A", "B", "C", "D", "E");
secondLevelOfMapContains(stringMapMap, "B", "A", "C", "D", "E");
secondLevelOfMapContains(stringMapMap, "C", "B", "A", "D", "E");
secondLevelOfMapContains(stringMapMap, "D", "B", "C", "A", "E");
secondLevelOfMapContains(stringMapMap, "E", "B", "C", "D", "A");
}

private void secondLevelOfMapContains(Map<String, Map<String, String>> stringMapMap, String firstLevelSubmission,
String... secondLevelSubmissions) {
for (String secondLevelSubmission : secondLevelSubmissions) {
Assertions.assertNotNull(stringMapMap.get(firstLevelSubmission).get(secondLevelSubmission));
Assertions.assertFalse(stringMapMap.get(firstLevelSubmission).get(secondLevelSubmission).isEmpty());

}

}

private void firstLevelOfMapContains(Map<String, Map<String, String>> stringMapMap, String... names) {
for (String name : names) {
Assertions.assertNotNull(stringMapMap.get(name));
Expand Down

0 comments on commit 33ad244

Please sign in to comment.