Skip to content

Commit 14daa14

Browse files
committed
Fix tests.
1 parent 86ea828 commit 14daa14

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/org/wikipedia/tools/CommandLineParser.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ public static List<OffsetDateTime> parseDateRange(Map<String, String> parsedargs
310310
startstring + " specified in " + startflag + ".");
311311
System.exit(2);
312312
}
313-
return List.of(startdate, enddate);
313+
List<OffsetDateTime> ret = new ArrayList<>(); // needed because List.of doesn't like null
314+
ret.add(startdate);
315+
ret.add(enddate);
316+
return ret;
314317
}
315318

316319
/**

test/org/wikipedia/WikiTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,15 +1022,15 @@ public void whatLinksHere() throws Exception
10221022
assertTrue(results.get(0).isEmpty());
10231023

10241024
// check namespace filtering (can test functionality here)
1025-
List<String> titles = List.of("Wikipedia:Featured picture candidates");
1025+
List<String> titles = List.of("Main Page");
10261026
results = enWiki.whatLinksHere(titles, false, false, Wiki.MAIN_NAMESPACE);
1027-
assertEquals(List.of("FPC", "Wikipedia community", "Featured picture candidates",
1028-
"Featured picture candidate"), results.get(0), "namespace filter");
1027+
assertTrue(results.get(0).containsAll(List.of("Home page", "Wikipedia", "MainPage")), "namespace filter");
1028+
assertFalse(results.get(0).contains("Portal:Main page"));
10291029

10301030
// check redirect filtering
10311031
results = enWiki.whatLinksHere(titles, true, false, Wiki.MAIN_NAMESPACE);
1032-
assertEquals(List.of("Featured picture candidates", "Featured picture candidate"),
1033-
results.get(0), "namespace filter");
1032+
assertTrue(results.get(0).containsAll(List.of("MainPage")), "redirect filter");
1033+
assertFalse(results.get(0).removeAll(List.of("Portal:Main page", "Home page", "Wikipedia")));
10341034

10351035
// check adding redirects to results
10361036
results = testWiki.whatLinksHere(List.of("Main Page"), false, false, Wiki.HELP_NAMESPACE);

0 commit comments

Comments
 (0)