Changeset 17275 in josm for trunk/test/unit/org
- Timestamp:
- 2020-10-28T20:41:00+01:00 (2 years ago)
- Location:
- trunk/test/unit/org
- Files:
-
- 538 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/CustomMatchers.java
r16634 r17275 12 12 import org.hamcrest.Matcher; 13 13 import org.hamcrest.TypeSafeMatcher; 14 import org.junit. Ignore;14 import org.junit.jupiter.api.Disabled; 15 15 import org.openstreetmap.josm.data.Bounds; 16 16 import org.openstreetmap.josm.data.coor.EastNorth; … … 20 20 * Custom matchers for unit tests. 21 21 */ 22 @ Ignore("no test")22 @Disabled("no test") 23 23 public final class CustomMatchers { 24 24 -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r15233 r17275 2 2 package org.openstreetmap.josm; 3 3 4 import static org.junit. Assert.assertNull;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 8 import java.io.File; -
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r17198 r17275 2 2 package org.openstreetmap.josm; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertTrue; 7 import static org.junit.Assert.fail; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 import static org.junit.jupiter.api.Assumptions.assumeFalse; 8 9 9 10 import java.awt.Component; … … 34 35 import java.util.stream.Stream; 35 36 36 import org.junit.Assert; 37 import org.junit.Assume; 37 import org.junit.jupiter.api.Assertions; 38 38 import org.openstreetmap.josm.command.Command; 39 39 import org.openstreetmap.josm.data.osm.DataSet; … … 447 447 * Use to assume that EqualsVerifier is working with the current JVM. 448 448 */ 449 @SuppressWarnings("null") 449 450 public static void assumeWorkingEqualsVerifier() { 450 451 if (Utils.getJavaVersion() >= 16) { … … 457 458 nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion.ofThisVm(); 458 459 } catch (IllegalArgumentException e) { 459 Assume.assumeNoException(e);460 assumeFalse(e != null); 460 461 } 461 462 } … … 464 465 * Use to assume that JMockit is working with the current JVM. 465 466 */ 467 @SuppressWarnings("null") 466 468 public static void assumeWorkingJMockit() { 467 469 try { … … 471 473 new JOptionPaneSimpleMocker(); 472 474 } catch (UnsupportedOperationException e) { 473 Assume.assumeNoException(e);475 assumeFalse(e != null); 474 476 } finally { 475 477 TestRunnerDecorator.cleanUpAllMocks(); … … 546 548 /** 547 549 * Replaces {@linkplain System#lineSeparator() system dependent line separators} with {@code \n} 548 * and calls {@link Assert #assertEquals(java.lang.Object, java.lang.Object)}.550 * and calls {@link Assertions#assertEquals(java.lang.Object, java.lang.Object)}. 549 551 * @param expected expected value 550 552 * @param actual the value to check against <code>expected</code> -
trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java
r14822 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests for class {@link AboutAction}. 14 14 */ 15 publicfinal class AboutActionTest {15 final class AboutActionTest { 16 16 17 17 /** 18 18 * Setup test. 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().main(); … … 26 26 */ 27 27 @Test 28 publicvoid testBuildAboutPanel() {28 void testBuildAboutPanel() { 29 29 assertNotNull(new AboutAction().buildAboutPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java
r13108 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertNull; 7 8 import org.junit.Before; 9 import org.junit.Rule; 10 import org.junit.Test; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 import org.junit.jupiter.api.BeforeEach; 10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 11 12 import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection; 12 13 import org.openstreetmap.josm.actions.AlignInLineAction.Line; … … 24 25 * Unit tests for class {@link AlignInLineAction}. 25 26 */ 26 publicfinal class AlignInLineActionTest {27 final class AlignInLineActionTest { 27 28 28 29 /** 29 30 * Setup test. 30 31 */ 31 @R ule32 @RegisterExtension 32 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 34 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 39 40 * Setup test. 40 41 */ 41 @Before 42 @BeforeEach 42 43 public void setUp() { 43 44 // Enable "Align in line" feature. … … 54 55 */ 55 56 @Test 56 publicvoid testNodesOpenWay() throws InvalidSelection {57 void testNodesOpenWay() throws InvalidSelection { 57 58 DataSet dataSet = new DataSet(); 58 59 … … 86 87 */ 87 88 @Test 88 publicvoid testNodesClosedWay() throws InvalidSelection {89 void testNodesClosedWay() throws InvalidSelection { 89 90 DataSet dataSet = new DataSet(); 90 91 … … 119 120 */ 120 121 @Test 121 publicvoid testNodesOpenWays() throws InvalidSelection {122 void testNodesOpenWays() throws InvalidSelection { 122 123 DataSet dataSet = new DataSet(); 123 124 … … 153 154 */ 154 155 @Test 155 publicvoid testSimpleWay() throws InvalidSelection {156 void testSimpleWay() throws InvalidSelection { 156 157 DataSet dataSet = new DataSet(); 157 158 … … 200 201 private void assertCoordEq(Node node, double x, double y) { 201 202 EastNorth coordinate = node.getEastNorth(); 202 assertEquals( "Wrong x coordinate.", x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION);203 assertEquals( "Wrong y coordinate.", y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION);203 assertEquals(x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION, "Wrong x coordinate."); 204 assertEquals(y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION, "Wrong y coordinate."); 204 205 } 205 206 … … 209 210 */ 210 211 @Test 211 publicvoid testLineDifferentCoordinates() throws InvalidSelection {212 void testLineDifferentCoordinates() throws InvalidSelection { 212 213 assertNotNull(new Line(new Node(new EastNorth(0, 1)), 213 214 new Node(new EastNorth(0, 2)))); … … 222 223 * @throws InvalidSelection always 223 224 */ 224 @Test (expected = InvalidSelection.class)225 publicvoid testLineSameCoordinates1() throws InvalidSelection {226 new Line(new Node(new EastNorth(0, 1)),227 new Node(new EastNorth(0, 1))) ;225 @Test 226 void testLineSameCoordinates1() throws InvalidSelection { 227 assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)), 228 new Node(new EastNorth(0, 1)))); 228 229 } 229 230 … … 232 233 * @throws InvalidSelection always 233 234 */ 234 @Test (expected = InvalidSelection.class)235 publicvoid testLineSameCoordinates2() throws InvalidSelection {236 new Line(new Node(new EastNorth(0, 1)),237 new Node(new EastNorth(0+1e-175, 1+1e-175))) ;235 @Test 236 void testLineSameCoordinates2() throws InvalidSelection { 237 assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)), 238 new Node(new EastNorth(0+1e-175, 1+1e-175)))); 238 239 } 239 240 } -
trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
r16438 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 6 7 7 import java.io.IOException; … … 15 15 import java.util.Set; 16 16 17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.extension.RegisterExtension; 18 import org.junit.jupiter.api.Test; 19 19 import org.openstreetmap.josm.TestUtils; 20 20 import org.openstreetmap.josm.data.osm.DataSet; … … 32 32 * Unit tests for class {@link CombineWayAction}. 33 33 */ 34 publicclass CombineWayActionTest {34 class CombineWayActionTest { 35 35 36 36 /** 37 37 * Setup test. 38 38 */ 39 @R ule39 @RegisterExtension 40 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 41 public JOSMTestRules test = new JOSMTestRules(); … … 47 47 */ 48 48 @Test 49 publicvoid testTicket11957() throws IOException, IllegalDataException {49 void testTicket11957() throws IOException, IllegalDataException { 50 50 try (InputStream is = TestUtils.getRegressionDataStream(11957, "data.osm")) { 51 51 DataSet ds = OsmReader.parseDataSet(is, null); … … 68 68 */ 69 69 @Test 70 publicvoid testTicket18385() throws IOException, IllegalDataException {70 void testTicket18385() throws IOException, IllegalDataException { 71 71 try (InputStream is = TestUtils.getRegressionDataStream(18385, "data.osm")) { 72 72 DataSet ds = OsmReader.parseDataSet(is, null); … … 82 82 */ 83 83 @Test 84 publicvoid testTicket18387() throws IOException, IllegalDataException {84 void testTicket18387() throws IOException, IllegalDataException { 85 85 try (InputStream is = TestUtils.getRegressionDataStream(18387, "data.osm")) { 86 86 DataSet ds = OsmReader.parseDataSet(is, null); … … 104 104 */ 105 105 @Test 106 publicvoid testTicket18367() throws IOException, IllegalDataException {106 void testTicket18367() throws IOException, IllegalDataException { 107 107 try (InputStream is = TestUtils.getRegressionDataStream(18367, "nocombine.osm")) { 108 108 DataSet ds = OsmReader.parseDataSet(is, null); … … 125 125 */ 126 126 @Test 127 publicvoid testTicket18367NeedsSplit() throws IOException, IllegalDataException {127 void testTicket18367NeedsSplit() throws IOException, IllegalDataException { 128 128 try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) { 129 129 DataSet ds = OsmReader.parseDataSet(is, null); … … 149 149 */ 150 150 @Test 151 publicvoid testDetectReversedWays() throws IOException, IllegalDataException {151 void testDetectReversedWays() throws IOException, IllegalDataException { 152 152 try (InputStream is = TestUtils.getRegressionDataStream(18367, "silent-revert.osm")) { 153 153 DataSet ds = OsmReader.parseDataSet(is, null); … … 175 175 */ 176 176 @Test 177 publicvoid testEqualsContract() {177 void testEqualsContract() { 178 178 TestUtils.assumeWorkingEqualsVerifier(); 179 179 EqualsVerifier.forClass(NodePair.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertTrue;8 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.fail; 9 9 10 10 import java.awt.datatransfer.Clipboard; … … 15 15 import java.util.Arrays; 16 16 17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 20 import org.openstreetmap.josm.data.osm.DataSet; … … 32 32 * Unit tests for class {@link CopyAction}. 33 33 */ 34 publicclass CopyActionTest {34 class CopyActionTest { 35 35 private static final class CapturingCopyAction extends CopyAction { 36 36 private boolean warningShown; … … 45 45 * We need prefs for this. 46 46 */ 47 @R ule47 @RegisterExtension 48 48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 49 49 public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI(); … … 55 55 */ 56 56 @Test 57 publicvoid testWarnOnEmpty() throws UnsupportedFlavorException, IOException {57 void testWarnOnEmpty() throws UnsupportedFlavorException, IOException { 58 58 Clipboard clipboard = ClipboardUtils.getClipboard(); 59 59 clipboard.setContents(new StringSelection("test"), null); … … 82 82 */ 83 83 @Test 84 publicvoid testCopySinglePrimitive() throws Exception {84 void testCopySinglePrimitive() throws Exception { 85 85 DataSet data = new DataSet(); 86 86 -
trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
r14977 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertSame;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.lang.reflect.Field; … … 9 9 import java.util.Collection; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.data.coor.EastNorth; 14 14 import org.openstreetmap.josm.data.coor.LatLon; … … 29 29 * Unit tests for class {@link CreateCircleAction}. 30 30 */ 31 publicfinal class CreateCircleActionTest {31 final class CreateCircleActionTest { 32 32 33 33 /** 34 34 * Setup test. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().projection(); … … 45 45 */ 46 46 @Test 47 publicvoid testTicket7421case0() throws ReflectiveOperationException {47 void testTicket7421case0() throws ReflectiveOperationException { 48 48 DataSet dataSet = new DataSet(); 49 49 … … 65 65 // Expected result: Dataset contain one closed way, clockwise 66 66 Collection<Way> resultingWays = dataSet.getWays(); 67 assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()), 68 resultingWays.size(), 1); 67 assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size())); 69 68 Way resultingWay = resultingWays.iterator().next(); 70 assertTrue("Resulting way is not closed", 71 resultingWay.isClosed()); 72 assertTrue("Found anti-clockwize circle while way was clockwize", 73 Geometry.isClockwise(resultingWay)); 69 assertTrue(resultingWay.isClosed(), "Resulting way is not closed"); 70 assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise circle while way was clockwise"); 74 71 } 75 72 … … 102 99 */ 103 100 @Test 104 publicvoid testTicket7421case1() throws ReflectiveOperationException {101 void testTicket7421case1() throws ReflectiveOperationException { 105 102 DataSet dataSet = new DataSet(); 106 103 … … 127 124 // Expected result: Dataset contain one closed way, clockwise 128 125 Collection<Way> resultingWays = dataSet.getWays(); 129 assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()), 130 resultingWays.size(), 1); 126 assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size())); 131 127 Way resultingWay = resultingWays.iterator().next(); 132 assertTrue("Resulting way is not closed", 133 resultingWay.isClosed()); 134 assertTrue("Found anti-clockwise way while traffic is left hand.", 135 Geometry.isClockwise(resultingWay)); 128 assertTrue(resultingWay.isClosed(), "Resulting way is not closed"); 129 assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise way while traffic is left hand."); 136 130 } finally { 137 131 // Restore left/right hand traffic database -
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
r15162 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.nio.file.Files; … … 12 12 import java.util.TreeMap; 13 13 14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.extension.RegisterExtension; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.command.SequenceCommand; … … 37 37 * Unit test of {@link CreateMultipolygonAction} 38 38 */ 39 publicclass CreateMultipolygonActionTest {39 class CreateMultipolygonActionTest { 40 40 41 41 /** 42 42 * Setup test. 43 43 */ 44 @R ule44 @RegisterExtension 45 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 46 46 public JOSMTestRules test = new JOSMTestRules().projection().main().preferences(); … … 80 80 81 81 @Test 82 publicvoid testCreate1() throws Exception {82 void testCreate1() throws Exception { 83 83 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null); 84 84 Pair<SequenceCommand, Relation> mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null); … … 88 88 89 89 @Test 90 publicvoid testCreate2() throws Exception {90 void testCreate2() throws Exception { 91 91 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null); 92 92 Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.", null, true); … … 95 95 96 96 @Test 97 publicvoid testUpdate1() throws Exception {97 void testUpdate1() throws Exception { 98 98 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null); 99 99 Relation mp = createMultipolygon(ds.getWays(), "ref=\".*1$\"", null, true); … … 106 106 107 107 @Test 108 publicvoid testUpdate2() throws Exception {108 void testUpdate2() throws Exception { 109 109 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null); 110 110 Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.1", null, true); … … 119 119 */ 120 120 @Test 121 publicvoid testTicket17767() throws Exception {121 void testTicket17767() throws Exception { 122 122 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17767, "upd-mp.osm"), null); 123 123 Layer layer = new OsmDataLayer(ds, null, null); … … 141 141 */ 142 142 @Test 143 publicvoid testTicket17768() throws Exception {143 void testTicket17768() throws Exception { 144 144 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17768, "dupmem.osm"), null); 145 145 Layer layer = new OsmDataLayer(ds, null, null); -
trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertNotNull;5 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 10 import org.openstreetmap.josm.gui.MainApplication; … … 17 17 * Unit tests for class {@link DeleteLayerAction}. 18 18 */ 19 publicfinal class DeleteLayerActionTest {19 final class DeleteLayerActionTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 */ 31 31 @Test 32 publicvoid testActionPerformed() {32 void testActionPerformed() { 33 33 DeleteLayerAction action = new DeleteLayerAction(); 34 34 // No layer -
trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.junit.contrib.java.lang.system.ExpectedSystemExit; 9 9 import org.openstreetmap.josm.TestUtils; … … 22 22 * Unit tests for class {@link ExitAction}. 23 23 */ 24 publicfinal class ExitActionTest {24 final class ExitActionTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules().main(); … … 34 34 * System.exit rule 35 35 */ 36 @R ule36 @RegisterExtension 37 37 public final ExpectedSystemExit exit = ExpectedSystemExit.none(); 38 38 … … 41 41 */ 42 42 @Test 43 publicvoid testActionPerformed() {43 void testActionPerformed() { 44 44 TestUtils.assumeWorkingJMockit(); 45 45 exit.expectSystemExitWithStatus(0); -
trunk/test/unit/org/openstreetmap/josm/actions/ExpertToggleActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.concurrent.atomic.AtomicBoolean; … … 9 9 import javax.swing.JPanel; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.extension.RegisterExtension; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 21 21 * @since 11224 22 22 */ 23 publicclass ExpertToggleActionTest {23 class ExpertToggleActionTest { 24 24 /** 25 25 * We need prefs to store expert mode state. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 34 34 */ 35 35 @Test 36 publicvoid testVisibilitySwitcher() {36 void testVisibilitySwitcher() { 37 37 ExpertToggleAction.getInstance().setExpert(false); 38 38 JPanel c = new JPanel(); … … 58 58 */ 59 59 @Test 60 publicvoid testExpertModeListener() {60 void testExpertModeListener() { 61 61 AtomicBoolean value = new AtomicBoolean(false); 62 62 ExpertToggleAction.getInstance().setExpert(true); -
trunk/test/unit/org/openstreetmap/josm/actions/ExtensionFileFilterTest.java
r13352 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.TestUtils; 8 8 import org.openstreetmap.josm.actions.ExtensionFileFilter.AddArchiveExtension; … … 13 13 * Unit tests for class {@link ExtensionFileFilter}. 14 14 */ 15 publicclass ExtensionFileFilterTest {15 class ExtensionFileFilterTest { 16 16 17 17 private static void test(String extensions, String defaultExtension, String description, boolean addArchiveExtensionsToDescription, … … 28 28 */ 29 29 @Test 30 publicvoid testNewFilterWithArchiveExtensions() {30 void testNewFilterWithArchiveExtensions() { 31 31 test("ext1", "ext1", "description", true, 32 32 "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip", … … 47 47 */ 48 48 @Test 49 publicvoid testEqualsContract() {49 void testEqualsContract() { 50 50 TestUtils.assumeWorkingEqualsVerifier(); 51 51 EqualsVerifier.forClass(ExtensionFileFilter.class).usingGetClass() … … 57 57 */ 58 58 @Test 59 publicvoid testEnumAddArchiveExtension() {59 void testEnumAddArchiveExtension() { 60 60 TestUtils.superficialEnumCodeCoverage(AddArchiveExtension.class); 61 61 } -
trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import org.junit. Rule;5 import org.junit. Test;4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.testutils.JOSMTestRules; 7 7 … … 11 11 * Test {@link FullscreenToggleAction} 12 12 */ 13 publicclass FullscreenToggleActionTest {13 class FullscreenToggleActionTest { 14 14 /** 15 15 * Setup test. 16 16 */ 17 @R ule17 @RegisterExtension 18 18 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 19 19 public JOSMTestRules test = new JOSMTestRules().main(); … … 23 23 */ 24 24 @Test 25 publicvoid testFullscreenToggleAction() {25 void testFullscreenToggleAction() { 26 26 FullscreenToggleAction action = new FullscreenToggleAction(); 27 27 // Cannot really test it in headless mode, but at least check we can toggle the action without error -
trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
r16438 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.IOException; … … 15 15 import java.util.Set; 16 16 17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.TestUtils; 20 20 import org.openstreetmap.josm.actions.search.SearchAction; … … 44 44 * Unit tests of {@link JoinAreasAction} class. 45 45 */ 46 publicclass JoinAreasActionTest {46 class JoinAreasActionTest { 47 47 48 48 /** 49 49 * Setup test. 50 50 */ 51 @R ule51 @RegisterExtension 52 52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 53 53 public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); … … 59 59 */ 60 60 @Test 61 publicvoid testTicket9599() throws IOException, IllegalDataException {61 void testTicket9599() throws IOException, IllegalDataException { 62 62 try (InputStream is = TestUtils.getRegressionDataStream(9599, "ex5.osm")) { 63 63 DataSet ds = OsmReader.parseDataSet(is, null); … … 82 82 */ 83 83 @Test 84 publicvoid testTicket9599Simple() throws IOException, IllegalDataException {84 void testTicket9599Simple() throws IOException, IllegalDataException { 85 85 try (InputStream is = TestUtils.getRegressionDataStream(9599, "three_old.osm")) { 86 86 DataSet ds = OsmReader.parseDataSet(is, null); … … 106 106 */ 107 107 @Test 108 publicvoid testTicket10511() throws IOException, IllegalDataException {108 void testTicket10511() throws IOException, IllegalDataException { 109 109 try (InputStream is = TestUtils.getRegressionDataStream(10511, "10511_mini.osm")) { 110 110 DataSet ds = OsmReader.parseDataSet(is, null); … … 128 128 */ 129 129 @Test 130 publicvoid testTicket11992() throws IOException, IllegalDataException {130 void testTicket11992() throws IOException, IllegalDataException { 131 131 try (InputStream is = TestUtils.getRegressionDataStream(11992, "shapes.osm")) { 132 132 DataSet ds = OsmReader.parseDataSet(is, null); … … 154 154 */ 155 155 @Test 156 publicvoid testTicket18744() throws IOException, IllegalDataException {156 void testTicket18744() throws IOException, IllegalDataException { 157 157 try (InputStream is = TestUtils.getRegressionDataStream(18744, "18744-sample.osm")) { 158 158 DataSet ds = OsmReader.parseDataSet(is, null); … … 179 179 @Test 180 180 @SuppressWarnings({ "rawtypes", "unchecked" }) 181 publicvoid testExamples() throws Exception {181 void testExamples() throws Exception { 182 182 DataSet dsToJoin, dsExpected; 183 183 try (InputStream is = Files.newInputStream(Paths.get("nodist/data/Join_Areas_Tests.osm"))) { … … 199 199 Collection<OsmPrimitive> primitives = tests.get(test); 200 200 for (OsmPrimitive osm : primitives) { 201 assertTrue( test + "; expected way, but got: " + osm, osm instanceof Way);201 assertTrue(osm instanceof Way, test + "; expected way, but got: " + osm); 202 202 } 203 203 new JoinAreasAction(false).join((Collection) primitives); 204 204 Collection<OsmPrimitive> joinedCol = dsToJoin.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test)); 205 assertEquals( "in test " + test + ":", 1, joinedCol.size());205 assertEquals(1, joinedCol.size(), "in test " + test + ":"); 206 206 Collection<OsmPrimitive> expectedCol = dsExpected.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test)); 207 assertEquals( "in test " + test + ":", 1, expectedCol.size());207 assertEquals(1, expectedCol.size(), "in test " + test + ":"); 208 208 OsmPrimitive osmJoined = joinedCol.iterator().next(); 209 209 OsmPrimitive osmExpected = expectedCol.iterator().next(); 210 assertTrue( "difference in test " + test, isSemanticallyEqual(osmExpected, osmJoined));210 assertTrue(isSemanticallyEqual(osmExpected, osmJoined), "difference in test " + test); 211 211 } 212 212 } -
trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java
r16202 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 5 7 6 8 import java.awt.Rectangle; … … 10 12 import java.util.stream.Collectors; 11 13 12 import org.junit. Rule;13 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 14 16 import org.openstreetmap.josm.TestUtils; 15 17 import org.openstreetmap.josm.data.coor.EastNorth; … … 33 35 * Unit tests for class {@link JoinNodeWayAction}. 34 36 */ 35 publicfinal class JoinNodeWayActionTest {37 final class JoinNodeWayActionTest { 36 38 /** 37 39 * Setup test. 38 40 */ 39 @R ule41 @RegisterExtension 40 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 43 public JOSMTestRules test = new JOSMTestRules().projection().main().preferences(); … … 61 63 */ 62 64 @Test 63 publicvoid testTicket18189() throws Exception {65 void testTicket18189() throws Exception { 64 66 DataSet dataSet = new DataSet(); 65 67 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); … … 93 95 action.actionPerformed(null); 94 96 // Make sure the node was only moved once 95 assertTrue( "Node n5 wasn't added to way w1.", w1.containsNode(n5));96 assertTrue( "Node n5 wasn't added to way w2.", w2.containsNode(n5));97 assertTrue( "Node was moved to an unexpected position", n5.getEastNorth().equalsEpsilon(expected, 1e-7));97 assertTrue(w1.containsNode(n5), "Node n5 wasn't added to way w1."); 98 assertTrue(w2.containsNode(n5), "Node n5 wasn't added to way w2."); 99 assertTrue(n5.getEastNorth().equalsEpsilon(expected, 1e-7), "Node was moved to an unexpected position"); 98 100 } finally { 99 101 MainApplication.getLayerManager().removeLayer(layer); … … 106 108 */ 107 109 @Test 108 publicvoid testTicket11508() throws Exception {110 void testTicket11508() throws Exception { 109 111 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(11508, "11508_example.osm"), null); 110 112 Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null); … … 113 115 List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N")) 114 116 .collect(Collectors.toList()); 115 assert True(nodesToMove.size() == 1);117 assertEquals(1, nodesToMove.size()); 116 118 Node toMove = nodesToMove.iterator().next(); 117 119 Node expected = new Node(new LatLon(47.56331849690742, 8.800789259499311)); … … 122 124 action.actionPerformed(null); 123 125 124 assertTrue( "Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));125 assert True("Node was not added to expected number of ways", toMove.getParentWays().size() == 2);126 assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position"); 127 assertEquals(2, toMove.getParentWays().size(), "Node was not added to expected number of ways"); 126 128 } finally { 127 129 MainApplication.getLayerManager().removeLayer(layer); … … 134 136 */ 135 137 @Test 136 publicvoid testTicket18189Crossing() throws Exception {138 void testTicket18189Crossing() throws Exception { 137 139 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "moveontocrossing.osm"), null); 138 140 Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null); … … 144 146 List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N")) 145 147 .collect(Collectors.toList()); 146 assert True(nodesToMove.size() == 1);148 assertEquals(1, nodesToMove.size()); 147 149 Node toMove = nodesToMove.iterator().next(); 148 150 ds.setSelected(toMove); … … 159 161 */ 160 162 @Test 161 publicvoid testTicket18189ThreeWays() throws Exception {163 void testTicket18189ThreeWays() throws Exception { 162 164 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "data.osm"), null); 163 165 Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null); … … 169 171 List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N")) 170 172 .collect(Collectors.toList()); 171 assert True(nodesToMove.size() == 1);173 assertEquals(1, nodesToMove.size()); 172 174 Node toMove = nodesToMove.iterator().next(); 173 175 Node expected = new Node(new LatLon(-21.088998104148224, -50.38629102179512)); 174 176 ds.setSelected(toMove); 175 177 action.actionPerformed(null); 176 assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7)); 177 assertTrue("Node was not added to expected number of ways", toMove.getParentWays().size() == 4); 178 178 assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position"); 179 assertEquals(4, toMove.getParentWays().size(), "Node was not added to expected number of ways"); 179 180 } finally { 180 181 MainApplication.getLayerManager().removeLayer(layer); … … 187 188 */ 188 189 @Test 189 publicvoid testTicket18420() throws Exception {190 void testTicket18420() throws Exception { 190 191 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18420, "user-sample.osm"), null); 191 192 Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null); … … 193 194 try { 194 195 List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name")).collect(Collectors.toList()); 195 assert True(nodesToMove.size() == 2);196 assertEquals(2, nodesToMove.size()); 196 197 Node n = nodesToMove.iterator().next(); 197 198 if (!n.hasTag("name", "select me 1st")) … … 206 207 action.setEnabled(true); 207 208 action.actionPerformed(null); 208 assertTrue( "Node was moved to an unexpected position", toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7));209 assertTrue( "Node was moved to an unexpected position", toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7));210 assert True("Node was not added to expected number of ways", toMove1.getParentWays().size() == 2);211 assert True("Node was not added to expected number of ways", toMove2.getParentWays().size() == 2);209 assertTrue(toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7), "Node was moved to an unexpected position"); 210 assertTrue(toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7), "Node was moved to an unexpected position"); 211 assertEquals(2, toMove1.getParentWays().size(), "Node was not added to expected number of ways"); 212 assertEquals(2, toMove2.getParentWays().size(), "Node was not added to expected number of ways"); 212 213 } finally { 213 214 MainApplication.getLayerManager().removeLayer(layer); … … 220 221 */ 221 222 @Test 222 publicvoid testTicket18990() throws Exception {223 void testTicket18990() throws Exception { 223 224 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18990, "18990-sample.osm"), null); 224 225 Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null); … … 226 227 try { 227 228 Node toMove = (Node) ds.getPrimitiveById(new SimplePrimitiveId(7018586511L, OsmPrimitiveType.NODE)); 228 assert True(toMove != null);229 assertNotNull(toMove); 229 230 Node expected = new Node(new LatLon(43.48582074476985, -96.76897750613033)); 230 231 … … 234 235 action.setEnabled(true); 235 236 action.actionPerformed(null); 236 assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7)); 237 assertTrue("Node was not added to expected way", toMove.getParentWays().size() == 1); 238 assertTrue("Node was not added to expected way segment", 239 toMove.getParentWays().iterator().next().getNodes().indexOf(toMove) == 2); 237 assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position"); 238 assertEquals(1, toMove.getParentWays().size(), "Node was not added to expected way"); 239 assertEquals(2, toMove.getParentWays().iterator().next().getNodes().indexOf(toMove), "Node was not added to expected way segment"); 240 240 } finally { 241 241 MainApplication.getLayerManager().removeLayer(layer); -
trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java
r16159 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 6 7 7 import java.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.data.osm.DataSet; … … 34 34 * Setup test. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 58 58 * Setup test. 59 59 */ 60 @Before 60 @BeforeEach 61 61 public void setUp() { 62 62 if (action == null) { … … 72 72 */ 73 73 @Test 74 publicvoid testMergeNoSourceLayer() {74 void testMergeNoSourceLayer() { 75 75 assertNull(MainApplication.getLayerManager().getActiveLayer()); 76 76 action.actionPerformed(null); … … 82 82 */ 83 83 @Test 84 publicvoid testMergeNoTargetLayer() {84 void testMergeNoTargetLayer() { 85 85 TestUtils.assumeWorkingJMockit(); 86 86 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker( … … 105 105 */ 106 106 @Test 107 publicvoid testMergeTwoEmptyLayers() throws Exception {107 void testMergeTwoEmptyLayers() throws Exception { 108 108 TestUtils.assumeWorkingJMockit(); 109 109 final MergeLayerExtendedDialogMocker edMocker = new MergeLayerExtendedDialogMocker(); -
trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 import static org.junit.jupiter.api.Assertions.assertThrows; 6 7 7 8 import java.util.Arrays; 8 9 import java.util.Collections; 9 10 10 import org.junit. Rule;11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 12 13 import org.openstreetmap.josm.data.coor.LatLon; 13 14 import org.openstreetmap.josm.data.osm.DataSet; … … 21 22 * Unit tests for class {@link MergeNodesAction}. 22 23 */ 23 publicclass MergeNodesActionTest {24 class MergeNodesActionTest { 24 25 25 26 /** 26 27 * Setup test. 27 28 */ 28 @R ule29 @RegisterExtension 29 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 31 public JOSMTestRules test = new JOSMTestRules().projection(); … … 33 34 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list 34 35 */ 35 @Test (expected = IllegalArgumentException.class)36 publicvoid testSelectTargetLocationNodeEmpty() {37 MergeNodesAction.selectTargetLocationNode(Collections.emptyList());36 @Test 37 void testSelectTargetLocationNodeEmpty() { 38 assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList())); 38 39 } 39 40 … … 41 42 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - invalid mode 42 43 */ 43 @Test (expected = IllegalStateException.class)44 publicvoid testSelectTargetLocationNodeInvalidMode() {44 @Test 45 void testSelectTargetLocationNodeInvalidMode() { 45 46 Config.getPref().putInt("merge-nodes.mode", -1); 46 MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1)));47 assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1)))); 47 48 } 48 49 … … 51 52 */ 52 53 @Test 53 publicvoid testSelectTargetLocationNode() {54 void testSelectTargetLocationNode() { 54 55 Config.getPref().putInt("merge-nodes.mode", 0); 55 56 assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId()); … … 68 69 */ 69 70 @Test 70 publicvoid testSelectTargetNode() {71 void testSelectTargetNode() { 71 72 assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList())); 72 73 DataSet ds = new DataSet(); -
trunk/test/unit/org/openstreetmap/josm/actions/MoveActionTest.java
r11978 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import org.junit. Test;4 import org.junit.jupiter.api.Test; 5 5 import org.openstreetmap.josm.TestUtils; 6 6 import org.openstreetmap.josm.actions.MoveAction.Direction; … … 9 9 * Unit tests for class {@link ExtensionFileFilter}. 10 10 */ 11 publicclass MoveActionTest {11 class MoveActionTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testEnumDirection() {17 void testEnumDirection() { 18 18 TestUtils.superficialEnumCodeCoverage(Direction.class); 19 19 } -
trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit.Assert.assertEquals; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 7 import java.io.InputStream; … … 10 11 import java.util.List; 11 12 12 import org.junit. Rule;13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 14 15 import org.openstreetmap.josm.TestUtils; 15 16 import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction; … … 32 33 * Unit tests for class {@link OrthogonalizeAction}. 33 34 */ 34 publicclass OrthogonalizeActionTest {35 class OrthogonalizeActionTest { 35 36 36 37 /** 37 38 * Setup test. 38 39 */ 39 @R ule40 @RegisterExtension 40 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 42 public JOSMTestRules test = new JOSMTestRules().projection(); 42 43 43 @Test (expected = OrthogonalizeAction.InvalidUserInputException.class)44 publicvoid testNoSelection() throws Exception {45 performTest("nothing selected");44 @Test 45 void testNoSelection() throws Exception { 46 assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected")); 46 47 } 47 48 48 49 @Test 49 publicvoid testClosedWay() throws Exception {50 void testClosedWay() throws Exception { 50 51 final DataSet ds = performTest("name=ClosedWay"); 51 52 final Way way = ds.getSelectedWays().iterator().next(); … … 58 59 59 60 @Test 60 publicvoid testTwoWaysFormingClosedWay() throws Exception {61 void testTwoWaysFormingClosedWay() throws Exception { 61 62 performTest("name=TwoWaysFormingClosedWay"); 62 63 } 63 64 64 65 @Test 65 publicvoid testTwoRingsAtOnce() throws Exception {66 void testTwoRingsAtOnce() throws Exception { 66 67 performTest("name=ClosedWay OR name=TwoWaysFormingClosedWay"); 67 68 } 68 69 69 70 @Test 70 publicvoid testClosedWayWithReferenceNodes() throws Exception {71 void testClosedWayWithReferenceNodes() throws Exception { 71 72 final DataSet ds = performTest("name=ClosedWayWithReferenceNodes"); 72 73 final Way way = ds.getSelectedWays().iterator().next(); … … 79 80 80 81 @Test 81 publicvoid testFourNodes() throws Exception {82 void testFourNodes() throws Exception { 82 83 final DataSet ds = performTest( 83 84 "name=NodeToRectify-01", "name=NodeToRectify-02", "name=NodeToRectify-03", "name=NodeToRectify-04"); … … 94 95 */ 95 96 @Test 96 publicvoid testUtilityClass() throws ReflectiveOperationException {97 void testUtilityClass() throws ReflectiveOperationException { 97 98 UtilityClassTestUtil.assertUtilityClassWellDefined(OrthogonalizeAction.EN.class); 98 99 } … … 122 123 */ 123 124 @Test 124 publicvoid testEnumDirection() {125 void testEnumDirection() { 125 126 TestUtils.superficialEnumCodeCoverage(Direction.class); 126 127 } -
trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.FileNotFoundException; … … 9 9 import java.io.InputStream; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.extension.RegisterExtension; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.TestUtils; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 25 25 * Unit tests for class {@link PurgeAction}. 26 26 */ 27 publicclass PurgeActionTest {27 class PurgeActionTest { 28 28 29 29 /** 30 30 * Setup test. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().main(); … … 41 41 */ 42 42 @Test 43 publicvoid testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {43 void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException { 44 44 try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) { 45 45 DataSet ds = OsmReader.parseDataSet(is, null); -
trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java
r13938 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.data.osm.DataSet; 9 9 import org.openstreetmap.josm.gui.MainApplication; … … 15 15 * Unit tests for class {@link SelectAllAction}. 16 16 */ 17 publicfinal class SelectAllActionTest {17 final class SelectAllActionTest { 18 18 19 19 /** 20 20 * Setup test. 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main(); … … 28 28 */ 29 29 @Test 30 publicvoid testActionPerformed() {30 void testActionPerformed() { 31 31 SelectByInternalPointActionTest.initDataSet(); 32 32 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); -
trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.coor.EastNorth; 12 12 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * Unit tests for class {@link SelectByInternalPointAction}. 27 27 */ 28 publicfinal class SelectByInternalPointActionTest {28 final class SelectByInternalPointActionTest { 29 29 30 30 /** 31 31 * Setup test. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main(); … … 40 40 */ 41 41 @Test 42 publicvoid testUtilityClass() throws ReflectiveOperationException {42 void testUtilityClass() throws ReflectiveOperationException { 43 43 UtilityClassTestUtil.assertUtilityClassWellDefined(SelectByInternalPointAction.class); 44 44 } … … 48 48 */ 49 49 @Test 50 publicvoid testNoDataSet() {50 void testNoDataSet() { 51 51 assertNull(MainApplication.getLayerManager().getEditDataSet()); 52 52 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size()); … … 85 85 */ 86 86 @Test 87 publicvoid testGetSurroundingObjects() {87 void testGetSurroundingObjects() { 88 88 initDataSet(); 89 89 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size()); … … 97 97 */ 98 98 @Test 99 publicvoid testGetSmallestSurroundingObject() {99 void testGetSmallestSurroundingObject() { 100 100 initDataSet(); 101 101 assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null)); … … 107 107 */ 108 108 @Test 109 publicvoid testPerformSelection() {109 void testPerformSelection() { 110 110 initDataSet(); 111 111 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); -
trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java
r15070 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.data.imagery.ImageryInfo; 9 9 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; … … 16 16 * Unit tests for class {@link SessionLoadAction}. 17 17 */ 18 publicclass SessionLoadActionTest {18 class SessionLoadActionTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 29 29 */ 30 30 @Test 31 publicvoid testTicket17702() {31 void testTicket17702() { 32 32 assertFalse(SessionLoadAction.Loader.addLayer(new TMSLayer(new ImageryInfo( 33 33 "Bing Карта (GLOBALCITY)", -
trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests for class {@link SessionSaveAsAction}. 14 14 */ 15 publicclass SessionSaveAsActionTest {15 class SessionSaveAsActionTest { 16 16 17 17 /** 18 18 * Setup test. 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testSessionSaveAsAction() {28 void testSessionSaveAsAction() { 29 29 SessionSaveAsAction action = new SessionSaveAsAction(); 30 30 assertFalse(action.isEnabled()); -
trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
r15432 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 6 7 7 import java.io.IOException; … … 16 16 import java.util.stream.Stream; 17 17 18 import org.junit. Before;19 import org.junit. Rule;20 import org.junit. Test;18 import org.junit.jupiter.api.BeforeEach; 19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 21 import org.openstreetmap.josm.TestUtils; 22 22 import org.openstreetmap.josm.command.DeleteCommand; … … 37 37 * Unit tests for class {@link SimplifyWayAction}. 38 38 */ 39 publicfinal class SimplifyWayActionTest {39 final class SimplifyWayActionTest { 40 40 41 41 /** Class under test. */ … … 45 45 * Setup test. 46 46 */ 47 @R ule47 @RegisterExtension 48 48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 49 49 public JOSMTestRules test = new JOSMTestRules().main(); … … 52 52 * Setup test. 53 53 */ 54 @Before 54 @BeforeEach 55 55 public void setUp() { 56 56 if (action == null) { … … 69 69 */ 70 70 @Test 71 publicvoid testSimplify() throws Exception {71 void testSimplify() throws Exception { 72 72 DataSet DsSimplify = getDs("tracks"); 73 73 DataSet DsExpected = getDs("tracks-simplify15"); … … 91 91 */ 92 92 @Test 93 publicvoid testSimplifyFirstNode() {93 void testSimplifyFirstNode() { 94 94 final DataSet ds = new DataSet(); 95 95 final Node n1 = new Node(new LatLon(47.26269614984, 11.34044231149)); -
trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
r15728 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertSame;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.Arrays; 8 8 9 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;10 9 import org.junit.Assert; 11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 13 12 import org.openstreetmap.josm.TestUtils; 14 13 import org.openstreetmap.josm.data.coor.EastNorth; … … 21 20 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 21 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 23 23 24 /** 24 25 * Unit tests for class {@link SplitWayAction}. 25 26 */ 26 publicfinal class SplitWayActionTest {27 final class SplitWayActionTest { 27 28 28 29 /** 29 30 * Setup test. 30 31 */ 31 @R ule32 @RegisterExtension 32 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 34 public JOSMTestRules test = new JOSMTestRules().projection(); … … 45 46 */ 46 47 @Test 47 publicvoid testTicket11184() {48 void testTicket11184() { 48 49 Node n1 = addNode(0, 0); 49 50 Node n2 = addNode(-1, 1); … … 68 69 69 70 // Ensures 3 ways. 70 assertSame(String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()), 71 dataSet.getWays().size(), 3); 71 assertSame(3, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size())); 72 72 73 73 // Ensures way w1 is unchanged. 74 assertTrue("Unselected ways disappear during split action.", 75 dataSet.getWays().contains(w1)); 76 assertSame("Unselected way seems to have change during split action.", 77 w1.getNodesCount(), 3); 74 assertTrue(dataSet.getWays().contains(w1), "Unselected ways disappear during split action."); 75 assertSame(3, w1.getNodesCount(), "Unselected way seems to have change during split action."); 78 76 for (int i = 0; i < 3; i++) { 79 assertSame("Node change in unselected way during split action.", 80 w1.getNode(i), w1NodesArray[i]); 77 assertSame(w1.getNode(i), w1NodesArray[i], "Node change in unselected way during split action."); 81 78 } 82 79 } … … 88 85 */ 89 86 @Test 90 publicvoid testTicket17810() {87 void testTicket17810() { 91 88 DataSet dataSet = new DataSet(); 92 89 Way from = TestUtils.newWay("highway=residential", new Node(new LatLon(0.0, 0.0)), … … 122 119 */ 123 120 @Test 124 publicvoid testTicket18477() {121 void testTicket18477() { 125 122 final Node n10 = addNode(1, 0); 126 123 final Node n21 = addNode(2, 1); … … 133 130 dataSet.setSelected(n10, n21); 134 131 SplitWayAction.runOn(dataSet); 135 assertSame(String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()), 136 dataSet.getWays().size(), 4); 132 assertSame(4, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size())); 137 133 } 138 134 } -
trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java
r16300 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Before;8 import org.junit. Rule;9 import org.junit. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 import org.openstreetmap.josm.data.osm.DataSet; … … 21 21 * Unit tests for class {@link UnGlueAction}. 22 22 */ 23 publicfinal class UnGlueActionTest {23 final class UnGlueActionTest { 24 24 25 25 /** Class under test. */ … … 29 29 * Setup test. 30 30 */ 31 @R ule31 @RegisterExtension 32 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 33 public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); … … 36 36 * Setup test. 37 37 */ 38 @Before 38 @BeforeEach 39 39 public void setUp() { 40 40 if (action == null) { … … 48 48 */ 49 49 @Test 50 publicvoid testSelectionEmpty() {50 void testSelectionEmpty() { 51 51 DataSet ds = new DataSet(); 52 52 OsmDataLayer layer = new OsmDataLayer(ds, "", null); … … 66 66 */ 67 67 @Test 68 publicvoid testSingleNodeNotInWay() {68 void testSingleNodeNotInWay() { 69 69 DataSet ds = new DataSet(); 70 70 Node n = new Node(LatLon.ZERO); … … 87 87 */ 88 88 @Test 89 publicvoid testSingleNodeInSingleWay() {89 void testSingleNodeInSingleWay() { 90 90 DataSet ds = new DataSet(); 91 91 Node n1 = new Node(LatLon.ZERO); … … 114 114 */ 115 115 @Test 116 publicvoid testSingleNodeInTwoWays() {116 void testSingleNodeInTwoWays() { 117 117 DataSet ds = new DataSet(); 118 118 Node n1 = new Node(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 5 6 6 import java.util.Arrays; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 10 import org.openstreetmap.josm.data.coor.EastNorth; 11 11 import org.openstreetmap.josm.data.osm.DataSet; … … 21 21 * Unit tests for class {@link UnJoinNodeWayAction}. 22 22 */ 23 publicfinal class UnJoinNodeWayActionTest {23 final class UnJoinNodeWayActionTest { 24 24 25 25 /** … … 40 40 * Setup test. 41 41 */ 42 @R ule42 @RegisterExtension 43 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 44 public JOSMTestRules test = new JOSMTestRules(); … … 51 51 */ 52 52 @Test 53 publicvoid testTicket10396() {53 void testTicket10396() { 54 54 DataSet dataSet = new DataSet(); 55 55 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); … … 83 83 84 84 // Ensures node n2 remove from w 85 assertFalse( "Node n2 wasn't removed from way w.", w.containsNode(n2));85 assertFalse(w.containsNode(n2), "Node n2 wasn't removed from way w."); 86 86 } 87 87 } -
trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java
r17023 r17275 2 2 package org.openstreetmap.josm.actions.corrector; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.data.osm.Tag; 9 9 import org.openstreetmap.josm.data.osm.Tagged; … … 16 16 * Unit tests of {@link ReverseWayNoTagCorrector} class. 17 17 */ 18 publicclass ReverseWayNoTagCorrectorTest {18 class ReverseWayNoTagCorrectorTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 29 29 */ 30 30 @Test 31 publicvoid testDirectionalTags() {31 void testDirectionalTags() { 32 32 assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("waterway", "drain")).size()); 33 33 assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("man_made", "embankment")).size()); -
trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java
r16771 r17275 8 8 9 9 import org.junit.Assert; 10 import org.junit. Rule;11 import org.junit. Test;10 import org.junit.jupiter.api.extension.RegisterExtension; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.data.correction.TagCorrection; 13 13 import org.openstreetmap.josm.data.osm.Node; … … 24 24 * Unit tests of {@link ReverseWayTagCorrector} class. 25 25 */ 26 publicclass ReverseWayTagCorrectorTest {26 class ReverseWayTagCorrectorTest { 27 27 28 28 /** 29 29 * Setup test. 30 30 */ 31 @R ule31 @RegisterExtension 32 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 33 public JOSMTestRules test = new JOSMTestRules(); … … 38 38 */ 39 39 @Test 40 publicvoid testUtilityClass() throws ReflectiveOperationException {40 void testUtilityClass() throws ReflectiveOperationException { 41 41 UtilityClassTestUtil.assertUtilityClassWellDefined(ReverseWayTagCorrector.TagSwitcher.class); 42 42 } … … 46 46 */ 47 47 @Test 48 publicvoid testTagSwitch() {48 void testTagSwitch() { 49 49 // oneway 50 50 assertSwitch(new Tag("oneway", "yes"), new Tag("oneway", "-1")); … … 121 121 */ 122 122 @Test 123 publicvoid testSwitchingWayNodes() {123 void testSwitchingWayNodes() { 124 124 final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = getTagCorrectionsForWay("direction=forward"); 125 125 Assert.assertEquals(1, tagCorrections.size()); … … 132 132 */ 133 133 @Test 134 publicvoid testNotSwitchingWayNodes() {134 void testNotSwitchingWayNodes() { 135 135 Assert.assertEquals(0, getTagCorrectionsForWay("direction=SSW").size()); 136 136 Assert.assertEquals(0, getTagCorrectionsForWay("direction=145").size()); -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit.Assert.assertNotNull; 4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 7 import java.awt.Component; 7 8 import java.util.Arrays; 8 9 9 import org.junit. Rule;10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 11 12 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 13 … … 16 17 * Unit tests for class {@link ChangesetContentDownloadTask}. 17 18 */ 18 publicclass ChangesetContentDownloadTaskTest {19 class ChangesetContentDownloadTaskTest { 19 20 20 21 /** 21 22 * Setup test. 22 23 */ 23 @R ule24 @RegisterExtension 24 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 26 public JOSMTestRules test = new JOSMTestRules(); … … 29 30 */ 30 31 @Test 31 publicvoid testChangesetContentDownloadTask() {32 void testChangesetContentDownloadTask() { 32 33 Component parent = new Component() { 33 34 // empty component … … 41 42 * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - invalid changeset id. 42 43 */ 43 @Test (expected = IllegalArgumentException.class)44 publicvoid testChangesetContentDownloadTaskInvalidId() {45 new ChangesetContentDownloadTask(0);44 @Test 45 void testChangesetContentDownloadTaskInvalidId() { 46 assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(0)); 46 47 } 47 48 … … 49 50 * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent. 50 51 */ 51 @Test (expected = IllegalArgumentException.class)52 publicvoid testChangesetContentDownloadTaskNullParent1() {53 new ChangesetContentDownloadTask(1);52 @Test 53 void testChangesetContentDownloadTaskNullParent1() { 54 assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(1)); 54 55 } 55 56 … … 57 58 * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent. 58 59 */ 59 @Test (expected = IllegalArgumentException.class)60 publicvoid testChangesetContentDownloadTaskNullParent2() {61 new ChangesetContentDownloadTask(Arrays.asList(1, 2));60 @Test 61 void testChangesetContentDownloadTaskNullParent2() { 62 assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(Arrays.asList(1, 2))); 62 63 } 63 64 } -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java
r15153 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit.Assert.assertNotNull; 4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 7 import java.awt.Component; 7 8 import java.util.Collections; 8 9 9 import org.junit. Rule;10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 11 12 import org.openstreetmap.josm.data.osm.Changeset; 12 13 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 17 18 * Unit tests for class {@link ChangesetHeaderDownloadTask}. 18 19 */ 19 publicclass ChangesetHeaderDownloadTaskTest {20 class ChangesetHeaderDownloadTaskTest { 20 21 21 22 /** 22 23 * Setup test. 23 24 */ 24 @R ule25 @RegisterExtension 25 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 27 public JOSMTestRules test = new JOSMTestRules(); … … 30 31 */ 31 32 @Test 32 publicvoid testBuildTaskForChangesets() {33 void testBuildTaskForChangesets() { 33 34 Component parent = new Component() { 34 35 // empty component … … 42 43 * Unit test of {@code ChangesetHeaderDownloadTask#buildTaskForChangesets} - null parent. 43 44 */ 44 @Test(expected = NullPointerException.class) 45 public void testBuildTaskForChangesetsNullParent() { 46 ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1))); 45 @Test 46 void testBuildTaskForChangesetsNullParent() { 47 assertThrows(NullPointerException.class, 48 () -> ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1)))); 47 49 } 48 50 } -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit.Assert.assertNotNull; 4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 7 import java.awt.Component; 7 8 8 import org.junit. Rule;9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 10 11 import org.openstreetmap.josm.io.ChangesetQuery; 11 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 17 * Unit tests for class {@link ChangesetQueryTask}. 17 18 */ 18 publicclass ChangesetQueryTaskTest {19 class ChangesetQueryTaskTest { 19 20 20 21 /** 21 22 * Setup test. 22 23 */ 23 @R ule24 @RegisterExtension 24 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 26 public JOSMTestRules test = new JOSMTestRules(); … … 29 30 */ 30 31 @Test 31 publicvoid testChangesetQueryTask() {32 void testChangesetQueryTask() { 32 33 Component parent = new Component() { 33 34 // empty component … … 39 40 * Unit test of {@code ChangesetQueryTask#ChangesetQueryTask} - null parent. 40 41 */ 41 @Test (expected = IllegalArgumentException.class)42 publicvoid testChangesetQueryTaskNullParent() {43 new ChangesetQueryTask(new ChangesetQuery());42 @Test 43 void testChangesetQueryTaskNullParent() { 44 assertThrows(IllegalArgumentException.class, () -> new ChangesetQueryTask(new ChangesetQuery())); 44 45 } 45 46 } -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 import org.openstreetmap.josm.data.osm.DataSet; … … 20 20 * Unit tests for class {@link DownloadReferrersTask}. 21 21 */ 22 publicclass DownloadReferrersTaskTest {22 class DownloadReferrersTaskTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testDownloadReferrersTask() {35 void testDownloadReferrersTask() { 36 36 DataSet ds = new DataSet(); 37 37 Node n1 = (Node) OsmPrimitiveType.NODE.newInstance(-1, true); -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java
r15216 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit. Assert.assertNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 6 7 7 import java.awt.geom.Area; 8 8 import java.util.Collections; 9 9 10 import org.junit. Rule;11 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 12 12 import org.openstreetmap.josm.data.Bounds; 13 13 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 19 19 * Unit tests for class {@link DownloadTaskList}. 20 20 */ 21 publicclass DownloadTaskListTest {21 class DownloadTaskListTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules(); … … 32 32 */ 33 33 @Test 34 publicvoid testDownloadTaskList() {34 void testDownloadTaskList() { 35 35 assertTrue(new DownloadTaskList().getDownloadedPrimitives().isEmpty()); 36 36 } … … 41 41 */ 42 42 @Test 43 publicvoid testDownloadAreaEmpty() throws Exception {43 void testDownloadAreaEmpty() throws Exception { 44 44 DownloadTaskList list = new DownloadTaskList(); 45 45 assertNull(list.download(false, -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java
r16945 r17275 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.net.URL; … … 13 13 import java.util.concurrent.TimeoutException; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 17 17 import org.openstreetmap.josm.data.Bounds; 18 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 25 25 * Unit tests for class {@link PostDownloadHandler}. 26 26 */ 27 publicclass PostDownloadHandlerTest {27 class PostDownloadHandlerTest { 28 28 29 29 /** 30 30 * Setup test. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 124 124 */ 125 125 @Test 126 publicvoid testRunExceptionFuture() {126 void testRunExceptionFuture() { 127 127 Logging.clearLastErrorAndWarnings(); 128 128 new PostDownloadHandler(null, newFuture("testRunExceptionFuture")).run(); 129 assertTrue( Logging.getLastErrorAndWarnings().toString(),129 assertTrue( 130 130 Logging.getLastErrorAndWarnings().stream() 131 .anyMatch(e -> e.endsWith("E: java.util.concurrent.ExecutionException: testRunExceptionFuture"))); 131 .anyMatch(e -> e.endsWith("E: java.util.concurrent.ExecutionException: testRunExceptionFuture")), 132 Logging.getLastErrorAndWarnings().toString()); 132 133 } 133 134 … … 136 137 */ 137 138 @Test 138 publicvoid testRunNoError() {139 void testRunNoError() { 139 140 Logging.clearLastErrorAndWarnings(); 140 141 new PostDownloadHandler(newTask(Collections.emptyList()), newFuture(null)).run(); 141 assertTrue(Logging.getLastErrorAndWarnings(). toString(), Logging.getLastErrorAndWarnings().isEmpty());142 assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), Logging.getLastErrorAndWarnings().toString()); 142 143 } 143 144 … … 146 147 */ 147 148 @Test 148 publicvoid testRunOneError() {149 void testRunOneError() { 149 150 Logging.clearLastErrorAndWarnings(); 150 151 new PostDownloadHandler(newTask(Collections.singletonList(new Object())), newFuture(null)).run(); 151 assertTrue(Logging.getLastErrorAndWarnings(). toString(), Logging.getLastErrorAndWarnings().isEmpty());152 assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), Logging.getLastErrorAndWarnings().toString()); 152 153 } 153 154 … … 156 157 */ 157 158 @Test 158 publicvoid testRunMultipleErrors() {159 void testRunMultipleErrors() { 159 160 Logging.clearLastErrorAndWarnings(); 160 161 new PostDownloadHandler(newTask(Arrays.asList("foo", new Exception("bar"), new Object())), newFuture(null)).run(); 161 assertTrue( Logging.getLastErrorAndWarnings().toString(),162 assertTrue( 162 163 Logging.getLastErrorAndWarnings().stream() 163 .anyMatch(e -> e.endsWith("E: java.lang.Exception: bar")) );164 .anyMatch(e -> e.endsWith("E: java.lang.Exception: bar")), Logging.getLastErrorAndWarnings().toString()); 164 165 } 165 166 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 10 import org.openstreetmap.josm.data.osm.NoteData; … … 19 19 * Unit tests for class {@link AddNoteAction}. 20 20 */ 21 publicclass AddNoteActionTest {21 class AddNoteActionTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 32 32 */ 33 33 @Test 34 publicvoid testMode() {34 void testMode() { 35 35 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 36 36 try { -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.TestUtils; 10 10 import org.openstreetmap.josm.actions.mapmode.DeleteAction.DeleteMode; … … 20 20 * Unit tests for class {@link DeleteAction}. 21 21 */ 22 publicclass DeleteActionTest {22 class DeleteActionTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 33 33 */ 34 34 @Test 35 publicvoid testMode() {35 void testMode() { 36 36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 37 37 try { … … 52 52 */ 53 53 @Test 54 publicvoid testEnumDeleteMode() {54 void testEnumDeleteMode() { 55 55 TestUtils.superficialEnumCodeCoverage(DeleteMode.class); 56 56 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.awt.event.InputEvent; … … 14 14 import javax.swing.JList; 15 15 16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.extension.RegisterExtension; 17 import org.junit.jupiter.api.Test; 18 18 import org.openstreetmap.josm.data.UndoRedoHandler; 19 19 import org.openstreetmap.josm.data.coor.EastNorth; … … 33 33 * Unit tests for class {@link DrawAction}. 34 34 */ 35 publicclass DrawActionTest {35 class DrawActionTest { 36 36 37 37 /** 38 38 * Setup test. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules().main().projection().timeout(20000); … … 51 51 */ 52 52 @Test 53 publicvoid testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {53 void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { 54 54 DataSet dataSet = new DataSet(); 55 55 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.TestUtils; 10 10 import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode; … … 20 20 * Unit tests for class {@link ExtrudeAction}. 21 21 */ 22 publicclass ExtrudeActionTest {22 class ExtrudeActionTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 33 33 */ 34 34 @Test 35 publicvoid testMode() {35 void testMode() { 36 36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 37 37 try { … … 52 52 */ 53 53 @Test 54 publicvoid testEnumMode() {54 void testEnumMode() { 55 55 TestUtils.superficialEnumCodeCoverage(Mode.class); 56 56 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.TestUtils; 10 10 import org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.State; … … 20 20 * Unit tests for class {@link ImproveWayAccuracyAction}. 21 21 */ 22 publicclass ImproveWayAccuracyActionTest {22 class ImproveWayAccuracyActionTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 33 33 */ 34 34 @Test 35 publicvoid testMode() {35 void testMode() { 36 36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 37 37 try { … … 52 52 */ 53 53 @Test 54 publicvoid testEnumState() {54 void testEnumState() { 55 55 TestUtils.superficialEnumCodeCoverage(State.class); 56 56 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.TestUtils; 10 10 import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode; … … 21 21 * Unit tests for class {@link ParallelWayAction}. 22 22 */ 23 publicclass ParallelWayActionTest {23 class ParallelWayActionTest { 24 24 25 25 /** 26 26 * Setup test. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 34 34 */ 35 35 @Test 36 publicvoid testMode() {36 void testMode() { 37 37 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 38 38 try { … … 53 53 */ 54 54 @Test 55 publicvoid testEnumMode() {55 void testEnumMode() { 56 56 TestUtils.superficialEnumCodeCoverage(Mode.class); 57 57 } … … 61 61 */ 62 62 @Test 63 publicvoid testEnumModifier() {63 void testEnumModifier() { 64 64 TestUtils.superficialEnumCodeCoverage(Modifier.class); 65 65 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 10 import org.openstreetmap.josm.gui.MainApplication; … … 19 19 * Unit tests for class {@link PlayHeadDragMode}. 20 20 */ 21 publicclass PlayHeadDragModeTest {21 class PlayHeadDragModeTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 32 32 */ 33 33 @Test 34 publicvoid testMode() {34 void testMode() { 35 35 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 36 36 try { -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
r14977 r17275 2 2 package org.openstreetmap.josm.actions.mapmode; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertSame;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.awt.event.InputEvent; … … 12 12 import java.util.Collection; 13 13 14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode; … … 34 34 * Unit tests for class {@link SelectAction}. 35 35 */ 36 publicclass SelectActionTest {36 class SelectActionTest { 37 37 38 38 boolean nodesMerged; … … 49 49 public void mergeNodes(OsmDataLayer layer, Collection<Node> nodes, 50 50 Node targetLocationNode) { 51 assertSame(String.format("Should merge two nodes, %d found", nodes.size()), 52 nodes.size(), 2); 51 assertSame(2, nodes.size(), String.format("Should merge two nodes, %d found", nodes.size())); 53 52 nodesMerged = true; 54 53 } … … 58 57 * Setup test. 59 58 */ 60 @R ule59 @RegisterExtension 61 60 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 61 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 70 69 @Test 71 70 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 72 publicvoid testTicket10748() throws ReflectiveOperationException {71 void testTicket10748() throws ReflectiveOperationException { 73 72 DataSet dataSet = new DataSet(); 74 73 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); … … 125 124 126 125 // As result of test, we must find a 2 nodes way, from EN(0, 0) to EN(100, 0) 127 assertTrue("Nodes are not merged", nodesMerged); 128 assertSame(String.format("Expect exactly one way, found %d%n", dataSet.getWays().size()), 129 dataSet.getWays().size(), 1); 126 assertTrue(nodesMerged, "Nodes are not merged"); 127 assertSame(1, dataSet.getWays().size(), String.format("Expect exactly one way, found %d%n", dataSet.getWays().size())); 130 128 Way rw = dataSet.getWays().iterator().next(); 131 assertFalse("Way shouldn't be deleted\n", rw.isDeleted()); 132 assertSame(String.format("Way shouldn't have 2 nodes, %d found%n", w.getNodesCount()), 133 rw.getNodesCount(), 2); 129 assertFalse(rw.isDeleted(), "Way shouldn't be deleted\n"); 130 assertSame(2, rw.getNodesCount(), String.format("Way shouldn't have 2 nodes, %d found%n", w.getNodesCount())); 134 131 Node r1 = rw.firstNode(); 135 132 Node r2 = rw.lastNode(); … … 139 136 r2 = tmp; 140 137 } 141 assertSame( String.format("East should be 0, found %f%n", r1.getEastNorth().east()),142 Double.compare(r1.getEastNorth().east(), 0), 0);143 assertSame( String.format("East should be 100, found %f%n", r2.getEastNorth().east()),144 Double.compare(r2.getEastNorth().east(), 100), 0);138 assertSame(0, Double.compare(r1.getEastNorth().east(), 0), 139 String.format("East should be 0, found %f%n", r1.getEastNorth().east())); 140 assertSame(0, Double.compare(r2.getEastNorth().east(), 100), 141 String.format("East should be 100, found %f%n", r2.getEastNorth().east())); 145 142 } finally { 146 143 // Ensure we clean the place before leaving, even if test fails. … … 153 150 */ 154 151 @Test 155 publicvoid testEnumMode() {152 void testEnumMode() { 156 153 TestUtils.superficialEnumCodeCoverage(Mode.class); 157 154 } … … 161 158 */ 162 159 @Test 163 publicvoid testEnumSelectActionCursor() {160 void testEnumSelectActionCursor() { 164 161 TestUtils.superficialEnumCodeCoverage(SelectActionCursor.class); 165 162 } -
trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java
r16577 r17275 2 2 package org.openstreetmap.josm.actions.upload; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.Arrays; 10 10 import java.util.Collection; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.command.PseudoCommand; 15 15 import org.openstreetmap.josm.command.SequenceCommand; … … 27 27 * Unit tests for class {@link FixDataHook}. 28 28 */ 29 publicclass FixDataHookTest {29 class FixDataHookTest { 30 30 31 31 /** 32 32 * Setup test. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules().main(); … … 40 40 */ 41 41 @Test 42 publicvoid testCheckUpload() {42 void testCheckUpload() { 43 43 // Empty data set 44 44 UndoRedoHandler.getInstance().clean(); … … 85 85 assertEquals(9, prims.size()); 86 86 for (OsmPrimitive o : Arrays.asList(w1, w2, w3, w4, w5, w6, w7, r1, r2)) { 87 assertTrue( o.toString(), prims.contains(o));87 assertTrue(prims.contains(o), o.toString()); 88 88 } 89 89 Collection<PseudoCommand> cmds = seq.getChildren(); -
trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.actions.upload; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.data.APIDataSet; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link ValidateUploadHook}. 15 15 */ 16 publicclass ValidateUploadHookTest {16 class ValidateUploadHookTest { 17 17 18 18 /** 19 19 * Setup test. 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().fakeAPI().timeout(30000); … … 27 27 */ 28 28 @Test 29 publicvoid testCheckUpload() {29 void testCheckUpload() { 30 30 assertTrue(new ValidateUploadHook().checkUpload(new APIDataSet())); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.ArrayList; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * Unit tests of {@link AddCommand} class. 28 28 */ 29 publicclass AddCommandTest {29 class AddCommandTest { 30 30 31 31 /** 32 32 * We need prefs for nodes. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 40 40 */ 41 41 @Test 42 publicvoid testAdd() {42 void testAdd() { 43 43 DataSet ds = new DataSet(); 44 44 assertArrayEquals(new Object[0], ds.allPrimitives().toArray()); … … 56 56 */ 57 57 @Test 58 publicvoid testAddToLayer() {58 void testAddToLayer() { 59 59 DataSet ds1 = new DataSet(); 60 60 DataSet ds2 = new DataSet(); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node osm = new Node(LatLon.ZERO); 75 75 DataSet ds = new DataSet(osm); … … 86 86 */ 87 87 @Test 88 publicvoid testParticipatingPrimitives() {88 void testParticipatingPrimitives() { 89 89 Node osm = new Node(LatLon.ZERO); 90 90 … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 Node osm = new Node(LatLon.ZERO); 100 100 … … 112 112 */ 113 113 @Test 114 publicvoid testDescription() {114 void testDescription() { 115 115 Node node = new Node(LatLon.ZERO); 116 116 node.put("name", "xy"); … … 131 131 */ 132 132 @Test 133 publicvoid testEqualsContract() {133 void testEqualsContract() { 134 134 TestUtils.assumeWorkingEqualsVerifier(); 135 135 EqualsVerifier.forClass(AddCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java
r17240 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertSame;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.ArrayList; … … 12 12 import java.util.List; 13 13 14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.extension.RegisterExtension; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.data.coor.LatLon; … … 34 34 * Unit tests of {@link AddPrimitivesCommand} class. 35 35 */ 36 publicclass AddPrimitivesCommandTest {36 class AddPrimitivesCommandTest { 37 37 38 38 /** 39 39 * We need prefs for nodes. 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 47 47 */ 48 48 @Test 49 publicvoid testAdd() {49 void testAdd() { 50 50 DataSet ds = new DataSet(); 51 51 … … 61 61 */ 62 62 @Test 63 publicvoid testAddSetSelection() {63 void testAddSetSelection() { 64 64 DataSet ds = new DataSet(); 65 65 … … 77 77 */ 78 78 @Test 79 publicvoid testAddToLayer() {79 void testAddToLayer() { 80 80 DataSet ds1 = new DataSet(); 81 81 DataSet ds2 = new DataSet(); … … 95 95 */ 96 96 @Test 97 publicvoid testAddIgnoresExisting() {97 void testAddIgnoresExisting() { 98 98 DataSet ds = new DataSet(); 99 99 … … 114 114 */ 115 115 @Test 116 publicvoid testDescription() {116 void testDescription() { 117 117 DataSet ds = new DataSet(); 118 118 … … 138 138 */ 139 139 @Test 140 publicvoid testUndo() {140 void testUndo() { 141 141 DataSet ds = new DataSet(); 142 142 … … 172 172 */ 173 173 @Test 174 publicvoid testUndoIgnoresExisting() {174 void testUndoIgnoresExisting() { 175 175 DataSet ds = new DataSet(); 176 176 … … 208 208 */ 209 209 @Test 210 publicvoid testUndoIgnoresExistingAsDeleted() {210 void testUndoIgnoresExistingAsDeleted() { 211 211 DataSet ds = new DataSet(); 212 212 … … 243 243 */ 244 244 @Test 245 publicvoid testUndoIgnoresExistingSameUniqueIdDifferentType() {245 void testUndoIgnoresExistingSameUniqueIdDifferentType() { 246 246 DataSet ds = new DataSet(); 247 247 … … 288 288 */ 289 289 @Test 290 publicvoid testParticipatingPrimitives() {290 void testParticipatingPrimitives() { 291 291 DataSet ds = new DataSet(); 292 292 … … 308 308 */ 309 309 @Test 310 publicvoid testFillModifiedData() {310 void testFillModifiedData() { 311 311 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 312 312 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 364 364 */ 365 365 @Test 366 publicvoid testEqualsContract() {366 void testEqualsContract() { 367 367 TestUtils.assumeWorkingEqualsVerifier(); 368 368 EqualsVerifier.forClass(AddPrimitivesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 11 12 import java.util.List; 12 13 13 import org.junit. Before;14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 16 17 import org.openstreetmap.josm.TestUtils; 17 18 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 34 35 * Unit tests of {@link ChangeCommand} class. 35 36 */ 36 publicclass ChangeCommandTest {37 class ChangeCommandTest { 37 38 38 39 /** 39 40 * We need prefs for nodes. 40 41 */ 41 @R ule42 @RegisterExtension 42 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 44 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 47 48 * Set up the test data. 48 49 */ 49 @Before 50 @BeforeEach 50 51 public void createTestData() { 51 52 testData = new CommandTestData(); … … 55 56 * Test that empty ways are prevented. 56 57 */ 57 @Test (expected = IllegalArgumentException.class)58 publicvoid testPreventEmptyWays() {58 @Test 59 void testPreventEmptyWays() { 59 60 Way emptyWay = new Way(); 60 new ChangeCommand(testData.existingWay, emptyWay);61 assertThrows(IllegalArgumentException.class, () -> new ChangeCommand(testData.existingWay, emptyWay)); 61 62 } 62 63 … … 65 66 */ 66 67 @Test 67 publicvoid testChange() {68 void testChange() { 68 69 Node newNode = new Node(5); 69 70 newNode.setCoor(LatLon.NORTH_POLE); … … 88 89 * Test {@link ChangeCommand#executeCommand()} fails if ID is changed 89 90 */ 90 @Test (expected = DataIntegrityProblemException.class)91 publicvoid testChangeIdChange() {91 @Test 92 void testChangeIdChange() { 92 93 Node newNode = new Node(1); 93 94 newNode.setCoor(LatLon.NORTH_POLE); 94 95 95 new ChangeCommand(testData.existingNode, newNode).executeCommand();96 assertThrows(DataIntegrityProblemException.class, () -> new ChangeCommand(testData.existingNode, newNode).executeCommand()); 96 97 } 97 98 … … 100 101 */ 101 102 @Test 102 publicvoid testUndo() {103 void testUndo() { 103 104 Node newNode = new Node(5); 104 105 newNode.setCoor(LatLon.NORTH_POLE); … … 121 122 */ 122 123 @Test 123 publicvoid testFillModifiedData() {124 void testFillModifiedData() { 124 125 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 125 126 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 135 136 */ 136 137 @Test 137 publicvoid testDescription() {138 void testDescription() { 138 139 Node node = new Node(LatLon.ZERO); 139 140 node.put("name", "xy"); … … 154 155 */ 155 156 @Test 156 publicvoid testEqualsContract() {157 void testEqualsContract() { 157 158 TestUtils.assumeWorkingEqualsVerifier(); 158 159 EqualsVerifier.forClass(ChangeCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeMembersCommandTest.java
r17199 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.Collections; 8 8 import java.util.List; 9 9 10 import org.junit. Before;11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.BeforeEach; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.TestUtils; 14 14 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 28 * Unit tests of {@link ChangeMembersCommand} class. 29 29 */ 30 publicclass ChangeMembersCommandTest {30 class ChangeMembersCommandTest { 31 31 32 32 /** 33 33 * We need prefs for nodes. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 41 41 * Set up the test data. 42 42 */ 43 @Before 43 @BeforeEach 44 44 public void createTestData() { 45 45 testData = new CommandTestDataWithRelation(); … … 50 50 */ 51 51 @Test 52 publicvoid testChange() {52 void testChange() { 53 53 assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation)); 54 54 assertEquals(2, testData.existingRelation.getMembersCount()); … … 70 70 */ 71 71 @Test 72 publicvoid testUndo() {72 void testUndo() { 73 73 List<RelationMember> members = testData.existingRelation.getMembers(); 74 74 members.add(new RelationMember("n2", testData.existingNode2)); … … 86 86 */ 87 87 @Test 88 publicvoid testDescription() {88 void testDescription() { 89 89 testData.existingRelation.put("name", "xy"); 90 90 List<RelationMember> members = testData.existingRelation.getMembers(); … … 97 97 */ 98 98 @Test 99 publicvoid testEqualsContract() {99 void testEqualsContract() { 100 100 TestUtils.assumeWorkingEqualsVerifier(); 101 101 EqualsVerifier.forClass(ChangeMembersCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 12 13 import java.util.List; 13 14 14 import org.junit. Before;15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.BeforeEach; 16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 17 18 import org.openstreetmap.josm.TestUtils; 18 19 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 33 34 * Unit tests of {@link ChangeNodesCommand} class. 34 35 */ 35 publicclass ChangeNodesCommandTest {36 class ChangeNodesCommandTest { 36 37 37 38 /** 38 39 * We need prefs for nodes. 39 40 */ 40 @R ule41 @RegisterExtension 41 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 43 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 46 47 * Set up the test data. 47 48 */ 48 @Before 49 @BeforeEach 49 50 public void createTestData() { 50 51 testData = new CommandTestData(); … … 54 55 * Test that empty ways are prevented. 55 56 */ 56 @Test (expected = IllegalArgumentException.class)57 publicvoid testPreventEmptyWays() {58 new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList());57 @Test 58 void testPreventEmptyWays() { 59 assertThrows(IllegalArgumentException.class, () -> new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList())); 59 60 } 60 61 … … 63 64 */ 64 65 @Test 65 publicvoid testChange() {66 void testChange() { 66 67 List<Node> newNodes = testData.existingWay.getNodes(); 67 68 Collections.reverse(newNodes); … … 79 80 */ 80 81 @Test 81 publicvoid testUndo() {82 void testUndo() { 82 83 List<Node> newNodes = testData.existingWay.getNodes(); 83 84 Collections.reverse(newNodes); … … 95 96 */ 96 97 @Test 97 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 98 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 99 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 110 111 */ 111 112 @Test 112 publicvoid testDescription() {113 void testDescription() { 113 114 Node node = new Node(LatLon.ZERO); 114 115 node.put("name", "xy"); … … 125 126 */ 126 127 @Test 127 publicvoid testEqualsContract() {128 void testEqualsContract() { 128 129 TestUtils.assumeWorkingEqualsVerifier(); 129 130 EqualsVerifier.forClass(ChangeNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertFalse;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.ArrayList; … … 14 14 import java.util.List; 15 15 16 import org.junit. Before;17 import org.junit. Rule;18 import org.junit. Test;16 import org.junit.jupiter.api.BeforeEach; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.TestUtils; 20 20 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 36 36 * Unit tests of {@link ChangePropertyCommand} class. 37 37 */ 38 publicclass ChangePropertyCommandTest {38 class ChangePropertyCommandTest { 39 39 40 40 /** 41 41 * We need prefs for nodes. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 49 49 * Set up the test data. 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void createTestData() { 53 53 testData = new CommandTestData(); … … 58 58 */ 59 59 @Test 60 publicvoid testShortConstructor() {60 void testShortConstructor() { 61 61 ChangePropertyCommand command = new ChangePropertyCommand(Arrays.asList(testData.existingNode), "a", "b"); 62 62 assertEquals("b", command.getTags().get("a")); … … 74 74 */ 75 75 @Test 76 publicvoid testUpdateSingleProperty() {76 void testUpdateSingleProperty() { 77 77 Node node1 = testData.createNode(14); 78 78 Node node2 = testData.createNode(15); … … 93 93 */ 94 94 @Test 95 publicvoid testRemoveProperty() {95 void testRemoveProperty() { 96 96 Node node1 = testData.createNode(14); 97 97 Node node2 = testData.createNode(15); … … 112 112 */ 113 113 @Test 114 publicvoid testUpdateMultipleProperties() {114 void testUpdateMultipleProperties() { 115 115 Node node1 = testData.createNode(14); 116 116 Node node2 = testData.createNode(15); … … 139 139 */ 140 140 @Test 141 publicvoid testUpdateIgnoresExistingProperty() {141 void testUpdateIgnoresExistingProperty() { 142 142 Node node1 = testData.createNode(14); 143 143 Node node2 = testData.createNode(15); … … 159 159 */ 160 160 @Test 161 publicvoid testFillModifiedData() {161 void testFillModifiedData() { 162 162 Node node1 = testData.createNode(14); 163 163 Node node2 = testData.createNode(15); … … 188 188 */ 189 189 @Test 190 publicvoid testDescription() {190 void testDescription() { 191 191 Node node1 = testData.createNode(14); 192 192 Node node2 = testData.createNode(15); … … 252 252 */ 253 253 @Test 254 publicvoid testChildren() {254 void testChildren() { 255 255 Node node1 = testData.createNode(15); 256 256 Node node2 = testData.createNode(16); … … 278 278 */ 279 279 @Test 280 publicvoid testEqualsContract() {280 void testEqualsContract() { 281 281 TestUtils.assumeWorkingEqualsVerifier(); 282 282 EqualsVerifier.forClass(ChangePropertyCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyKeyCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.ArrayList; … … 11 11 import java.util.Collection; 12 12 13 import org.junit. Before;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.BeforeEach; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 30 30 * Unit tests of {@link ChangePropertyKeyCommand} class. 31 31 */ 32 publicclass ChangePropertyKeyCommandTest {32 class ChangePropertyKeyCommandTest { 33 33 34 34 /** 35 35 * We need prefs for nodes. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 43 43 * Set up the test data. 44 44 */ 45 @Before 45 @BeforeEach 46 46 public void createTestData() { 47 47 testData = new CommandTestData(); … … 52 52 */ 53 53 @Test 54 publicvoid testChangeKeySingle() {54 void testChangeKeySingle() { 55 55 assertTrue(new ChangePropertyKeyCommand(testData.existingNode, "existing", "newKey").executeCommand()); 56 56 … … 64 64 */ 65 65 @Test 66 publicvoid testChangeKey() {66 void testChangeKey() { 67 67 assertTrue(new ChangePropertyKeyCommand(Arrays.asList(testData.existingNode, testData.existingWay), "existing", 68 68 "newKey").executeCommand()); … … 80 80 */ 81 81 @Test 82 publicvoid testChangeKeyIgnored() {82 void testChangeKeyIgnored() { 83 83 Node node1 = testData.createNode(15); 84 84 node1.removeAll(); … … 109 109 */ 110 110 @Test 111 publicvoid testDescription() {111 void testDescription() { 112 112 Node node1 = testData.createNode(15); 113 113 node1.put("name", "xy"); … … 123 123 */ 124 124 @Test 125 publicvoid testChildren() {125 void testChildren() { 126 126 Node node1 = testData.createNode(15); 127 127 Node node2 = testData.createNode(16); … … 149 149 */ 150 150 @Test 151 publicvoid testEqualsContract() {151 void testEqualsContract() { 152 152 TestUtils.assumeWorkingEqualsVerifier(); 153 153 EqualsVerifier.forClass(ChangePropertyKeyCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertFalse;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.ArrayList; 11 11 12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 29 29 * Unit tests of {@link ChangeRelationMemberRoleCommand} class. 30 30 */ 31 publicclass ChangeRelationMemberRoleCommandTest {31 class ChangeRelationMemberRoleCommandTest { 32 32 33 33 /** 34 34 * We need prefs for nodes. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestDataWithRelation(); … … 51 51 */ 52 52 @Test 53 publicvoid testRoleChanged() {53 void testRoleChanged() { 54 54 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").executeCommand()); 55 55 assertEquals("newRole", testData.existingRelation.getMember(0).getRole()); … … 67 67 */ 68 68 @Test 69 publicvoid testWrongIndex() {69 void testWrongIndex() { 70 70 // should be ignored 71 71 ChangeRelationMemberRoleCommand command1 = new ChangeRelationMemberRoleCommand(testData.existingRelation, -1, "newRole"); … … 85 85 */ 86 86 @Test 87 publicvoid testSameRole() {87 void testSameRole() { 88 88 // should be ignored 89 89 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "node").executeCommand()); … … 95 95 */ 96 96 @Test 97 publicvoid testUndo() {97 void testUndo() { 98 98 ChangeRelationMemberRoleCommand command = new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole"); 99 99 command.executeCommand(); … … 114 114 */ 115 115 @Test 116 publicvoid testFillModifiedData() {116 void testFillModifiedData() { 117 117 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 118 118 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 128 128 */ 129 129 @Test 130 publicvoid testDescription() {130 void testDescription() { 131 131 testData.existingRelation.put("name", "xy"); 132 132 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getDescriptionText() … … 138 138 */ 139 139 @Test 140 publicvoid testChildren() {140 void testChildren() { 141 141 assertNull(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getChildren()); 142 142 } … … 146 146 */ 147 147 @Test 148 publicvoid testEqualsContract() {148 void testEqualsContract() { 149 149 TestUtils.assumeWorkingEqualsVerifier(); 150 150 EqualsVerifier.forClass(ChangeRelationMemberRoleCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java
r13079 r17275 4 4 import java.util.Arrays; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 import org.openstreetmap.josm.data.coor.LatLon; … … 30 30 * We need prefs for nodes / data sets. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 38 38 */ 39 39 @Test 40 publicvoid testEqualsContract() {40 void testEqualsContract() { 41 41 TestUtils.assumeWorkingEqualsVerifier(); 42 42 EqualsVerifier.forClass(Command.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java
r13616 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 13 14 import java.util.NoSuchElementException; 14 15 15 import org.junit. Before;16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.BeforeEach; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 18 19 import org.openstreetmap.josm.TestUtils; 19 20 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 35 36 * Unit tests of {@link DeleteCommand} class. 36 37 */ 37 publicclass DeleteCommandTest {38 class DeleteCommandTest { 38 39 39 40 /** 40 41 * We need prefs for nodes. 41 42 */ 42 @R ule43 @RegisterExtension 43 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 45 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 48 49 * Set up the test data. 49 50 */ 50 @Before 51 @BeforeEach 51 52 public void createTestData() { 52 53 testData = new CommandTestDataWithRelation(); … … 57 58 */ 58 59 @Test 59 publicvoid testSimpleDelete() {60 void testSimpleDelete() { 60 61 Node node = testData.createNode(15); 61 62 assertTrue(testData.layer.data.allPrimitives().contains(node)); … … 72 73 */ 73 74 @Test 74 publicvoid testDeleteIgnoresReferences() {75 void testDeleteIgnoresReferences() { 75 76 assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation)); 76 77 new DeleteCommand(testData.existingRelation).executeCommand(); … … 92 93 * A delete should delete all objects with references to the deleted one 93 94 */ 94 @Test (expected = IllegalArgumentException.class)95 public void testDeleteFailsOnDelted() {95 @Test 96 void testDeleteFailsOnDeleted() { 96 97 new DeleteCommand(testData.existingRelation).executeCommand(); 97 98 98 new DeleteCommand(testData.existingRelation).executeCommand();99 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(testData.existingRelation).executeCommand()); 99 100 } 100 101 … … 103 104 */ 104 105 @Test 105 publicvoid testReferredDelete() {106 void testReferredDelete() { 106 107 DeleteCommand.deleteWithReferences(Arrays.asList(testData.existingNode), true).executeCommand(); 107 108 … … 115 116 */ 116 117 @Test 117 publicvoid testDeleteNodesInWay() {118 void testDeleteNodesInWay() { 118 119 testData.existingNode.removeAll(); 119 120 // That untagged node should be deleted. … … 152 153 * Test that {@link DeleteCommand} checks for non-null. 153 154 */ 154 @Test (expected = IllegalArgumentException.class)155 publicvoid testConsistency() {156 new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null));155 @Test 156 void testConsistency() { 157 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null))); 157 158 } 158 159 … … 160 161 * Test that {@link DeleteCommand} checks for the dataset 161 162 */ 162 @Test (expected = IllegalArgumentException.class)163 publicvoid testConsistencyDataset() {163 @Test 164 void testConsistencyDataset() { 164 165 testData.layer.getDataSet().removePrimitive(testData.existingNode); 165 new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay));166 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay))); 166 167 } 167 168 … … 169 170 * Test that {@link DeleteCommand} checks for non-empty list 170 171 */ 171 @Test (expected = NoSuchElementException.class)172 publicvoid testConsistencyNonEmpty() {173 new DeleteCommand(Arrays.<OsmPrimitive>asList());172 @Test 173 void testConsistencyNonEmpty() { 174 assertThrows(NoSuchElementException.class, () -> new DeleteCommand(Arrays.<OsmPrimitive>asList())); 174 175 } 175 176 … … 177 178 * Test that {@link DeleteCommand} checks for non-null list 178 179 */ 179 @Test (expected = NullPointerException.class)180 publicvoid testConsistencyNonNull() {181 new DeleteCommand((Collection<OsmPrimitive>) null);180 @Test 181 void testConsistencyNonNull() { 182 assertThrows(NullPointerException.class, () -> new DeleteCommand((Collection<OsmPrimitive>) null)); 182 183 } 183 184 … … 186 187 */ 187 188 @Test 188 publicvoid testUndo() {189 void testUndo() { 189 190 DeleteCommand command = new DeleteCommand( 190 191 Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay)); … … 211 212 */ 212 213 @Test 213 publicvoid testDeleteWaySegment() {214 void testDeleteWaySegment() { 214 215 Way way1 = testData.createWay(100, testData.createNode(101), testData.createNode(102)); 215 216 WaySegment ws = new WaySegment(way1, 0); … … 225 226 */ 226 227 @Test 227 publicvoid testDeleteWaySegmentEndOfWay() {228 void testDeleteWaySegmentEndOfWay() { 228 229 Way way = testData.createWay(200, testData.createNode(201), testData.createNode(202), testData.createNode(203), 229 230 testData.createNode(204)); … … 243 244 */ 244 245 @Test 245 publicvoid testDeleteWaySegmentStartOfWay() {246 void testDeleteWaySegmentStartOfWay() { 246 247 Way way = testData.createWay(100, testData.createNode(101), testData.createNode(102), testData.createNode(103), 247 248 testData.createNode(104)); … … 261 262 */ 262 263 @Test 263 publicvoid testDeleteWaySegmentSplit() {264 void testDeleteWaySegmentSplit() { 264 265 Node node103 = testData.createNode(103); 265 266 Node node104 = testData.createNode(104); … … 285 286 */ 286 287 @Test 287 publicvoid testDeleteWaySegmentCycle() {288 void testDeleteWaySegmentCycle() { 288 289 Node n = testData.createNode(101); 289 290 Way way = testData.createWay(100, n, testData.createNode(102), testData.createNode(103), … … 304 305 */ 305 306 @Test 306 publicvoid testGetChildren() {307 void testGetChildren() { 307 308 testData.existingNode.put("name", "xy"); 308 309 Collection<PseudoCommand> children = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingNode2)) … … 319 320 */ 320 321 @Test 321 publicvoid testFillModifiedData() {322 void testFillModifiedData() { 322 323 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 323 324 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 334 335 */ 335 336 @Test 336 publicvoid testGetParticipatingPrimitives() {337 void testGetParticipatingPrimitives() { 337 338 DeleteCommand command = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode)); 338 339 assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray()); … … 348 349 */ 349 350 @Test 350