kopia lustrzana https://github.com/JOSM/MapWithAI
FIXUP: PMD issues
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
f66f950d16
commit
667bae488b
|
@ -84,8 +84,7 @@ public class MapWithAIPluginTest {
|
|||
* @throws IllegalArgumentException see {@link java.lang.reflect.Field#get}
|
||||
*/
|
||||
@Test
|
||||
public void testMapWithAIPlugin()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void testMapWithAIPlugin() throws ReflectiveOperationException {
|
||||
Field menuEntries = MapWithAIPlugin.class.getDeclaredField("MENU_ENTRIES");
|
||||
menuEntries.setAccessible(true);
|
||||
// + 1 comes from the preferences panel
|
||||
|
|
|
@ -31,8 +31,7 @@ public class UpdateProdTest {
|
|||
public JOSMTestRules rule = new JOSMTestRules().preferences();
|
||||
|
||||
@Test
|
||||
public void testDoProd()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void testDoProd() throws ReflectiveOperationException {
|
||||
TestUtils.assumeWorkingJMockit();
|
||||
new OpenBrowserMocker();
|
||||
if (GraphicsEnvironment.isHeadless()) {
|
||||
|
|
|
@ -74,8 +74,7 @@ public class DownloadListenerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDestroyAll()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void testDestroyAll() throws ReflectiveOperationException {
|
||||
DataSet ds = new DataSet();
|
||||
DownloadListener listener = new DownloadListener(ds);
|
||||
Field listenerDs = DownloadListener.class.getDeclaredField("ds");
|
||||
|
|
|
@ -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 org.awaitility.Awaitility;
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -59,7 +58,7 @@ public class MapWithAIActionTest {
|
|||
|
||||
MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "temporary", null));
|
||||
action.actionPerformed(null);
|
||||
Awaitility.await().atMost(Durations.TEN_SECONDS)
|
||||
await().atMost(Durations.TEN_SECONDS)
|
||||
.until(() -> 1 == MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
|
||||
assertEquals(1, MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
|
||||
|
||||
|
@ -81,7 +80,7 @@ public class MapWithAIActionTest {
|
|||
MapWithAIAction.toggleLayer(layer);
|
||||
assertSame(layer, MainApplication.getLayerManager().getActiveLayer());
|
||||
MapWithAIDataUtils.getLayer(true);
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
// Adding the MapWithAI layer switches to it
|
||||
assertSame(MapWithAIDataUtils.getLayer(false), MainApplication.getLayerManager().getActiveLayer());
|
||||
MapWithAIAction.toggleLayer(layer);
|
||||
|
@ -98,7 +97,7 @@ public class MapWithAIActionTest {
|
|||
assertNull(notification);
|
||||
|
||||
MapWithAILayer layer = MapWithAIDataUtils.getLayer(true);
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
notification = MapWithAIAction.createMessageDialog();
|
||||
assertNotNull(notification);
|
||||
DataSource source = new DataSource(new Bounds(38.8876078, -77.012173, 38.892087, -77.0059234), "test area");
|
||||
|
|
|
@ -21,7 +21,6 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -129,7 +128,7 @@ public class MapWithAILayerTest {
|
|||
assertNull(mapWithAILayer, "There should be no MapWithAI layer yet");
|
||||
|
||||
mapWithAILayer = MapWithAIDataUtils.getLayer(true);
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
assertEquals(MapWithAILayer.class, mapWithAILayer.getClass(),
|
||||
"The MapWithAI layer should be of the MapWithAILayer.class");
|
||||
|
||||
|
@ -195,7 +194,7 @@ public class MapWithAILayerTest {
|
|||
@Test
|
||||
public void testGetMenuEntries() {
|
||||
Layer layer = MapWithAIDataUtils.getLayer(true);
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
await().atMost(Durations.ONE_SECOND).until(() -> MapWithAIDataUtils.getLayer(false) != null);
|
||||
Action[] actions = layer.getMenuEntries();
|
||||
assertTrue(actions.length > 0);
|
||||
assertEquals(ContinuousDownloadAction.class, layer.getMenuEntries()[actions.length - 3].getClass());
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.awaitility.Durations;
|
|||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openstreetmap.josm.TestUtils;
|
||||
import org.openstreetmap.josm.data.UndoRedoHandler;
|
||||
import org.openstreetmap.josm.data.coor.LatLon;
|
||||
|
@ -93,7 +92,7 @@ public class MapWithAIMoveActionTest {
|
|||
|
||||
@Test
|
||||
public void testMoveEmptyAction() {
|
||||
Assertions.assertDoesNotThrow(() -> moveAction.actionPerformed(null));
|
||||
assertDoesNotThrow(() -> moveAction.actionPerformed(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -9,7 +9,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -69,7 +68,7 @@ public class MapWithAIRemoteControlTest {
|
|||
public void testNominalRequest() throws Exception {
|
||||
newHandler("https://localhost?url="
|
||||
+ Utils.encodeUrl(MapWithAILayerInfo.getInstance().getLayers().get(0).getUrl())).handle();
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND)
|
||||
await().atMost(Durations.ONE_SECOND)
|
||||
.until(() -> !MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
||||
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
@ -81,7 +80,7 @@ public class MapWithAIRemoteControlTest {
|
|||
public void testTemporaryUrl() throws Exception {
|
||||
final String badUrl = "https://bad.url";
|
||||
newHandler("https://localhost?url=" + Utils.encodeUrl(badUrl)).handle();
|
||||
Awaitility.await().atMost(Durations.ONE_SECOND)
|
||||
await().atMost(Durations.ONE_SECOND)
|
||||
.until(() -> !MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
||||
|
@ -102,7 +101,7 @@ public class MapWithAIRemoteControlTest {
|
|||
final Integer maxObj = 1;
|
||||
newHandler("http://127.0.0.1:8111/mapwithai?bbox=" + getTestBBox().toStringCSV(",") + "&max_obj="
|
||||
+ maxObj.toString()).handle();
|
||||
Awaitility.await().atMost(Durations.TWO_SECONDS)
|
||||
await().atMost(Durations.TWO_SECONDS)
|
||||
.until(() -> !MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
||||
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
@ -122,7 +121,7 @@ public class MapWithAIRemoteControlTest {
|
|||
public void testBBox() throws Exception {
|
||||
BBox temp = getTestBBox();
|
||||
newHandler("http://127.0.0.1:8111/mapwithai?bbox={bbox}".replace("{bbox}", temp.toStringCSV(","))).handle();
|
||||
Awaitility.await().atMost(Durations.TWO_SECONDS)
|
||||
await().atMost(Durations.TWO_SECONDS)
|
||||
.until(() -> !MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
||||
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MapWithAIUploadHookTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws PluginException, IOException {
|
||||
try (final InputStream in = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8))) {
|
||||
try (InputStream in = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8))) {
|
||||
info = new PluginInformation(in, "MapWithAI", null);
|
||||
info.localversion = "no-such-version";
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ConnectedCommandTest {
|
|||
* Setup test.
|
||||
*/
|
||||
@Rule
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
public JOSMTestRules rule = new JOSMTestRules().projection();
|
||||
|
||||
@Test
|
||||
|
|
|
@ -23,7 +23,7 @@ public class DuplicateCommandTest {
|
|||
* Setup test.
|
||||
*/
|
||||
@Rule
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
public JOSMTestRules rule = new JOSMTestRules().projection();
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,7 +25,7 @@ public class MergeBuildingAddressTest {
|
|||
* Setup test.
|
||||
*/
|
||||
@Rule
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
public JOSMTestRules rule = new JOSMTestRules().projection();
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ConnectingNodeInformationTestTest {
|
|||
* Setup test.
|
||||
*/
|
||||
@Rule
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
public JOSMTestRules rule = new JOSMTestRules().projection();
|
||||
|
||||
@Test
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RoutingIslandsTestTest {
|
|||
* Setup test.
|
||||
*/
|
||||
@Rule
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
public JOSMTestRules rule = new JOSMTestRules().projection().preferences().timeout(30000);
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.junit.Rule;
|
||||
|
@ -31,8 +30,7 @@ public class StreetAddressTestTest {
|
|||
public JOSMTestRules test = new JOSMTestRules().projection();
|
||||
|
||||
@Test
|
||||
public void testVisitWay() throws NoSuchMethodException, SecurityException, IllegalAccessException,
|
||||
IllegalArgumentException, InvocationTargetException {
|
||||
public void testVisitWay() throws ReflectiveOperationException {
|
||||
StreetAddressTest test = new StreetAddressTest();
|
||||
Way way1 = TestUtils.newWay("", new Node(new LatLon(0, 0)), new Node(new LatLon(1, 1)));
|
||||
DataSet ds = new DataSet();
|
||||
|
|
|
@ -44,14 +44,10 @@ public class MapWithAIPreferencesTest {
|
|||
/**
|
||||
* Test method for {@link MapWithAIPreferences#addGui(PreferenceTabbedPane)}.
|
||||
*
|
||||
* @throws SecurityException see {@link java.lang.Class#getDeclaredField}
|
||||
* @throws NoSuchFieldException see {@link java.lang.Class#getDeclaredField}
|
||||
* @throws IllegalAccessException see {@link java.lang.reflect.Field#get}
|
||||
* @throws IllegalArgumentException see {@link java.lang.reflect.Field#get}
|
||||
* @throws ReflectiveOperationException If a reflexive operation fails
|
||||
*/
|
||||
@Test
|
||||
public void testAddGui()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void testAddGui() throws ReflectiveOperationException {
|
||||
final PreferenceTabbedPane pane = new PreferenceTabbedPane();
|
||||
pane.buildGui();
|
||||
Field tab = PreferenceTabbedPane.class.getDeclaredField("tabs");
|
||||
|
|
|
@ -28,8 +28,7 @@ public class AddMapWithAIPanelTest {
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void test()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void test() throws ReflectiveOperationException {
|
||||
new WindowMocker();
|
||||
MapWithAIInfo oldInfo = new MapWithAIInfo();
|
||||
AddMapWithAIPanel panel = new AddMapWithAIPanel(oldInfo);
|
||||
|
|
|
@ -54,8 +54,7 @@ public class MapWithAIProvidersPanelTest {
|
|||
* (update the test!)
|
||||
*/
|
||||
@Test
|
||||
public void testSetCurrentBounds()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
public void testSetCurrentBounds() throws ReflectiveOperationException {
|
||||
Field areaListenersField = mapwithaiProvidersPanel.getClass().getDeclaredField("areaListeners");
|
||||
areaListenersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -85,8 +84,7 @@ public class MapWithAIProvidersPanelTest {
|
|||
* (update the test!)
|
||||
*/
|
||||
@Test
|
||||
public void testTicket19473()
|
||||
throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
|
||||
public void testTicket19473() throws ReflectiveOperationException {
|
||||
mapwithaiProvidersPanel = new MapWithAIProvidersPanel(new JPanel());
|
||||
Field defaultTableField = MapWithAIProvidersPanel.class.getDeclaredField("defaultTable");
|
||||
JTable defaultTable = (JTable) defaultTableField.get(mapwithaiProvidersPanel);
|
||||
|
|
Ładowanie…
Reference in New Issue