Commit a1c2402f authored by Florian Schäfer's avatar Florian Schäfer

Minor fixes, new ErrorProne check for fields that can be final

parent 83ff387a
Pipeline #26299084 passed with stages
in 39 minutes and 41 seconds
......@@ -44,7 +44,6 @@ classes.dependsOn(copyToLib)
test {
useJUnitPlatform()
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
}
......@@ -81,6 +80,7 @@ tasks.withType(JavaCompile) {
"-Xep:DefaultCharset:ERROR",
"-Xep:StringEquality:ERROR",
"-Xep:ConstantField:WARN",
"-Xep:FieldCanBeFinal:WARN",
"-Xep:LambdaFunctionalInterface:WARN",
"-Xep:MethodCanBeStatic:WARN",
"-Xep:MultiVariableDeclaration:WARN",
......
......@@ -31,8 +31,8 @@ class AllValidationTests {
}
static class ValidationTest<T extends Test> {
private Severity severity;
private int code;
private final Severity severity;
private final int code;
ValidationTest(final Severity severity, final int code) {
this.severity = severity;
this.code = code;
......
......@@ -22,7 +22,7 @@ public abstract class BatchProcessedTagTest<T extends BatchProcessedTagTest.Test
super(name, description);
}
private List<T> primitivesForBatches = new ArrayList<>();
private final List<T> primitivesForBatches = new ArrayList<>();
/**
* Creates a companion object for the given primitive, on which the test can later continue to operate.
......
......@@ -93,11 +93,11 @@ public class WikipediaRedirect extends BatchProcessedTagTest<WikipediaRedirect.T
*/
private void checkBatch(final IWikipediaSite site, final List<Map.Entry<String, List<OsmPrimitive>>> batch) {
try {
final QueryResult queryResult = ApiQueryClient.query(
final QueryResult.Query.Redirects redirects = ApiQueryClient.query(
WikipediaActionApiQuery.query(site, batch.stream().map(Map.Entry::getKey).collect(Collectors.toList()))
);
).getQuery().getRedirects();
for (Map.Entry<String, List<OsmPrimitive>> entry : batch) {
final String redirectedTitle = queryResult.getQuery().getRedirects().resolveRedirect(entry.getKey());
final String redirectedTitle = redirects.resolveRedirect(entry.getKey());
if (redirectedTitle != null && !redirectedTitle.equals(entry.getKey())) {
errors.add(
AllValidationTests.WIKIPEDIA_ARTICLE_REDIRECTS.getBuilder(this)
......
......@@ -3,19 +3,13 @@ package org.wikipedia.api.wdq;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.compress.utils.IOUtils;
import org.junit.Rule;
import org.junit.Test;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.tools.HttpClient;
import org.wikipedia.api.ApiQuery;
import org.wikipedia.api.ApiQueryClient;
import org.wikipedia.api.wdq.json.SparqlResult;
......
......@@ -2,13 +2,10 @@
package org.wikipedia.gui;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.Rule;
import org.junit.Test;
import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
import org.openstreetmap.josm.gui.preferences.server.ServerAccessPreference;
import org.openstreetmap.josm.testutils.JOSMTestRules;
public class WikiPreferencesTest {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment