Skip to content

Commit 8ec6739

Browse files
Merge upstream branch 'master' into cc
Notable changes: - NUTCH-2887 Migrate to JUnit 5 Jupiter - no dependencies on JUnit 4 left
2 parents dc1357c + 667e217 commit 8ec6739

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

ivy/ivy.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@
149149
<dependency org="org.apache.mrunit" name="mrunit" rev="1.1.0" conf="test->default">
150150
<artifact name="mrunit" ns0:classifier="hadoop2" />
151151
<exclude org="log4j" module="log4j" />
152+
<exclude org="junit" module="junit" />
153+
<exclude org="org.powermock" module="powermock-module-junit4" />
154+
<exclude org="com.google.guava" name="guava" />
152155
</dependency>
153156

154157
<!-- Jetty used to serve test pages for unit tests, but is also provided as dependency of Hadoop -->

src/plugin/parse-js/src/test/org/apache/nutch/parse/js/TestJSParseFilter.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
package org.apache.nutch.parse.js;
1818

19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertTrue;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertTrue;
2121

2222
import java.io.File;
2323
import java.io.IOException;
@@ -95,20 +95,23 @@ public void testJavaScriptOutlinkExtraction()
9595
for (int i = 0; i < filenames.length; i++) {
9696
Outlink[] outlinks = getOutlinks(filenames[i]);
9797
if (filenames[i].endsWith("parse_pure_js_test.js")) {
98-
assertEquals("number of outlinks in .js test file should be X", 2,
99-
outlinks.length);
100-
assertEquals("http://search.lucidimagination.com/p:nutch", outlinks[0].getToUrl());
98+
assertEquals(2, outlinks.length,
99+
"number of outlinks in .js test file should be X");
100+
assertEquals("http://search.lucidimagination.com/p:nutch",
101+
outlinks[0].getToUrl());
101102
assertEquals("http://search-lucene.com/nutch", outlinks[1].getToUrl());
102103
} else {
103-
assertTrue("number of outlinks in .html file should be at least 2", outlinks.length >= 2);
104+
assertTrue(outlinks.length >= 2,
105+
"number of outlinks in .html file should be at least 2");
104106
Set<String> outlinkSet = new TreeSet<>();
105107
for (Outlink o : outlinks) {
106108
outlinkSet.add(o.getToUrl());
107109
}
108-
assertTrue("http://search.lucidimagination.com/p:nutch not in outlinks",
109-
outlinkSet.contains("http://search.lucidimagination.com/p:nutch"));
110-
assertTrue("http://search-lucene.com/nutch not in outlinks",
111-
outlinkSet.contains("http://search-lucene.com/nutch"));
110+
assertTrue(
111+
outlinkSet.contains("http://search.lucidimagination.com/p:nutch"),
112+
"http://search.lucidimagination.com/p:nutch not in outlinks");
113+
assertTrue(outlinkSet.contains("http://search-lucene.com/nutch"),
114+
"http://search-lucene.com/nutch not in outlinks");
112115
}
113116
}
114117
}

src/test/org/apache/nutch/protocol/AbstractHttpProtocolPluginTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.apache.nutch.protocol;
1818

1919
import static java.nio.charset.StandardCharsets.UTF_8;
20-
import static org.junit.Assert.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertEquals;
2121

2222
import java.io.BufferedReader;
2323
import java.io.InputStreamReader;
@@ -286,10 +286,10 @@ protected ProtocolOutput fetchPage(int port, String page, int expectedCode,
286286
httpStatusCode = Integer.parseInt(crawlDatum.getMetaData()
287287
.get(Nutch.PROTOCOL_STATUS_CODE_KEY).toString());
288288
}
289-
assertEquals("HTTP Status Code for " + url, expectedCode, httpStatusCode);
289+
assertEquals(expectedCode, httpStatusCode, "HTTP Status Code for " + url);
290290
if (httpStatusCode == 200 && expectedContentType != null) {
291291
Content content = protocolOutput.getContent();
292-
assertEquals("ContentType " + url, "text/html", content.getContentType());
292+
assertEquals("text/html", content.getContentType(), "ContentType " + url);
293293
}
294294
return protocolOutput;
295295
}

0 commit comments

Comments
 (0)