Refactor for test fixtures

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head
Taylor Smock 2022-01-12 10:31:10 -07:00
rodzic bdd2d5bafe
commit f535eaab6e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
135 zmienionych plików z 69 dodań i 45 usunięć

Wyświetl plik

@ -5,13 +5,14 @@ import java.nio.file.Files
import java.nio.file.Paths
plugins {
id "com.diffplug.spotless" version "6.1.0"
id "com.diffplug.spotless" version "6.1.2"
id "com.github.ben-manes.versions" version "0.41.0"
id "com.github.spotbugs" version "4.8.0"
// id "de.aaschmid.cpd" version "3.3"
id "eclipse"
id "jacoco"
id "java"
id "java-test-fixtures" /* Used for publishing test fixtures package */
id "maven-publish"
id "net.ltgt.errorprone" version "2.0.2"
id "org.openstreetmap.josm" version "0.7.1"
@ -53,10 +54,19 @@ repositories {
sourceSets {
test {
java {
srcDirs = ["test/unit"]
srcDirs = ["src/test/unit"]
}
resources {
srcDirs = ["test/data"]
srcDirs = ["src/test/resources"]
}
}
testFixtures {
java {
srcDirs = ["src/test/unit"]
setIncludes(new HashSet(['org/openstreetmap/josm/plugins/mapwithai/testutils/**/*.java']))
}
resources {
srcDirs = ["src/test/resources"]
}
}
intTest {
@ -65,10 +75,10 @@ sourceSets {
runtimeClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.test.output
java {
srcDirs = ["test/integration"]
srcDirs = ["src/test/integration"]
}
resources {
srcDirs = ["test/data"]
srcDirs = ["src/test/resources"]
}
}
}
@ -76,13 +86,14 @@ sourceSets {
def versions = [
awaitility: "4.1.1",
errorprone: "2.10.0",
jacoco: "0.8.5",
jacoco: "0.8.7",
jmockit: "1.49",
junit: "5.8.2",
pmd: "6.20.0",
spotbugs: "4.5.3",
wiremock: "2.32.0",
findsecbugs: "1.11.0",
josm: properties.get("plugin.compile.version"),
]
dependencies {
@ -92,18 +103,21 @@ dependencies {
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:${versions.findsecbugs}"
errorprone("com.google.errorprone:error_prone_core:${versions.errorprone}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
testImplementation("org.jmockit:jmockit:${versions.jmockit}")
testImplementation("com.github.spotbugs:spotbugs-annotations:${versions.spotbugs}")
testImplementation("org.openstreetmap.josm:josm-unittest:"){changing=true}
testImplementation("com.github.tomakehurst:wiremock-jre8:${versions.wiremock}")
testImplementation("org.awaitility:awaitility:${versions.awaitility}")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
testFixturesRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
testFixturesImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
testFixturesImplementation("org.jmockit:jmockit:${versions.jmockit}")
testFixturesImplementation("com.github.spotbugs:spotbugs-annotations:${versions.spotbugs}")
testFixturesImplementation("org.openstreetmap.josm:josm:${versions.josm}")
testFixturesImplementation("org.openstreetmap.josm:josm-unittest:"){changing=true}
testFixturesImplementation("com.github.tomakehurst:wiremock-jre8:${versions.wiremock}")
testFixturesImplementation("org.awaitility:awaitility:${versions.awaitility}")
}
configurations {
testImplementation.extendsFrom testFixturesImplementation
testRuntimeOnly.extendsFrom testFixturesRuntimeOnly
intTestRuntimeOnly.extendsFrom testRuntimeOnly
intTestImplementation.extendsFrom testImplementation
}

Wyświetl plik

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="mapwithai" default="dist" basedir=".">
<property name="plugin.src.dir" value="src/main/java"/>
<property name="plugin.test.dir" value="src/test"/>
<!-- edit the properties of this plugin in the file `gradle.properties` -->
<property file="${basedir}/gradle.properties"/>

Wyświetl plik

@ -6,7 +6,7 @@
<conf name="test" extends="runtime" />
</configurations>
<dependencies>
<dependency org="org.junit.jupiter" name="junit-jupiter" rev="5.6.2" conf="test->default" />
<dependency org="org.awaitility" name="awaitility" rev="4.0.2" conf="test->default" />
<dependency org="org.junit.jupiter" name="junit-jupiter" rev="5.8.2" conf="test->default" />
<dependency org="org.awaitility" name="awaitility" rev="4.1.1" conf="test->default" />
</dependencies>
</ivy-module>

Wyświetl plik

@ -4,11 +4,11 @@ package org.openstreetmap.josm.plugins.mapwithai;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import javax.swing.JOptionPane;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Field;
import javax.swing.JOptionPane;
import org.junit.jupiter.api.Test;
import org.openstreetmap.josm.TestUtils;
import org.openstreetmap.josm.data.Version;

Wyświetl plik

@ -17,9 +17,9 @@ import org.openstreetmap.josm.data.osm.BBox;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.GpxLayer;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
/**
* @author Taylor Smock

Wyświetl plik

@ -10,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.awaitility.Durations;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -30,6 +29,8 @@ import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.tools.Territories;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Test class for {@link MapWithAIAction}
*

Wyświetl plik

@ -14,7 +14,6 @@ import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openstreetmap.josm.TestUtils;
@ -38,6 +37,8 @@ import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.tools.Logging;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Test class for {@link MapWithAIDataUtils}
*

Wyświetl plik

@ -5,15 +5,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import javax.swing.text.JTextComponent;
import java.awt.Component;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
import javax.swing.text.JTextComponent;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ -29,6 +28,8 @@ import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* @author Taylor Smock
*

Wyświetl plik

@ -21,9 +21,9 @@ import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
/**
* @author Taylor Smock

Wyświetl plik

@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ -21,6 +20,8 @@ import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Command;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@Command
class AddNodeToWayCommandTest {
private Node toAdd;

Wyświetl plik

@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.Collections;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openstreetmap.josm.TestUtils;
@ -21,6 +20,8 @@ import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@NoExceptions
class ConnectedCommandTest {
/**

Wyświetl plik

@ -20,7 +20,6 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openstreetmap.josm.TestUtils;
@ -33,6 +32,8 @@ import org.openstreetmap.josm.plugins.mapwithai.backend.GetDataRunnable;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.tools.Pair;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* @author Taylor Smock
*/

Wyświetl plik

@ -11,7 +11,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openstreetmap.josm.TestUtils;
@ -25,6 +24,8 @@ import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Command;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@Command
class MovePrimitiveDataSetCommandTest {
@RegisterExtension

Wyświetl plik

@ -9,7 +9,6 @@ import static org.openstreetmap.josm.tools.I18n.tr;
import java.util.Arrays;
import java.util.Collection;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ -27,6 +26,8 @@ import org.openstreetmap.josm.plugins.mapwithai.commands.MergeAddressBuildings;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Command
@BasicPreferences
class MergeAddressBuildingsTest {

Wyświetl plik

@ -5,14 +5,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import javax.swing.JOptionPane;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ -33,6 +32,8 @@ import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.mockers.WindowMocker;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Test class for {@link MissingConnectionTags}
*

Some files were not shown because too many files have changed in this diff Show More