Changeset 17275 in josm for trunk/test/unit
- Timestamp:
- 2020-10-28T20:41:00+01:00 (4 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 publicvoid testDescription() {351 void testDescription() { 351 352 Node node = testData.createNode(100); 352 353 node.put("name", "xy"); … … 378 379 */ 379 380 @Test 380 publicvoid testEqualsContract() {381 void testEqualsContract() { 381 382 TestUtils.assumeWorkingEqualsVerifier(); 382 383 EqualsVerifier.forClass(DeleteCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
r16968 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.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.assertTrue; 7 7 8 8 import java.util.ArrayList; … … 12 12 import java.util.Set; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 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; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 34 34 * Unit tests of {@link MoveCommand} class. 35 35 */ 36 publicclass MoveCommandTest {36 class MoveCommandTest { 37 37 /** 38 38 * We need prefs for nodes. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection(); … … 46 46 * Set up the test data. 47 47 */ 48 @Before 48 @BeforeEach 49 49 public void createTestData() { 50 50 testData = new CommandTestDataWithRelation(); … … 55 55 */ 56 56 @Test 57 publicvoid testConstructors() {57 void testConstructors() { 58 58 EastNorth offset = new EastNorth(1, 2); 59 59 LatLon destLatLon = ProjectionRegistry.getProjection().eastNorth2latlon(offset); … … 75 75 assertEquals(nodes, new ArrayList<>(Collections.<OsmPrimitive>singleton(testData.existingNode))); 76 76 77 assertEquals( "east", 1, moveCommand.getOffset().east(), 0.0001);78 assertEquals( "north", 2, moveCommand.getOffset().north(), 0.0001);79 assertEquals( "distance", 2.236068, moveCommand.getDistance(n -> true), 0.0001);77 assertEquals(1, moveCommand.getOffset().east(), 0.0001, "east"); 78 assertEquals(2, moveCommand.getOffset().north(), 0.0001, "north"); 79 assertEquals(2.236068, moveCommand.getDistance(n -> true), 0.0001, "distance"); 80 80 } 81 81 … … 84 84 */ 85 85 @Test 86 publicvoid testSingleMove() {86 void testSingleMove() { 87 87 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 88 88 testData.existingNode.setEastNorth(new EastNorth(3, 7)); 89 89 command.executeCommand(); 90 assertEquals( "east", 4, testData.existingNode.getEastNorth().east(), 0.0001);91 assertEquals( "north", 9, testData.existingNode.getEastNorth().north(), 0.0001);92 assertEquals( "distance", 2.236068, command.getDistance(n -> true), 0.0001);90 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 91 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 92 assertEquals(2.236068, command.getDistance(n -> true), 0.0001, "distance"); 93 93 } 94 94 … … 97 97 */ 98 98 @Test 99 publicvoid testMultipleMove() {99 void testMultipleMove() { 100 100 MoveCommand command = new MoveCommand( 101 101 Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay), … … 106 106 command.executeCommand(); 107 107 108 assertEquals( "east", 4, testData.existingNode.getEastNorth().east(), 0.0001);109 assertEquals( "north", 9, testData.existingNode.getEastNorth().north(), 0.0001);110 assertEquals( "east", 5, testData.existingNode2.getEastNorth().east(), 0.0001);111 assertEquals( "north", 9, testData.existingNode2.getEastNorth().north(), 0.0001);108 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 109 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 110 assertEquals(5, testData.existingNode2.getEastNorth().east(), 0.0001, "east"); 111 assertEquals(9, testData.existingNode2.getEastNorth().north(), 0.0001, "north"); 112 112 } 113 113 … … 116 116 */ 117 117 @Test 118 publicvoid testMoveAgain() {118 void testMoveAgain() { 119 119 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 120 assertEquals( "east", 1, command.getOffset().east(), 0.0001);121 assertEquals( "north", 2, command.getOffset().north(), 0.0001);120 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 121 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 122 122 123 123 command.moveAgain(1, 2); 124 assertEquals( "east", 2, command.getOffset().east(), 0.0001);125 assertEquals( "north", 4, command.getOffset().north(), 0.0001);124 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 125 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 126 126 127 127 command.moveAgain(-9, -3); 128 assertEquals( "east", -7, command.getOffset().east(), 0.0001);129 assertEquals( "north", 1, command.getOffset().north(), 0.0001);128 assertEquals(-7, command.getOffset().east(), 0.0001, "east"); 129 assertEquals(1, command.getOffset().north(), 0.0001, "north"); 130 130 131 131 command.moveAgainTo(1, 2); 132 assertEquals( "east", 1, command.getOffset().east(), 0.0001);133 assertEquals( "north", 2, command.getOffset().north(), 0.0001);132 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 133 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 134 134 } 135 135 … … 138 138 */ 139 139 @Test 140 publicvoid testCheckpoint() {140 void testCheckpoint() { 141 141 MoveCommand command = new MoveCommand(testData.existingNode, 2, 4); 142 assertEquals( "east", 2, command.getOffset().east(), 0.0001);143 assertEquals( "north", 4, command.getOffset().north(), 0.0001);142 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 143 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 144 144 145 145 command.saveCheckpoint(); 146 146 command.moveAgain(3, 7); 147 assertEquals( "east", 5, command.getOffset().east(), 0.0001);148 assertEquals( "north", 11, command.getOffset().north(), 0.0001);147 assertEquals(5, command.getOffset().east(), 0.0001, "east"); 148 assertEquals(11, command.getOffset().north(), 0.0001, "north"); 149 149 150 150 command.resetToCheckpoint(); 151 assertEquals( "east", 2, command.getOffset().east(), 0.0001);152 assertEquals( "north", 4, command.getOffset().north(), 0.0001);151 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 152 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 153 153 } 154 154 … … 157 157 */ 158 158 @Test 159 publicvoid testStartPoint() {159 void testStartPoint() { 160 160 EastNorth start = new EastNorth(10, 20); 161 161 MoveCommand command = new MoveCommand(testData.existingNode, start, start.add(1, 2)); 162 assertEquals( "east", 1, command.getOffset().east(), 0.0001);163 assertEquals( "north", 2, command.getOffset().north(), 0.0001);162 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 163 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 164 164 165 165 command.applyVectorTo(start.add(3, 4)); 166 assertEquals( "east", 3, command.getOffset().east(), 0.0001);167 assertEquals( "north", 4, command.getOffset().north(), 0.0001);166 assertEquals(3, command.getOffset().east(), 0.0001, "east"); 167 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 168 168 169 169 // set to 100, 200 170 170 command.changeStartPoint(new EastNorth(103, 204)); 171 171 command.applyVectorTo(new EastNorth(101, 202)); 172 assertEquals( "east", 1, command.getOffset().east(), 0.0001);173 assertEquals( "north", 2, command.getOffset().north(), 0.0001);172 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 173 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 174 174 } 175 175 … … 178 178 */ 179 179 @Test 180 publicvoid testNoStartPoint() {180 void testNoStartPoint() { 181 181 MoveCommand command = new MoveCommand(testData.existingNode, 1, 0); 182 182 // ignored 183 183 command.applyVectorTo(new EastNorth(3, 4)); 184 assertEquals( "east", 1, command.getOffset().east(), 0.0001);185 assertEquals( "north", 0, command.getOffset().north(), 0.0001);184 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 185 assertEquals(0, command.getOffset().north(), 0.0001, "north"); 186 186 187 187 // set to 100, 200 … … 189 189 // works 190 190 command.applyVectorTo(new EastNorth(101, 202)); 191 assertEquals( "east", 1, command.getOffset().east(), 0.0001);192 assertEquals( "north", 2, command.getOffset().north(), 0.0001);191 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 192 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 193 193 } 194 194 … … 197 197 */ 198 198 @Test 199 publicvoid testUndo() {199 void testUndo() { 200 200 testData.existingNode.setEastNorth(new EastNorth(3, 7)); 201 201 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 202 202 command.executeCommand(); 203 assertEquals( "east", 4, testData.existingNode.getEastNorth().east(), 0.0001);204 assertEquals( "north", 9, testData.existingNode.getEastNorth().north(), 0.0001);203 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 204 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 205 205 206 206 command.undoCommand(); 207 assertEquals( "east", 3, testData.existingNode.getEastNorth().east(), 0.0001);208 assertEquals( "north", 7, testData.existingNode.getEastNorth().north(), 0.0001);209 210 command.executeCommand(); 211 assertEquals( "east", 4, testData.existingNode.getEastNorth().east(), 0.0001);212 assertEquals( "north", 9, testData.existingNode.getEastNorth().north(), 0.0001);207 assertEquals(3, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 208 assertEquals(7, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 209 210 command.executeCommand(); 211 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 212 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 213 213 } 214 214 … … 217 217 */ 218 218 @Test 219 publicvoid testFillModifiedData() {219 void testFillModifiedData() { 220 220 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 221 221 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 232 232 */ 233 233 @Test 234 publicvoid testGetParticipatingPrimitives() {234 void testGetParticipatingPrimitives() { 235 235 MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2); 236 236 command.executeCommand(); … … 248 248 */ 249 249 @Test 250 publicvoid testDescription() {250 void testDescription() { 251 251 Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO)); 252 252 node.put("name", "xy"); … … 261 261 */ 262 262 @Test 263 publicvoid testEqualsContract() {263 void testEqualsContract() { 264 264 TestUtils.assumeWorkingEqualsVerifier(); 265 265 EqualsVerifier.forClass(MoveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/PurgeCommandTest.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.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertSame;9 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 10 11 11 import java.util.ArrayList; … … 13 13 import java.util.List; 14 14 15 import org.junit. Before;16 import org.junit. Rule;17 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; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 37 37 * Unit tests of {@link PurgeCommand} class. 38 38 */ 39 publicclass PurgeCommandTest {39 class PurgeCommandTest { 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(); … … 49 49 * Set up the test data. 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void createTestData() { 53 53 testData = new CommandTestDataWithRelation(); … … 58 58 */ 59 59 @Test 60 publicvoid testExecute() {60 void testExecute() { 61 61 Relation relationParent = testData.createRelation(100, new RelationMember("child", testData.existingRelation)); 62 62 Relation relationParent2 = testData.createRelation(101, new RelationMember("child", testData.existingRelation)); … … 83 83 */ 84 84 @Test 85 publicvoid testUndo() {85 void testUndo() { 86 86 PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), 87 87 Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay), … … 104 104 */ 105 105 @Test 106 publicvoid testFillModifiedData() {106 void testFillModifiedData() { 107 107 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 108 108 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 121 121 */ 122 122 @Test 123 publicvoid testGetParticipatingPrimitives() {123 void testGetParticipatingPrimitives() { 124 124 PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), Arrays.<OsmPrimitive>asList(testData.existingNode), 125 125 Arrays.<OsmPrimitive>asList(testData.existingRelation)); … … 131 131 */ 132 132 @Test 133 publicvoid testDescription() {133 void testDescription() { 134 134 List<OsmPrimitive> shortList = Arrays.<OsmPrimitive>asList(testData.existingWay); 135 135 assertTrue(new PurgeCommand(testData.layer.getDataSet(), shortList, Arrays.<OsmPrimitive>asList()).getDescriptionText() … … 145 145 */ 146 146 @Test 147 publicvoid testEqualsContract() {147 void testEqualsContract() { 148 148 TestUtils.assumeWorkingEqualsVerifier(); 149 149 EqualsVerifier.forClass(PurgeCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/RemoveNodesCommandTest.java
r15013 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.ArrayList; 9 9 import java.util.Collections; 10 10 11 import org.junit. Before;12 import org.junit. Rule;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 28 * Unit tests of {@link RemoveNodesCommand} class. 29 29 */ 30 publicclass RemoveNodesCommandTest {30 class RemoveNodesCommandTest { 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(); … … 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 testExecute() {52 void testExecute() { 53 53 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 54 54 Collections.singleton(testData.existingNode)); … … 65 65 */ 66 66 @Test 67 publicvoid testUndo() {67 void testUndo() { 68 68 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 69 69 Collections.singleton(testData.existingNode)); … … 87 87 */ 88 88 @Test 89 publicvoid testFillModifiedData() {89 void testFillModifiedData() { 90 90 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 91 91 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 103 103 */ 104 104 @Test 105 publicvoid testGetParticipatingPrimitives() {105 void testGetParticipatingPrimitives() { 106 106 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 107 107 Collections.singleton(testData.existingNode)); … … 114 114 */ 115 115 @Test 116 publicvoid testDescription() {116 void testDescription() { 117 117 assertTrue(new RemoveNodesCommand(testData.existingWay, Collections.singleton(testData.existingNode)) 118 118 .getDescriptionText().matches("Removed nodes from .*")); … … 123 123 */ 124 124 @Test 125 publicvoid testEqualsContract() {125 void testEqualsContract() { 126 126 TestUtils.assumeWorkingEqualsVerifier(); 127 127 EqualsVerifier.forClass(RemoveNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.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;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.util.ArrayList; 8 8 import java.util.Arrays; 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.CommandTestData; … … 29 29 * Unit tests of {@link RotateCommand} class. 30 30 */ 31 publicclass RotateCommandTest {31 class RotateCommandTest { 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().projection(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestData(); … … 51 51 */ 52 52 @Test 53 publicvoid testRotate() {53 void testRotate() { 54 54 // pivot needs to be at 0,0 55 55 Node n1 = new Node(new EastNorth(10, 10)); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node n1 = new Node(new EastNorth(10, 10)); 75 75 Node n2 = new Node(new EastNorth(-1, 0)); … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 100 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 113 113 */ 114 114 @Test 115 publicvoid testGetParticipatingPrimitives() {115 void testGetParticipatingPrimitives() { 116 116 RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); 117 117 command.executeCommand(); … … 123 123 */ 124 124 @Test 125 publicvoid testDescription() {125 void testDescription() { 126 126 assertEquals("Rotate 1 node", 127 127 new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) … … 136 136 */ 137 137 @Test 138 publicvoid testEqualsContract() {138 void testEqualsContract() { 139 139 TestUtils.assumeWorkingEqualsVerifier(); 140 140 EqualsVerifier.forClass(RotateCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.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;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.util.ArrayList; 8 8 import java.util.Arrays; 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.CommandTestData; … … 29 29 * Unit tests of {@link ScaleCommand} class. 30 30 */ 31 publicclass ScaleCommandTest {31 class ScaleCommandTest { 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().projection(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestData(); … … 51 51 */ 52 52 @Test 53 publicvoid testScale() {53 void testScale() { 54 54 // pivot needs to be at 0,0 55 55 Node n1 = new Node(new EastNorth(10, 10)); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node n1 = new Node(new EastNorth(10, 10)); 75 75 Node n2 = new Node(new EastNorth(-1, 0)); … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 100 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 113 113 */ 114 114 @Test 115 publicvoid testGetParticipatingPrimitives() {115 void testGetParticipatingPrimitives() { 116 116 ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); 117 117 command.executeCommand(); … … 123 123 */ 124 124 @Test 125 publicvoid testDescription() {125 void testDescription() { 126 126 assertEquals("Scale 1 node", 127 127 new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) … … 136 136 */ 137 137 @Test 138 publicvoid testEqualsContract() {138 void testEqualsContract() { 139 139 TestUtils.assumeWorkingEqualsVerifier(); 140 140 EqualsVerifier.forClass(ScaleCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java
r15324 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.ArrayList; … … 10 11 import java.util.List; 11 12 12 import org.junit. Before;13 import org.junit. Rule;14 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; 15 16 import org.openstreetmap.josm.TestUtils; 16 17 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 29 * Unit tests of {@link SelectCommand} class. 29 30 */ 30 publicclass SelectCommandTest {31 class SelectCommandTest { 31 32 32 33 /** 33 34 * We need prefs for nodes. 34 35 */ 35 @R ule36 @RegisterExtension 36 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 38 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 41 42 * Set up the test data. 42 43 */ 43 @Before 44 @BeforeEach 44 45 public void createTestData() { 45 46 testData = new CommandTestDataWithRelation(); … … 50 51 */ 51 52 @Test 52 publicvoid testExecute() {53 void testExecute() { 53 54 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay)); 54 55 … … 66 67 */ 67 68 @Test 68 publicvoid testExecuteAfterModify() {69 void testExecuteAfterModify() { 69 70 List<OsmPrimitive> list = new ArrayList<>(Arrays.asList(testData.existingNode, testData.existingWay)); 70 71 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), list); … … 84 85 */ 85 86 @Test 86 publicvoid testUndo() {87 void testUndo() { 87 88 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay)); 88 89 testData.layer.getDataSet().setSelected(Arrays.asList(testData.existingNode2)); … … 107 108 */ 108 109 @Test 109 publicvoid testFillModifiedData() {110 void testFillModifiedData() { 110 111 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 111 112 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 123 124 */ 124 125 @Test 125 publicvoid testGetParticipatingPrimitives() {126 void testGetParticipatingPrimitives() { 126 127 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode)); 127 128 command.executeCommand(); … … 133 134 */ 134 135 @Test 135 publicvoid testDescription() {136 void testDescription() { 136 137 DataSet ds = testData.layer.getDataSet(); 137 138 assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)) … … 149 150 */ 150 151 @Test 151 publicvoid testEqualsContract() {152 void testEqualsContract() { 152 153 TestUtils.assumeWorkingEqualsVerifier(); 153 154 EqualsVerifier.forClass(SelectCommand.class).usingGetClass() … … 165 166 * Unit test of {@link SelectCommand#SelectCommand}. 166 167 */ 167 @Test (expected = IllegalArgumentException.class)168 publicvoid testConstructorIAE() {169 new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}));168 @Test 169 void testConstructorIAE() { 170 assertThrows(IllegalArgumentException.class, () -> new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}))); 170 171 } 171 172 } -
trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
r17087 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.assertNotSame; 8 import static org.junit.Assert.assertNull; 9 import static org.junit.Assert.assertSame; 10 import static org.junit.Assert.assertTrue; 11 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.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNotSame; 8 import static org.junit.jupiter.api.Assertions.assertNull; 9 import static org.junit.jupiter.api.Assertions.assertSame; 12 10 import static org.junit.jupiter.api.Assertions.assertThrows; 11 import static org.junit.jupiter.api.Assertions.assertTrue; 12 import static org.junit.jupiter.api.Assertions.fail; 13 13 14 14 import java.io.PrintWriter; … … 19 19 import java.util.Collections; 20 20 21 import org.junit. Before;22 import org.junit. Rule;23 import org.junit. Test;21 import org.junit.jupiter.api.BeforeEach; 22 import org.junit.jupiter.api.Test; 23 import org.junit.jupiter.api.extension.RegisterExtension; 24 24 import org.openstreetmap.josm.TestUtils; 25 25 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 39 39 * Unit tests of {@link SequenceCommand} class. 40 40 */ 41 publicclass SequenceCommandTest {41 class SequenceCommandTest { 42 42 43 43 /** 44 44 * We need prefs for nodes. 45 45 */ 46 @R ule46 @RegisterExtension 47 47 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 48 48 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 52 52 * Set up the test data. 53 53 */ 54 @Before 54 @BeforeEach 55 55 public void createTestData() { 56 56 testData = new CommandTestDataWithRelation(); … … 61 61 */ 62 62 @Test 63 publicvoid testExecute() {63 void testExecute() { 64 64 DataSet ds = new DataSet(); 65 65 final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 83 83 */ 84 84 @Test 85 publicvoid testUndo() {85 void testUndo() { 86 86 DataSet ds = new DataSet(); 87 87 final TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2)); … … 112 112 */ 113 113 @Test 114 publicvoid testExecuteRollback() {114 void testExecuteRollback() { 115 115 DataSet ds = new DataSet(); 116 116 TestCommand command1 = new TestCommand(ds, null); … … 129 129 */ 130 130 @Test 131 publicvoid testContinueOnErrors() {131 void testContinueOnErrors() { 132 132 DataSet ds = new DataSet(); 133 133 TestCommand command1 = new TestCommand(ds, null); … … 148 148 */ 149 149 @Test 150 publicvoid testGetLastCommand() {150 void testGetLastCommand() { 151 151 DataSet ds = new DataSet(); 152 152 final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 161 161 */ 162 162 @Test 163 publicvoid testFillModifiedData() {163 void testFillModifiedData() { 164 164 DataSet ds = new DataSet(); 165 165 Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 194 194 */ 195 195 @Test 196 publicvoid testGetParticipatingPrimitives() {196 void testGetParticipatingPrimitives() { 197 197 DataSet ds = new DataSet(); 198 198 Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 211 211 */ 212 212 @Test 213 publicvoid testDescription() {213 void testDescription() { 214 214 assertTrue(new SequenceCommand(new DataSet(), "test", Collections.emptyList(), false).getDescriptionText().matches("Sequence: test")); 215 215 } … … 219 219 */ 220 220 @Test 221 publicvoid testEqualsContract() {221 void testEqualsContract() { 222 222 DataSet ds = new DataSet(); 223 223 TestUtils.assumeWorkingEqualsVerifier(); … … 263 263 @Override 264 264 public boolean executeCommand() { 265 assertFalse( "Cannot execute twice", executed);265 assertFalse(executed, "Cannot execute twice"); 266 266 executed = true; 267 267 return true; … … 270 270 @Override 271 271 public void undoCommand() { 272 assertTrue( "Cannot undo without execute", executed);272 assertTrue(executed, "Cannot undo without execute"); 273 273 executed = false; 274 274 } … … 295 295 @Override 296 296 public void undoCommand() { 297 assertTrue( "Cannot undo without execute", executed);297 assertTrue(executed, "Cannot undo without execute"); 298 298 executed = false; 299 299 } … … 309 309 */ 310 310 @Test 311 publicvoid testWrapIfNeeded() {311 void testWrapIfNeeded() { 312 312 DataSet ds = new DataSet(); 313 313 TestCommand command1 = new TestCommand(ds, Collections.<OsmPrimitive>singletonList(testData.existingNode)); … … 322 322 */ 323 323 @Test 324 publicvoid testCreateReportedException() {324 void testCreateReportedException() { 325 325 DataSet ds = new DataSet(); 326 326 Command c1 = new TestCommand(ds, Collections.emptyList()) { -
trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java
r16782 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.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.io.IOException; … … 14 14 import java.util.Optional; 15 15 16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.command.SplitWayCommand.Strategy; … … 36 36 * Unit tests for class {@link SplitWayCommand}. 37 37 */ 38 publicfinal class SplitWayCommandTest {38 final class SplitWayCommandTest { 39 39 40 40 /** 41 41 * Setup test. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); … … 49 49 */ 50 50 @Test 51 publicvoid testFindVias() {51 void testFindVias() { 52 52 // empty relation 53 53 assertTrue(SplitWayCommand.findVias(new Relation(), null).isEmpty()); … … 81 81 */ 82 82 @Test 83 publicvoid testRouteRelation() {83 void testRouteRelation() { 84 84 doTestRouteRelation(false, 0); 85 85 doTestRouteRelation(false, 1); … … 149 149 150 150 @Test 151 publicvoid testOneMemberOrderedRelationShowsWarningTest() {151 void testOneMemberOrderedRelationShowsWarningTest() { 152 152 final DataSet dataSet = new DataSet(); 153 153 … … 188 188 189 189 @Test 190 publicvoid testDoIncompleteMembersOrderedRelationCorrectOrderTest() {190 void testDoIncompleteMembersOrderedRelationCorrectOrderTest() { 191 191 for (int i = 0; i < 2; i++) { 192 192 // All these permutations should result in a split that keeps the new parts in order. … … 244 244 245 245 static void assertFirstLastNodeIs(Way way, Node node) { 246 assertTrue("First/last node of " + way + " should be " + node, node.equals(way.firstNode()) || node.equals(way.lastNode())); 246 assertTrue(node.equals(way.firstNode()) || node.equals(way.lastNode()), 247 "First/last node of " + way + " should be " + node); 247 248 } 248 249 … … 253 254 Node last2 = two.lastNode(); 254 255 255 assertTrue( "Ways expected to be connected at their ends.",256 first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2);256 assertTrue(first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2, 257 "Ways expected to be connected at their ends."); 257 258 } 258 259 … … 263 264 */ 264 265 @Test 265 publicvoid testTicket18596() throws IOException, IllegalDataException {266 void testTicket18596() throws IOException, IllegalDataException { 266 267 try (InputStream is = TestUtils.getRegressionDataStream(18596, "data.osm")) { 267 268 DataSet ds = OsmReader.parseDataSet(is, null); … … 280 281 Relation relation = (Relation) ds.getPrimitiveById(8888, OsmPrimitiveType.RELATION); 281 282 282 assertEquals( relation.getMembersCount(), 8);283 assertEquals(8, relation.getMembersCount()); 283 284 284 285 // Before the patch introduced in #18596, these asserts would fail. The two parts of … … 299 300 */ 300 301 @Test 301 publicvoid testTicket17400() throws IOException, IllegalDataException {302 void testTicket17400() throws IOException, IllegalDataException { 302 303 try (InputStream is = TestUtils.getRegressionDataStream(17400, "data.osm")) { 303 304 DataSet ds = OsmReader.parseDataSet(is, null); … … 323 324 324 325 // One more than the original 161. 325 assertEquals( relation.getMembersCount(), 162);326 assertEquals(162, relation.getMembersCount()); 326 327 327 328 // Before the patch introduced in #18596, these asserts would fail. The new parts of … … 347 348 */ 348 349 @Test 349 publicvoid testTicket18863() throws IOException, IllegalDataException {350 void testTicket18863() throws IOException, IllegalDataException { 350 351 try (InputStream is = TestUtils.getRegressionDataStream(18863, "data.osm.bz2")) { 351 352 DataSet ds = OsmReader.parseDataSet(is, null); … … 375 376 */ 376 377 @Test 377 publicvoid testTicket19432() throws IOException, IllegalDataException {378 void testTicket19432() throws IOException, IllegalDataException { 378 379 try (InputStream is = TestUtils.getRegressionDataStream(19432, "josm_split_way_exception_example.osm.bz2")) { 379 380 DataSet ds = OsmReader.parseDataSet(is, null); -
trunk/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 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; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 18 18 * Unit tests of {@link TransformNodesCommand} class. 19 19 */ 20 publicclass TransformNodesCommandTest {20 class TransformNodesCommandTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 31 31 */ 32 32 @Test 33 publicvoid testEqualsContract() {33 void testEqualsContract() { 34 34 TestUtils.assumeWorkingEqualsVerifier(); 35 35 EqualsVerifier.forClass(TransformNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 26 26 * Unit tests of {@link ConflictAddCommand} class. 27 27 */ 28 publicclass ConflictAddCommandTest {28 class ConflictAddCommandTest { 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 test = new JOSMTestRules(); … … 39 39 * Setup test. 40 40 */ 41 @Before 41 @BeforeEach 42 42 public void setUp() { 43 43 testData = new CommandTestData(); … … 48 48 */ 49 49 @Test 50 publicvoid testExecuteUndoCommand() {50 void testExecuteUndoCommand() { 51 51 DataSet ds = testData.layer.getDataSet(); 52 52 Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2); … … 64 64 */ 65 65 @Test 66 publicvoid testGetDescriptionIcon() {66 void testGetDescriptionIcon() { 67 67 Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2); 68 68 assertNotNull(new ConflictAddCommand(testData.layer.getDataSet(), conflict).getDescriptionIcon()); … … 73 73 */ 74 74 @Test 75 publicvoid testEqualsContract() {75 void testEqualsContract() { 76 76 TestUtils.assumeWorkingEqualsVerifier(); 77 77 EqualsVerifier.forClass(ConflictAddCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 19 19 * Unit tests of {@link ConflictResolveCommand} class. 20 20 */ 21 publicclass ConflictResolveCommandTest {21 class ConflictResolveCommandTest { 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 testEqualsContract() {34 void testEqualsContract() { 35 35 TestUtils.assumeWorkingEqualsVerifier(); 36 36 EqualsVerifier.forClass(ConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 28 28 * Unit tests of {@link CoordinateConflictResolveCommand} class. 29 29 */ 30 publicclass CoordinateConflictResolveCommandTest {30 class CoordinateConflictResolveCommandTest { 31 31 32 32 private CommandTestData testData; … … 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules(); … … 42 42 * Setup test. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void setUp() { 46 46 testData = new CommandTestData(); … … 55 55 */ 56 56 @Test 57 publicvoid testExecuteKeepMineUndoCommand() {57 void testExecuteKeepMineUndoCommand() { 58 58 Conflict<Node> conflict = createConflict(); 59 59 CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_MINE); … … 68 68 */ 69 69 @Test 70 publicvoid testExecuteKeepTheirUndoCommand() {70 void testExecuteKeepTheirUndoCommand() { 71 71 Conflict<Node> conflict = createConflict(); 72 72 CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_THEIR); … … 81 81 */ 82 82 @Test 83 publicvoid testGetDescriptionIcon() {83 void testGetDescriptionIcon() { 84 84 Conflict<Node> conflict = createConflict(); 85 85 assertNotNull(new CoordinateConflictResolveCommand(conflict, null).getDescriptionIcon()); … … 90 90 */ 91 91 @Test 92 publicvoid testEqualsContract() {92 void testEqualsContract() { 93 93 TestUtils.assumeWorkingEqualsVerifier(); 94 94 EqualsVerifier.forClass(CoordinateConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link DeletedStateConflictResolveCommand} class. 21 21 */ 22 publicclass DeletedStateConflictResolveCommandTest {22 class DeletedStateConflictResolveCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(DeletedStateConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link ModifiedConflictResolveCommand} class. 21 21 */ 22 publicclass ModifiedConflictResolveCommandTest {22 class ModifiedConflictResolveCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(ModifiedConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link RelationMemberConflictResolverCommand} class. 21 21 */ 22 publicclass RelationMemberConflictResolverCommandTest {22 class RelationMemberConflictResolverCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(RelationMemberConflictResolverCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link TagConflictResolveCommand} class. 21 21 */ 22 publicclass TagConflictResolveCommandTest {22 class TagConflictResolveCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(TagConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link VersionConflictResolveCommand} class. 21 21 */ 22 publicclass VersionConflictResolveCommandTest {22 class VersionConflictResolveCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(VersionConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 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; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link WayNodesConflictResolverCommand} class. 21 21 */ 22 publicclass WayNodesConflictResolverCommandTest {22 class WayNodesConflictResolverCommandTest { 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 testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(WayNodesConflictResolverCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java
r13020 r17275 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;7 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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.util.List; 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.data.conflict.ConflictCollection; 14 14 import org.openstreetmap.josm.data.osm.CyclicUploadDependencyException; … … 26 26 * Unit tests for class {@link APIDataSet}. 27 27 */ 28 publicclass APIDataSetTest {28 class APIDataSetTest { 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 test = new JOSMTestRules(); 36 36 37 37 @Test 38 publicvoid testOneNewRelationOnly() throws CyclicUploadDependencyException {38 void testOneNewRelationOnly() throws CyclicUploadDependencyException { 39 39 Relation r = new Relation(); 40 40 r.put("name", "r1"); … … 52 52 53 53 @Test 54 publicvoid testNewParentChildPair() throws CyclicUploadDependencyException {54 void testNewParentChildPair() throws CyclicUploadDependencyException { 55 55 DataSet ds = new DataSet(); 56 56 Relation r1 = new Relation(); … … 75 75 76 76 @Test 77 publicvoid testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException {77 void testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException { 78 78 DataSet ds = new DataSet(); 79 79 … … 121 121 122 122 @Test 123 publicvoid testOneParentTwoNewChildren() throws CyclicUploadDependencyException {123 void testOneParentTwoNewChildren() throws CyclicUploadDependencyException { 124 124 DataSet ds = new DataSet(); 125 125 Relation r1 = new Relation(); … … 150 150 151 151 @Test // for ticket #9624 152 publicvoid testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException {152 void testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException { 153 153 DataSet ds = new DataSet(); 154 154 Relation r1 = new Relation(1); … … 193 193 194 194 @Test // for ticket #9656 195 publicvoid testDeleteWay() throws CyclicUploadDependencyException {195 void testDeleteWay() throws CyclicUploadDependencyException { 196 196 DataSet ds = new DataSet(); 197 197 final Way way = new Way(1, 2); … … 230 230 231 231 @Test 232 publicvoid testOneCycle() {232 void testOneCycle() { 233 233 DataSet ds = new DataSet(); 234 234 Relation r1 = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java
r10910 r17275 2 2 package org.openstreetmap.josm.data; 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.awt.geom.Rectangle2D; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 12 … … 14 14 * Unit tests for class {@link Bounds}. 15 15 */ 16 publicclass BoundsTest {16 class BoundsTest { 17 17 18 18 @Test 19 publicvoid testCrossing() {19 void testCrossing() { 20 20 Bounds b1 = new Bounds(0, 170, 50, -170); 21 21 assertTrue(b1.crosses180thMeridian()); … … 70 70 */ 71 71 @Test 72 publicvoid testConstructorNominalCases() {72 void testConstructorNominalCases() { 73 73 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d))); 74 74 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d), true)); … … 85 85 */ 86 86 @Test 87 publicvoid testConstructorSinglePointCases() {87 void testConstructorSinglePointCases() { 88 88 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d))); 89 89 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d), true)); -
trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java
r17120 r17275 2 2 package org.openstreetmap.josm.data; 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.io.File; … … 12 12 import java.util.List; 13 13 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.ImageData.ImageDataUpdateListener; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 26 26 * Unit tests for class {@link ImageData}. 27 27 */ 28 publicclass ImageDataTest {28 class ImageDataTest { 29 29 30 30 private static List<ImageEntry> getOneImage() { … … 35 35 36 36 @Test 37 publicvoid testWithNullData() {37 void testWithNullData() { 38 38 ImageData data = new ImageData(); 39 39 assertEquals(0, data.getImages().size()); … … 53 53 54 54 @Test 55 publicvoid testImageEntryWithImages() {55 void testImageEntryWithImages() { 56 56 assertEquals(1, new ImageData(getOneImage()).getImages().size()); 57 57 } 58 58 59 59 @Test 60 publicvoid testSortData(@Mocked Collections ignore) {60 void testSortData(@Mocked Collections ignore) { 61 61 List<ImageEntry> list = getOneImage(); 62 62 … … 69 69 70 70 @Test 71 publicvoid testIsModifiedFalse() {71 void testIsModifiedFalse() { 72 72 assertFalse(new ImageData(getOneImage()).isModified()); 73 73 } 74 74 75 75 @Test 76 publicvoid testIsModifiedTrue() {76 void testIsModifiedTrue() { 77 77 List<ImageEntry> list = getOneImage(); 78 78 … … 85 85 86 86 @Test 87 publicvoid testSelectFirstImage() {88 List<ImageEntry> list = getOneImage(); 89 90 ImageData data = new ImageData(list); 91 data.selectFirstImage(); 92 assertEquals(1, data.getSelectedImages().size()); 93 assertEquals(list.get(0), data.getSelectedImages().get(0)); 94 } 95 96 @Test 97 publicvoid testSelectLastImage() {87 void testSelectFirstImage() { 88 List<ImageEntry> list = getOneImage(); 89 90 ImageData data = new ImageData(list); 91 data.selectFirstImage(); 92 assertEquals(1, data.getSelectedImages().size()); 93 assertEquals(list.get(0), data.getSelectedImages().get(0)); 94 } 95 96 @Test 97 void testSelectLastImage() { 98 98 List<ImageEntry> list = getOneImage(); 99 99 list.add(new ImageEntry()); … … 106 106 107 107 @Test 108 publicvoid testSelectNextImage() {108 void testSelectNextImage() { 109 109 List<ImageEntry> list = getOneImage(); 110 110 … … 120 120 121 121 @Test 122 publicvoid testSelectPreviousImage() {122 void testSelectPreviousImage() { 123 123 List<ImageEntry> list = getOneImage(); 124 124 list.add(new ImageEntry()); … … 136 136 137 137 @Test 138 publicvoid testSetSelectedImage() {138 void testSetSelectedImage() { 139 139 List<ImageEntry> list = getOneImage(); 140 140 … … 146 146 147 147 @Test 148 publicvoid testClearSelectedImages() {148 void testClearSelectedImages() { 149 149 List<ImageEntry> list = getOneImage(); 150 150 … … 156 156 157 157 @Test 158 publicvoid testSelectionListener() {158 void testSelectionListener() { 159 159 List<ImageEntry> list = getOneImage(); 160 160 ImageData data = new ImageData(list); … … 175 175 176 176 @Test 177 publicvoid testRemoveSelectedImage() {177 void testRemoveSelectedImage() { 178 178 List<ImageEntry> list = getOneImage(); 179 179 ImageData data = new ImageData(list); … … 185 185 186 186 @Test 187 publicvoid testRemoveSelectedImages() {187 void testRemoveSelectedImages() { 188 188 List<ImageEntry> list = getOneImage(); 189 189 list.add(new ImageEntry()); … … 198 198 199 199 @Test 200 publicvoid testRemoveSelectedImagesWithRemainingImages() {200 void testRemoveSelectedImagesWithRemainingImages() { 201 201 List<ImageEntry> list = getOneImage(); 202 202 list.add(new ImageEntry()); … … 212 212 213 213 @Test 214 publicvoid testSelectImageAfterRemove() {214 void testSelectImageAfterRemove() { 215 215 List<ImageEntry> list = getOneImage(); 216 216 list.add(new ImageEntry()); … … 225 225 226 226 @Test 227 publicvoid testSelectImageAfterRemoveWhenTheLastIsSelected() {227 void testSelectImageAfterRemoveWhenTheLastIsSelected() { 228 228 List<ImageEntry> list = getOneImage(); 229 229 list.add(new ImageEntry()); … … 238 238 239 239 @Test 240 publicvoid testRemoveSelectedImageTriggerListener() {240 void testRemoveSelectedImageTriggerListener() { 241 241 List<ImageEntry> list = getOneImage(); 242 242 list.add(new ImageEntry()); … … 258 258 259 259 @Test 260 publicvoid testRemoveSelectedImagesTriggerListener() {260 void testRemoveSelectedImagesTriggerListener() { 261 261 List<ImageEntry> list = getOneImage(); 262 262 list.add(new ImageEntry()); … … 278 278 279 279 @Test 280 publicvoid testRemoveImageAndTriggerListener() {280 void testRemoveImageAndTriggerListener() { 281 281 List<ImageEntry> list = getOneImage(); 282 282 ImageData data = new ImageData(list); … … 297 297 298 298 @Test 299 publicvoid testMergeFrom() {299 void testMergeFrom() { 300 300 ImageEntry image = new ImageEntry(new File("test2")); 301 301 List<ImageEntry> list1 = getOneImage(); … … 323 323 324 324 @Test 325 publicvoid testMergeFromSelectedImage() {325 void testMergeFromSelectedImage() { 326 326 ImageEntry image = new ImageEntry(new File("test2")); 327 327 List<ImageEntry> list1 = getOneImage(); … … 340 340 341 341 @Test 342 publicvoid testAddImageToSelection() {342 void testAddImageToSelection() { 343 343 List<ImageEntry> list = getOneImage(); 344 344 list.add(new ImageEntry(new File("test2"))); … … 353 353 354 354 @Test 355 publicvoid testRemoveImageToSelection() {355 void testRemoveImageToSelection() { 356 356 List<ImageEntry> list = getOneImage(); 357 357 list.add(new ImageEntry()); … … 366 366 367 367 @Test 368 publicvoid testIsSelected() {368 void testIsSelected() { 369 369 List<ImageEntry> list = getOneImage(); 370 370 list.add(new ImageEntry(new File("test2"))); … … 381 381 382 382 @Test 383 publicvoid testActionsWithMultipleImagesSelected() {383 void testActionsWithMultipleImagesSelected() { 384 384 List<ImageEntry> list = getOneImage(); 385 385 list.add(new ImageEntry(new File("test2"))); … … 402 402 403 403 @Test 404 publicvoid testTriggerListenerWhenNewImageIsSelectedAndRemoved() {404 void testTriggerListenerWhenNewImageIsSelectedAndRemoved() { 405 405 List<ImageEntry> list = getOneImage(); 406 406 list.add(new ImageEntry()); … … 423 423 424 424 @Test 425 publicvoid testUpdatePosition() {425 void testUpdatePosition() { 426 426 List<ImageEntry> list = getOneImage(); 427 427 ImageData data = new ImageData(list); … … 435 435 436 436 @Test 437 publicvoid testUpdateDirection() {437 void testUpdateDirection() { 438 438 List<ImageEntry> list = getOneImage(); 439 439 ImageData data = new ImageData(list); … … 447 447 448 448 @Test 449 publicvoid testTriggerListenerOnUpdate() {449 void testTriggerListenerOnUpdate() { 450 450 List<ImageEntry> list = getOneImage(); 451 451 ImageData data = new ImageData(list); … … 467 467 468 468 @Test 469 publicvoid testManuallyTriggerUpdateListener() {469 void testManuallyTriggerUpdateListener() { 470 470 List<ImageEntry> list = getOneImage(); 471 471 ImageData data = new ImageData(list); -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
r14149 r17275 2 2 package org.openstreetmap.josm.data; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link Preferences}. 14 14 */ 15 publicclass PreferencesTest {15 class PreferencesTest { 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().preferences().fakeAPI(); … … 26 26 */ 27 27 @Test 28 publicvoid testToXml() {28 void testToXml() { 29 29 assertEquals(String.format( 30 30 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n" + -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesUtilsTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Before;7 import org.junit. Rule;8 import org.junit. Test;6 import org.junit.jupiter.api.BeforeEach; 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 10 … … 15 15 * Unit tests for class {@link PreferencesUtils}. 16 16 */ 17 publicclass PreferencesUtilsTest {17 class PreferencesUtilsTest { 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 test = new JOSMTestRules().preferences(); … … 27 27 * Setup test. 28 28 */ 29 @Before 29 @BeforeEach 30 30 public void setUp() { 31 31 PreferencesUtils.resetLog(); … … 36 36 */ 37 37 @Test 38 publicvoid testLog() {38 void testLog() { 39 39 assertEquals("", PreferencesUtils.getLog()); 40 40 PreferencesUtils.log("test"); … … 51 51 */ 52 52 @Test 53 publicvoid testUtilityClass() throws ReflectiveOperationException {53 void testUtilityClass() throws ReflectiveOperationException { 54 54 UtilityClassTestUtil.assertUtilityClassWellDefined(PreferencesUtils.class); 55 55 } -
trunk/test/unit/org/openstreetmap/josm/data/ProjectionBoundsTest.java
r10300 r17275 2 2 package org.openstreetmap.josm.data; 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 8 8 /** 9 9 * Unit tests for class {@link ProjectionBounds}. 10 10 */ 11 publicclass ProjectionBoundsTest {11 class ProjectionBoundsTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testToString() {17 void testToString() { 18 18 assertEquals("ProjectionBounds[1.0,2.0,3.0,4.0]", new ProjectionBounds(1, 2, 3, 4).toString()); 19 19 } -
trunk/test/unit/org/openstreetmap/josm/data/UserIdentityManagerTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.data; 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.assertNull; 8 import static org.junit.Assert.assertSame; 9 import static org.junit.Assert.assertTrue; 10 11 import org.junit.Rule; 12 import org.junit.Test; 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 import static org.junit.jupiter.api.Assertions.assertThrows; 11 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 13 14 import org.openstreetmap.josm.data.osm.User; 14 15 import org.openstreetmap.josm.data.osm.UserInfo; … … 21 22 * Unit tests of {@link UserIdentityManager} class. 22 23 */ 23 publicclass UserIdentityManagerTest {24 class UserIdentityManagerTest { 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().preferences(); … … 45 46 */ 46 47 @Test 47 publicvoid testSingletonAccess() {48 void testSingletonAccess() { 48 49 49 50 UserIdentityManager im = UserIdentityManager.getInstance(); … … 62 63 */ 63 64 @Test 64 publicvoid testSetAnonymous() {65 void testSetAnonymous() { 65 66 UserIdentityManager im = UserIdentityManager.getInstance(); 66 67 … … 82 83 */ 83 84 @Test 84 publicvoid testSetPartiallyIdentified() {85 void testSetPartiallyIdentified() { 85 86 UserIdentityManager im = UserIdentityManager.getInstance(); 86 87 im.setPartiallyIdentified("test"); … … 101 102 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - null case. 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 @Test 104 105 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 105 publicvoid testSetPartiallyIdentifiedNull() {106 UserIdentityManager.getInstance().setPartiallyIdentified(null);106 void testSetPartiallyIdentifiedNull() { 107 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(null)); 107 108 } 108 109 … … 110 111 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - empty case. 111 112 */ 112 @Test (expected = IllegalArgumentException.class)113 publicvoid testSetPartiallyIdentifiedEmpty() {114 UserIdentityManager.getInstance().setPartiallyIdentified("");113 @Test 114 void testSetPartiallyIdentifiedEmpty() { 115 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified("")); 115 116 } 116 117 … … 118 119 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - blank case. 119 120 */ 120 @Test (expected = IllegalArgumentException.class)121 publicvoid testSetPartiallyIdentifiedBlank() {122 UserIdentityManager.getInstance().setPartiallyIdentified(" \t ");121 @Test 122 void testSetPartiallyIdentifiedBlank() { 123 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(" \t ")); 123 124 } 124 125 … … 127 128 */ 128 129 @Test 129 publicvoid testSetFullyIdentified() {130 void testSetFullyIdentified() { 130 131 UserIdentityManager im = UserIdentityManager.getInstance(); 131 132 … … 149 150 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null name case. 150 151 */ 151 @Test (expected = IllegalArgumentException.class)152 @Test 152 153 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 153 publicvoid testSetFullyIdentifiedNullName() {154 UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo());154 void testSetFullyIdentifiedNullName() { 155 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo())); 155 156 } 156 157 … … 158 159 * Unit test of {@link UserIdentityManager#setFullyIdentified} - empty name case. 159 160 */ 160 @Test (expected = IllegalArgumentException.class)161 publicvoid testSetFullyIdentifiedEmptyName() {162 UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo());161 @Test 162 void testSetFullyIdentifiedEmptyName() { 163 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo())); 163 164 } 164 165 … … 166 167 * Unit test of {@link UserIdentityManager#setFullyIdentified} - blank name case. 167 168 */ 168 @Test (expected = IllegalArgumentException.class)169 publicvoid testSetFullyIdentifiedBlankName() {170 UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo());169 @Test 170 void testSetFullyIdentifiedBlankName() { 171 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo())); 171 172 } 172 173 … … 174 175 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null info case. 175 176 */ 176 @Test (expected = IllegalArgumentException.class)177 publicvoid testSetFullyIdentifiedNullInfo() {178 UserIdentityManager.getInstance().setFullyIdentified("test", null);177 @Test 178 void testSetFullyIdentifiedNullInfo() { 179 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("test", null)); 179 180 } 180 181 … … 183 184 */ 184 185 @Test 185 publicvoid testInitFromPreferences1() {186 void testInitFromPreferences1() { 186 187 UserIdentityManager im = UserIdentityManager.getInstance(); 187 188 … … 208 209 */ 209 210 @Test 210 publicvoid testInitFromPreferences2() {211 void testInitFromPreferences2() { 211 212 UserIdentityManager im = UserIdentityManager.getInstance(); 212 213 … … 233 234 */ 234 235 @Test 235 publicvoid testInitFromPreferences3() {236 void testInitFromPreferences3() { 236 237 UserIdentityManager im = UserIdentityManager.getInstance(); 237 238 … … 260 261 */ 261 262 @Test 262 publicvoid testInitFromPreferences4() {263 void testInitFromPreferences4() { 263 264 UserIdentityManager im = UserIdentityManager.getInstance(); 264 265 … … 286 287 */ 287 288 @Test 288 publicvoid testInitFromPreferences5() {289 void testInitFromPreferences5() { 289 290 UserIdentityManager im = UserIdentityManager.getInstance(); 290 291 … … 307 308 308 309 @Test 309 publicvoid testApiUrlChanged() {310 void testApiUrlChanged() { 310 311 UserIdentityManager im = UserIdentityManager.getInstance(); 311 312 … … 344 345 345 346 @Test 346 publicvoid testUserNameChanged() {347 void testUserNameChanged() { 347 348 UserIdentityManager im = UserIdentityManager.getInstance(); 348 349 -
trunk/test/unit/org/openstreetmap/josm/data/VersionTest.java
r16019 r17275 2 2 package org.openstreetmap.josm.data; 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.ByteArrayInputStream; 8 8 import java.nio.charset.StandardCharsets; 9 9 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 … … 15 15 * Unit tests for class {@link Version}. 16 16 */ 17 publicclass VersionTest {17 class VersionTest { 18 18 19 19 /** 20 20 * Setup test. 21 21 */ 22 @Before Class22 @BeforeAll 23 23 public static void setUpBeforeClass() { 24 24 JOSMFixture.createUnitTestFixture().init(); … … 29 29 */ 30 30 @Test 31 publicvoid testGetAgentString() {31 void testGetAgentString() { 32 32 Version version = new Version(); 33 33 version.initFromRevisionInfo(null); 34 34 String v = version.getAgentString(false); 35 assertTrue(v , v.matches("JOSM/1\\.5 \\(UNKNOWN en\\)"));35 assertTrue(v.matches("JOSM/1\\.5 \\(UNKNOWN en\\)"), v); 36 36 v = version.getAgentString(true); 37 assertTrue(v , v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"));37 assertTrue(v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"), v); 38 38 } 39 39 … … 42 42 */ 43 43 @Test 44 publicvoid testInitFromRevisionInfoNull() {44 void testInitFromRevisionInfoNull() { 45 45 Version v = new Version(); 46 46 v.initFromRevisionInfo(null); … … 52 52 */ 53 53 @Test 54 publicvoid testInitFromRevisionInfoLocal() {54 void testInitFromRevisionInfoLocal() { 55 55 Version v = new Version(); 56 56 v.initFromRevisionInfo(new ByteArrayInputStream(("\n" + -
trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.cache; 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; … … 12 12 13 13 import org.apache.commons.jcs3.access.behavior.ICacheAccess; 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.data.imagery.TMSCachedTileLoader; 17 17 import org.openstreetmap.josm.data.imagery.TileJobOptions; … … 25 25 * @author Wiktor Niesiobedzki 26 26 */ 27 publicclass HostLimitQueueTest {27 class HostLimitQueueTest { 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().preferences().timeout(20 * 1000); … … 79 79 */ 80 80 @Test 81 publicvoid testSingleThreadPerHost() throws Exception {81 void testSingleThreadPerHost() throws Exception { 82 82 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1); 83 83 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 96 96 // so it should take ~8 seconds to finish 97 97 // if it's shorter, it means that host limit does not work 98 assertTrue( "Expected duration between 8 and 11 seconds not met. Actual duration: " + (duration /1000),99 duration < 11*1000 & duration > 8*1000);98 assertTrue(duration < 11*1000 & duration > 8*1000, 99 "Expected duration between 8 and 11 seconds not met. Actual duration: " + (duration /1000)); 100 100 } 101 101 … … 105 105 */ 106 106 @Test 107 publicvoid testMultipleThreadPerHost() throws Exception {107 void testMultipleThreadPerHost() throws Exception { 108 108 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 2); 109 109 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 121 121 // so it should take ~5 seconds to finish 122 122 // if it's shorter, it means that host limit does not work 123 assertTrue( "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000),124 duration < 6*1000 & duration > 4*1000);123 assertTrue(duration < 6*1000 & duration > 4*1000, 124 "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000)); 125 125 } 126 126 … … 130 130 */ 131 131 @Test 132 publicvoid testTwoHosts() throws Exception {132 void testTwoHosts() throws Exception { 133 133 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1); 134 134 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 147 147 // so it should take ~5 seconds to finish 148 148 // if it's shorter, it means that host limit does not work 149 assertTrue( "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000),150 duration < 6*1000 & duration > 4*1000);149 assertTrue(duration < 6*1000 & duration > 4*1000, 150 "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000)); 151 151 } 152 152 } -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCacheManagerTest.java
r16398 r17275 2 2 package org.openstreetmap.josm.data.cache; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.File; … … 11 11 import org.apache.commons.jcs3.access.CacheAccess; 12 12 import org.apache.commons.jcs3.auxiliary.disk.block.BlockDiskCacheAttributes; 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; 16 16 … … 21 21 * Unit tests for class {@link JCSCacheManager}. 22 22 */ 23 publicclass JCSCacheManagerTest {23 class JCSCacheManagerTest { 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().preferences().timeout(20000); … … 35 35 */ 36 36 @Test 37 publicvoid testUtilityClass() throws ReflectiveOperationException {37 void testUtilityClass() throws ReflectiveOperationException { 38 38 UtilityClassTestUtil.assertUtilityClassWellDefined(JCSCacheManager.class); 39 39 } … … 44 44 */ 45 45 @Test 46 publicvoid testLoggingAdaptor12054() throws IOException {46 void testLoggingAdaptor12054() throws IOException { 47 47 JCSCacheManager.getCache("foobar", 1, 0, "foobar"); // cause logging adaptor to be initialized 48 48 Logger.getLogger("org.apache.commons.jcs3").warning("{switch:0}"); … … 50 50 51 51 @Test 52 publicvoid testUseBigDiskFile() throws IOException {52 void testUseBigDiskFile() throws IOException { 53 53 if (JCSCacheManager.USE_BLOCK_CACHE.get()) { 54 54 // test only when using block cache … … 65 65 66 66 CacheAccess<Object, Object> cache = JCSCacheManager.getCache("testUseBigDiskFile", 1, 100, "foobar"); 67 assertEquals("BlockDiskCache use file size to calculate its size", 10*1024, 68 ((BlockDiskCacheAttributes) cache.getCacheControl().getAuxCaches()[0].getAuxiliaryCacheAttributes()).getMaxKeySize()); 67 assertEquals(10*1024, 68 ((BlockDiskCacheAttributes) cache.getCacheControl().getAuxCaches()[0].getAuxiliaryCacheAttributes()).getMaxKeySize(), 69 "BlockDiskCache use file size to calculate its size"); 69 70 } 70 71 } -
trunk/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java
r13079 r17275 4 4 import java.text.DecimalFormat; 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; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests for class {@link CachedLatLon}. 17 17 */ 18 publicclass CachedLatLonTest {18 class CachedLatLonTest { 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 testEqualsContract() {31 void testEqualsContract() { 32 32 TestUtils.assumeWorkingEqualsVerifier(); 33 33 EqualsVerifier.forClass(CachedLatLon.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/coor/EastNorthTest.java
r10915 r17275 2 2 package org.openstreetmap.josm.data.coor; 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 8 8 /** … … 11 11 * @since 10915 12 12 */ 13 publicclass EastNorthTest {13 class EastNorthTest { 14 14 15 15 /** … … 17 17 */ 18 18 @Test 19 publicvoid testInterpolate() {19 void testInterpolate() { 20 20 EastNorth en1 = new EastNorth(0, 0); 21 21 EastNorth en2 = new EastNorth(30, 60); … … 37 37 */ 38 38 @Test 39 publicvoid testGetCenter() {39 void testGetCenter() { 40 40 EastNorth en1 = new EastNorth(0, 0); 41 41 EastNorth en2 = new EastNorth(30, 60); -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r15451 r17275 2 2 package org.openstreetmap.josm.data.coor; 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.text.DecimalFormat; … … 10 10 import java.util.List; 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.TestUtils; 15 15 import org.openstreetmap.josm.data.Bounds; … … 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().projection(); … … 52 52 */ 53 53 @Test 54 publicvoid testRoundToOsmPrecision() {54 void testRoundToOsmPrecision() { 55 55 56 56 for (double value : SAMPLE_VALUES) { … … 110 110 */ 111 111 @Test 112 publicvoid testToIntervalLat() {112 void testToIntervalLat() { 113 113 assertEquals(-90.0, LatLon.toIntervalLat(-90.0), 0); 114 114 assertEquals(0.0, LatLon.toIntervalLat(0.0), 0); … … 123 123 */ 124 124 @Test 125 publicvoid testToIntervalLon() {125 void testToIntervalLon() { 126 126 assertEquals(-180.0, LatLon.toIntervalLon(-180.0), 0); 127 127 assertEquals(0.0, LatLon.toIntervalLon(0.0), 0); … … 148 148 */ 149 149 @Test 150 publicvoid testEqualsContract() {150 void testEqualsContract() { 151 151 TestUtils.assumeWorkingEqualsVerifier(); 152 152 EqualsVerifier.forClass(LatLon.class).usingGetClass() … … 159 159 */ 160 160 @Test 161 publicvoid testCopyConstructor() {161 void testCopyConstructor() { 162 162 assertEquals(LatLon.NORTH_POLE, new LatLon(LatLon.NORTH_POLE)); 163 163 assertEquals(LatLon.SOUTH_POLE, new LatLon(LatLon.SOUTH_POLE)); … … 169 169 */ 170 170 @Test 171 publicvoid testBearing() {171 void testBearing() { 172 172 LatLon c = new LatLon(47.000000, 19.000000); 173 173 LatLon e = new LatLon(47.000000, 19.000001); … … 183 183 */ 184 184 @Test 185 publicvoid testDistance() {185 void testDistance() { 186 186 assertEquals(0.0, LatLon.ZERO.distance(LatLon.ZERO), 0); 187 187 assertEquals(90.0, LatLon.ZERO.distance(LatLon.NORTH_POLE), 0); … … 193 193 */ 194 194 @Test 195 publicvoid testDistanceSq() {195 void testDistanceSq() { 196 196 assertEquals(0.0, LatLon.ZERO.distanceSq(LatLon.ZERO), 0); 197 197 assertEquals(90d*90d, LatLon.ZERO.distanceSq(LatLon.NORTH_POLE), 0); … … 203 203 */ 204 204 @Test 205 publicvoid testInterpolate() {205 void testInterpolate() { 206 206 LatLon ll1 = new LatLon(0, 0); 207 207 LatLon ll2 = new LatLon(30, 60); … … 225 225 @Test 226 226 @Deprecated 227 publicvoid testIsOutSideWorld() {227 void testIsOutSideWorld() { 228 228 assertFalse(LatLon.ZERO.isOutSideWorld()); 229 229 assertTrue(LatLon.NORTH_POLE.isOutSideWorld()); … … 237 237 */ 238 238 @Test 239 publicvoid testIsValid() {239 void testIsValid() { 240 240 assertTrue(LatLon.ZERO.isValid()); 241 241 assertTrue(LatLon.NORTH_POLE.isValid()); … … 252 252 */ 253 253 @Test 254 publicvoid testIsWithin() {254 void testIsWithin() { 255 255 assertTrue(LatLon.ZERO.isWithin(new Bounds(LatLon.ZERO))); 256 256 assertFalse(LatLon.ZERO.isWithin(new Bounds(LatLon.NORTH_POLE))); … … 261 261 */ 262 262 @Test 263 publicvoid testGetCenter() {263 void testGetCenter() { 264 264 LatLon ll1 = new LatLon(0, 0); 265 265 LatLon ll2 = new LatLon(30, 60); -
trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java
r13107 r17275 2 2 package org.openstreetmap.josm.data.coor; 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.text.DecimalFormat; 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.testutils.JOSMTestRules; … … 18 18 * Test the {@link PolarCoor} class. 19 19 */ 20 publicclass PolarCoorTest {20 class PolarCoorTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().projection(); … … 31 31 */ 32 32 @Test 33 publicvoid testPolarCoor() {33 void testPolarCoor() { 34 34 EastNorth en = new EastNorth(1000, 500); 35 35 PolarCoor pc = new PolarCoor(en); … … 50 50 */ 51 51 @Test 52 publicvoid testEqualsContract() {52 void testEqualsContract() { 53 53 TestUtils.assumeWorkingEqualsVerifier(); 54 54 EqualsVerifier.forClass(PolarCoor.class).usingGetClass() … … 61 61 */ 62 62 @Test 63 publicvoid testToString() {63 void testToString() { 64 64 assertEquals("PolarCoor [radius=1118.033988749, angle=0.463647609, pole=EastNorth[e=0.0, n=0.0]]", 65 65 new PolarCoor(1118.033988749, 0.463647609).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java
r16438 r17275 2 2 package org.openstreetmap.josm.data.coor.conversion; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.coor.ILatLon; 11 11 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Test for {@link ICoordinateFormat} implementations. 16 16 */ 17 publicclass ICoordinateFormatTest {17 class ICoordinateFormatTest { 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().projection(); … … 30 30 */ 31 31 @Test 32 publicvoid testFormatting() {32 void testFormatting() { 33 33 LatLon c = new LatLon(47.000000, 19.000000); 34 34 assertEquals("47.0", DecimalDegreesCoordinateFormat.INSTANCE.latToString(c)); -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java
r12795 r17275 2 2 package org.openstreetmap.josm.data.coor.conversion; 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; 6 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.openstreetmap.josm.data.coor.LatLon; 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 5 11 6 12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 7 8 import org.junit.Rule;9 import org.junit.Test;10 import org.openstreetmap.josm.data.coor.LatLon;11 import org.openstreetmap.josm.testutils.JOSMTestRules;12 13 13 14 /** 14 15 * Unit tests for class {@link LatLonParser}. 15 16 */ 16 publicclass LatLonParserTest {17 class LatLonParserTest { 17 18 18 19 /** 19 20 * Setup test. 20 21 */ 21 @R ule22 @RegisterExtension 22 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 24 public JOSMTestRules test = new JOSMTestRules().projection(); … … 27 28 */ 28 29 @Test 29 publicvoid testParse() {30 void testParse() { 30 31 assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("49.29918° 19.24788°")); 31 32 assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("N 49.29918 E 19.24788°")); … … 54 55 * Unit test of {@link LatLonParser#parse} method - invalid case 1. 55 56 */ 56 @Test (expected = IllegalArgumentException.class)57 publicvoid testParseInvalid1() {58 LatLonParser.parse("48°45'S 23°30'S");57 @Test 58 void testParseInvalid1() { 59 assertThrows(IllegalArgumentException.class, () -> LatLonParser.parse("48°45'S 23°30'S")); 59 60 } 60 61 … … 62 63 * Unit test of {@link LatLonParser#parse} method - invalid case 2. 63 64 */ 64 @Test (expected = IllegalArgumentException.class)65 publicvoid testParseInvalid2() {66 LatLonParser.parse("47°45'N 24°00'S");65 @Test 66 void testParseInvalid2() { 67 assertThrows(IllegalArgumentException.class, () -> LatLonParser.parse("47°45'N 24°00'S")); 67 68 } 68 69 -
trunk/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.correction; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Unit tests for class {@link TagCorrection}. 14 14 */ 15 publicclass TagCorrectionTest {15 class TagCorrectionTest { 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 testEqualsContract() {28 void testEqualsContract() { 29 29 TestUtils.assumeWorkingEqualsVerifier(); 30 30 EqualsVerifier.forClass(TagCorrection.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
r15502 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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.assertNull; 8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 10 10 11 import java.io.IOException; … … 18 19 import java.util.stream.Stream; 19 20 20 import org.junit. Before;21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.BeforeEach; 22 import org.junit.jupiter.api.Test; 23 import org.junit.jupiter.api.extension.RegisterExtension; 23 24 import org.openstreetmap.josm.TestUtils; 24 25 import org.openstreetmap.josm.data.Bounds; … … 41 42 * Unit tests for class {@link GpxData}. 42 43 */ 43 publicclass GpxDataTest {44 class GpxDataTest { 44 45 45 46 /** 46 47 * Setup test. 47 48 */ 48 @R ule49 @RegisterExtension 49 50 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 51 public JOSMTestRules test = new JOSMTestRules().projection(); … … 55 56 * Set up empty test data 56 57 */ 57 @Before 58 @BeforeEach 58 59 public void setUp() { 59 60 data = new GpxData(); … … 64 65 */ 65 66 @Test 66 publicvoid testMergeFrom() {67 void testMergeFrom() { 67 68 GpxTrack track = singleWaypointGpxTrack(); 68 69 GpxRoute route = singleWaypointRoute(); … … 93 94 */ 94 95 @Test 95 publicvoid testMergeFromFiles() throws Exception {96 void testMergeFromFiles() throws Exception { 96 97 testMerge(false, false, "Merged-all"); // regular merging 97 98 testMerge(true, false, "Merged-cut"); // cut overlapping tracks, but do not connect them … … 106 107 own.put(GpxConstants.META_BOUNDS, null); 107 108 expected.put(GpxConstants.META_BOUNDS, null); //they are only updated by GpxWriter 108 assertEquals(exp + " didn't match!", expected, own);109 assertEquals(expected, own, exp + " didn't match!"); 109 110 } 110 111 … … 117 118 */ 118 119 @Test 119 publicvoid testTracks() {120 void testTracks() { 120 121 assertEquals(0, data.getTracks().size()); 121 122 … … 138 139 * Test method for {@link GpxData#addTrack(IGpxTrack)}. 139 140 */ 140 @Test (expected = IllegalArgumentException.class)141 publicvoid testAddTrackFails() {141 @Test 142 void testAddTrackFails() { 142 143 GpxTrack track1 = emptyGpxTrack(); 143 144 data.addTrack(track1); 144 data.addTrack(track1);145 assertThrows(IllegalArgumentException.class, () -> data.addTrack(track1)); 145 146 } 146 147 … … 148 149 * Test method for {@link GpxData#removeTrack(IGpxTrack)}. 149 150 */ 150 @Test (expected = IllegalArgumentException.class)151 publicvoid testRemoveTrackFails() {151 @Test 152 void testRemoveTrackFails() { 152 153 GpxTrack track1 = emptyGpxTrack(); 153 154 data.addTrack(track1); 154 155 data.removeTrack(track1); 155 data.removeTrack(track1);156 assertThrows(IllegalArgumentException.class, () -> data.removeTrack(track1)); 156 157 } 157 158 … … 160 161 */ 161 162 @Test 162 publicvoid testRoutes() {163 void testRoutes() { 163 164 assertEquals(0, data.getTracks().size()); 164 165 … … 182 183 * Test method for {@link GpxData#addRoute(GpxRoute)}. 183 184 */ 184 @Test (expected = IllegalArgumentException.class)185 publicvoid testAddRouteFails() {185 @Test 186 void testAddRouteFails() { 186 187 GpxRoute route1 = new GpxRoute(); 187 188 data.addRoute(route1); 188 data.addRoute(route1);189 assertThrows(IllegalArgumentException.class, () -> data.addRoute(route1)); 189 190 } 190 191 … … 192 193 * Test method for {@link GpxData#removeRoute(GpxRoute)}. 193 194 */ 194 @Test (expected = IllegalArgumentException.class)195 publicvoid testRemoveRouteFails() {195 @Test 196 void testRemoveRouteFails() { 196 197 GpxRoute route1 = new GpxRoute(); 197 198 data.addRoute(route1); 198 199 data.removeRoute(route1); 199 data.removeRoute(route1);200 assertThrows(IllegalArgumentException.class, () -> data.removeRoute(route1)); 200 201 } 201 202 … … 204 205 */ 205 206 @Test 206 publicvoid testWaypoints() {207 void testWaypoints() { 207 208 assertEquals(0, data.getTracks().size()); 208 209 … … 225 226 * Test method for {@link GpxData#addWaypoint(WayPoint)}. 226 227 */ 227 @Test (expected = IllegalArgumentException.class)228 publicvoid testAddWaypointFails() {228 @Test 229 void testAddWaypointFails() { 229 230 WayPoint waypoint1 = new WayPoint(LatLon.ZERO); 230 231 data.addWaypoint(waypoint1); 231 data.addWaypoint(waypoint1);232 assertThrows(IllegalArgumentException.class, () -> data.addWaypoint(waypoint1)); 232 233 } 233 234 … … 235 236 * Test method for {@link GpxData#removeWaypoint(WayPoint)}. 236 237 */ 237 @Test (expected = IllegalArgumentException.class)238 publicvoid testRemoveWaypointFails() {238 @Test 239 void testRemoveWaypointFails() { 239 240 WayPoint waypoint1 = new WayPoint(LatLon.ZERO); 240 241 data.addWaypoint(waypoint1); 241 242 data.removeWaypoint(waypoint1); 242 data.removeWaypoint(waypoint1);243 assertThrows(IllegalArgumentException.class, () -> data.removeWaypoint(waypoint1)); 243 244 } 244 245 … … 247 248 */ 248 249 @Test 249 publicvoid testHasTrackPoints() {250 void testHasTrackPoints() { 250 251 assertFalse(data.hasTrackPoints()); 251 252 GpxTrack track1 = emptyGpxTrack(); … … 261 262 */ 262 263 @Test 263 publicvoid testGetTrackPoints() {264 void testGetTrackPoints() { 264 265 assertEquals(0, data.getTrackPoints().count()); 265 266 GpxTrack track1 = singleWaypointGpxTrack(); … … 275 276 */ 276 277 @Test 277 publicvoid testHasRoutePoints() {278 void testHasRoutePoints() { 278 279 279 280 } … … 283 284 */ 284 285 @Test 285 publicvoid testIsEmpty() {286 void testIsEmpty() { 286 287 GpxTrack track1 = singleWaypointGpxTrack(); 287 288 WayPoint waypoint = new WayPoint(LatLon.ZERO); … … 310 311 */ 311 312 @Test 312 publicvoid testLength() {313 void testLength() { 313 314 GpxTrack track1 = waypointGpxTrack( 314 315 new WayPoint(new LatLon(0, 0)), … … 328 329 */ 329 330 @Test 330 publicvoid testGetMinMaxTimeForAllTracks() {331 void testGetMinMaxTimeForAllTracks() { 331 332 assertEquals(0, data.getMinMaxTimeForAllTracks().length); 332 333 … … 352 353 */ 353 354 @Test 354 publicvoid testNearestPointOnTrack() {355 void testNearestPointOnTrack() { 355 356 List<WayPoint> points = Stream 356 357 .of(new EastNorth(10, 10), new EastNorth(10, 0), new EastNorth(-1, 0)) … … 378 379 */ 379 380 @Test 380 publicvoid testGetDataSources() {381 void testGetDataSources() { 381 382 DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test"); 382 383 data.dataSources.add(ds); … … 388 389 */ 389 390 @Test 390 publicvoid testGetDataSourceArea() {391 void testGetDataSourceArea() { 391 392 DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test"); 392 393 data.dataSources.add(ds); … … 400 401 */ 401 402 @Test 402 publicvoid testGetDataSourceBounds() {403 void testGetDataSourceBounds() { 403 404 Bounds bounds = new Bounds(0, 0, 1, 1); 404 405 DataSource ds = new DataSource(bounds, "test"); … … 413 414 */ 414 415 @Test 415 publicvoid testChangeListener() {416 void testChangeListener() { 416 417 TestChangeListener cl1 = new TestChangeListener(); 417 418 TestChangeListener cl2 = new TestChangeListener(); … … 474 475 */ 475 476 @Test 476 publicvoid testEqualsContract() {477 void testEqualsContract() { 477 478 TestUtils.assumeWorkingEqualsVerifier(); 478 479 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java
r15629 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.gui.layer.gpx.ConvertToDataLayerActionTest; … … 17 17 * Unit tests for class {@link GpxExtension} 18 18 */ 19 publicclass GpxExtensionTest {19 class GpxExtensionTest { 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(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java
r15431 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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.Arrays; 10 10 import java.util.List; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 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.coor.CachedLatLon; … … 28 28 * Unit tests of {@link GpxImageCorrelation} class. 29 29 */ 30 publicclass GpxImageCorrelationTest {30 class GpxImageCorrelationTest { 31 31 32 32 /** 33 33 * Setup test. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 * Setup test. 41 41 */ 42 @Before Class42 @BeforeAll 43 43 public static void setUp() { 44 44 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 50 50 */ 51 51 @Test 52 publicvoid testMatchGpxTrack() throws Exception {52 void testMatchGpxTrack() throws Exception { 53 53 IPreferences s = Config.getPref(); 54 54 final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx"); … … 274 274 */ 275 275 @Test 276 publicvoid testGetElevation() {276 void testGetElevation() { 277 277 assertNull(GpxImageCorrelation.getElevation(null)); 278 278 WayPoint wp = new WayPoint(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java
r14209 r17275 4 4 import java.io.File; 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; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link GpxImageEntry} class. 17 17 */ 18 publicclass GpxImageEntryTest {18 class GpxImageEntryTest { 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 testEqualsContract() {31 void testEqualsContract() { 32 32 TestUtils.assumeWorkingEqualsVerifier(); 33 33 EqualsVerifier.forClass(GpxImageEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java
r14205 r17275 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.text.ParseException; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 12 import org.openstreetmap.josm.tools.date.DateUtils; … … 18 18 * Unit tests of {@link GpxTimeOffset} class. 19 19 */ 20 publicclass GpxOffsetTest {20 class GpxOffsetTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 * Setup test. 31 31 */ 32 @Before Class32 @BeforeAll 33 33 public static void setUp() { 34 34 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 39 39 */ 40 40 @Test 41 publicvoid testFormatOffset() {41 void testFormatOffset() { 42 42 assertEquals("0", GpxTimeOffset.seconds(0).formatOffset()); 43 43 assertEquals("123", GpxTimeOffset.seconds(123).formatOffset()); … … 55 55 */ 56 56 @Test 57 publicvoid testParseOffest() throws ParseException {57 void testParseOffest() throws ParseException { 58 58 assertEquals(0, GpxTimeOffset.parseOffset("0").getSeconds()); 59 59 assertEquals(4242L, GpxTimeOffset.parseOffset("4242").getSeconds()); … … 69 69 */ 70 70 @Test 71 publicvoid testSplitOutTimezone() {71 void testSplitOutTimezone() { 72 72 assertEquals("+1:00", GpxTimeOffset.seconds(3602).splitOutTimezone().a.formatTimezone()); 73 73 assertEquals("2", GpxTimeOffset.seconds(3602).splitOutTimezone().b.formatOffset()); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Unit tests for class {@link GpxRoute}. 16 16 */ 17 publicclass GpxRouteTest {17 class GpxRouteTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testEqualsContract() {30 void testEqualsContract() { 31 31 TestUtils.assumeWorkingEqualsVerifier(); 32 32 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java
r14205 r17275 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.text.ParseException; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 12 import org.openstreetmap.josm.tools.date.DateUtils; … … 18 18 * Unit tests of {@link GpxTimezone} class. 19 19 */ 20 publicclass GpxTimezoneTest {20 class GpxTimezoneTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 * Setup test. 31 31 */ 32 @Before Class32 @BeforeAll 33 33 public static void setUp() { 34 34 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 39 39 */ 40 40 @Test 41 publicvoid testFormatTimezone() {41 void testFormatTimezone() { 42 42 assertEquals("+1:00", new GpxTimezone(1).formatTimezone()); 43 43 assertEquals("+6:30", new GpxTimezone(6.5).formatTimezone()); … … 52 52 */ 53 53 @Test 54 publicvoid testParseTimezone() throws ParseException {54 void testParseTimezone() throws ParseException { 55 55 assertEquals(1, GpxTimezone.parseTimezone("+01:00").getHours(), 1e-3); 56 56 assertEquals(1, GpxTimezone.parseTimezone("+1:00").getHours(), 1e-3); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Unit tests for class {@link GpxTrackSegment}. 16 16 */ 17 publicclass GpxTrackSegmentTest {17 class GpxTrackSegmentTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testEqualsContract() {30 void testEqualsContract() { 31 31 TestUtils.assumeWorkingEqualsVerifier(); 32 32 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java
r15560 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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.awt.Color; … … 9 9 import java.util.HashMap; 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.testutils.JOSMTestRules; … … 22 22 * Unit tests for class {@link GpxTrack}. 23 23 */ 24 publicclass GpxTrackTest {24 class GpxTrackTest { 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(); … … 35 35 */ 36 36 @Test 37 publicvoid testColors() {37 void testColors() { 38 38 GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>()); 39 39 GpxExtensionCollection ext = trk.getExtensions(); … … 61 61 */ 62 62 @Test 63 publicvoid testEqualsContract() {63 void testEqualsContract() { 64 64 TestUtils.assumeWorkingEqualsVerifier(); 65 65 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link WayPoint}. 15 15 */ 16 publicclass WayPointTest {16 class WayPointTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link WithAttributes}. 15 15 */ 16 publicclass WithAttributesTest {16 class WithAttributesTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.imagery; 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.testutils.JOSMTestRules; 9 9 … … 14 14 * Unit tests for class {@link GetCapabilitiesParseHelper}. 15 15 */ 16 publicclass GetCapabilitiesParseHelperTest {16 class GetCapabilitiesParseHelperTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testUtilityClass() throws ReflectiveOperationException {30 void testUtilityClass() throws ReflectiveOperationException { 31 31 UtilityClassTestUtil.assertUtilityClassWellDefined(GetCapabilitiesParseHelper.class); 32 32 } … … 36 36 */ 37 37 @Test 38 publicvoid testCrsToCode() {38 void testCrsToCode() { 39 39 assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg:3127")); 40 40 assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg::3127")); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java
r12851 r17275 2 2 package org.openstreetmap.josm.data.imagery; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; … … 10 10 import java.util.Set; 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.data.StructUtils; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 23 23 * 24 24 */ 25 publicclass ImageryInfoTest {25 class ImageryInfoTest { 26 26 27 27 /** 28 28 * Setup tests 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetExtendedUrl() {38 void testGetExtendedUrl() { 39 39 ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 40 40 testImageryTMS.setDefaultMinZoom(16); … … 47 47 */ 48 48 @Test 49 publicvoid testConstruct13264() {49 void testConstruct13264() { 50 50 final ImageryInfo info = new ImageryInfo("test imagery", "tms[16-23]:http://localhost"); 51 51 assertEquals(ImageryInfo.ImageryType.TMS, info.getImageryType()); … … 56 56 57 57 /** 58 * Tests the {@linkplain StructUtils#serializeStruct (Object, Class)serialization} of {@link ImageryInfo.ImageryPreferenceEntry}58 * Tests the {@linkplain StructUtils#serializeStruct serialization} of {@link ImageryInfo.ImageryPreferenceEntry} 59 59 */ 60 60 @Test 61 publicvoid testSerializeStruct() {61 void testSerializeStruct() { 62 62 final ImageryInfo.ImageryPreferenceEntry info = new ImageryInfo.ImageryPreferenceEntry(); 63 63 info.noTileHeaders = new MultiMap<>(); … … 72 72 */ 73 73 @Test 74 publicvoid testDeserializeStruct() {74 void testDeserializeStruct() { 75 75 final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct( 76 76 Collections.singletonMap("noTileHeaders", "{\"ETag\":[\"foo\",\"bar\"]}"), ImageryInfo.ImageryPreferenceEntry.class); … … 87 87 */ 88 88 @Test 89 publicvoid testDeserializeStructTicket12474() {89 void testDeserializeStructTicket12474() { 90 90 final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct( 91 91 Collections.singletonMap("noTileHeaders", "{\"ETag\":\"foo-and-bar\"}"), ImageryInfo.ImageryPreferenceEntry.class); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.data.imagery; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 10 10 /** 11 11 * Unit tests for class {@link Shape}. 12 12 */ 13 publicclass ShapeTest {13 class ShapeTest { 14 14 15 15 /** … … 17 17 */ 18 18 @Test 19 publicvoid test() {19 void test() { 20 20 Shape shape = new Shape(); 21 21 shape.addPoint("47.1", "11.1"); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r17094 r17275 2 2 package org.openstreetmap.josm.data.imagery; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 7 import org.junit. Rule;8 import org.junit. Test;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 9 import org.openstreetmap.gui.jmapviewer.TileXY; 10 10 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; … … 24 24 * Unit tests for class {@link TemplatedWMSTileSource}. 25 25 */ 26 publicclass TemplatedWMSTileSourceTest {26 class TemplatedWMSTileSourceTest { 27 27 28 28 private final ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null); … … 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(); … … 40 40 */ 41 41 @Test 42 publicvoid testEPSG3857() {42 void testEPSG3857() { 43 43 Projection projection = Projections.getProjectionByCode("EPSG:3857"); 44 44 ProjectionRegistry.setProjection(projection); … … 65 65 */ 66 66 @Test 67 publicvoid testEPSG4326() {67 void testEPSG4326() { 68 68 Projection projection = Projections.getProjectionByCode("EPSG:4326"); 69 69 ProjectionRegistry.setProjection(projection); … … 81 81 */ 82 82 @Test 83 publicvoid testEPSG4326widebounds() {83 void testEPSG4326widebounds() { 84 84 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54"); 85 85 ProjectionRegistry.setProjection(projection); … … 94 94 */ 95 95 @Test 96 publicvoid testEPSG4326narrowbounds() {96 void testEPSG4326narrowbounds() { 97 97 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90"); 98 98 ProjectionRegistry.setProjection(projection); … … 107 107 */ 108 108 @Test 109 publicvoid testEPSG2180() {109 void testEPSG2180() { 110 110 Projection projection = Projections.getProjectionByCode("EPSG:2180"); 111 111 ProjectionRegistry.setProjection(projection); … … 124 124 */ 125 125 @Test 126 publicvoid testEPSG3006withbounds() {126 void testEPSG3006withbounds() { 127 127 Projection projection = 128 128 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " … … 140 140 */ 141 141 @Test 142 publicvoid testEPSG3006withoutbounds() {142 void testEPSG3006withoutbounds() { 143 143 Projection projection = 144 144 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " … … 156 156 */ 157 157 @Test 158 publicvoid testGetTileUrl() {158 void testGetTileUrl() { 159 159 // "https://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery_Dates/MapServer/WMSServer? 160 160 // SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height} … … 206 206 ICoordinate expected = verifier.tileXYToLatLon(x, y, z - 1); 207 207 assertEquals(expected.getLat(), result.lat(), 1e-4); 208 assertEquals( LatLon.normalizeLon(expected.getLon() - result.lon()), 0.0, 1e-4);208 assertEquals(0.0, LatLon.normalizeLon(expected.getLon() - result.lon()), 1e-4); 209 209 LatLon tileCenter = new Bounds(result, getTileLatLon(source, x+1, y+1, z)).getCenter(); 210 210 TileXY backwardsResult = source.latLonToTileXY(CoordinateConversion.llToCoor(tileCenter), z); … … 224 224 private void verifyLocation(TemplatedWMSTileSource source, LatLon location, int z) { 225 225 Projection projection = ProjectionRegistry.getProjection(); 226 assertTrue( 227 "Point outside world bounds", 228 projection.getWorldBoundsLatLon().contains(location) 229 ); 226 assertTrue(projection.getWorldBoundsLatLon().contains(location), "Point outside world bounds"); 230 227 231 228 TileXY tileIndex = source.latLonToTileXY(CoordinateConversion.llToCoor(location), z); 232 229 233 assertTrue( "X index: " + tileIndex.getXIndex() + " greater than tileXmax: " + source.getTileXMax(z) + " at zoom: " + z,234 tileIndex.getXIndex() <= source.getTileXMax(z));235 236 assertTrue( "Y index: " + tileIndex.getYIndex() + " greater than tileYmax: " + source.getTileYMax(z) + " at zoom: " + z,237 tileIndex.getYIndex() <= source.getTileYMax(z));230 assertTrue(tileIndex.getXIndex() <= source.getTileXMax(z), 231 "X index: " + tileIndex.getXIndex() + " greater than tileXmax: " + source.getTileXMax(z) + " at zoom: " + z); 232 233 assertTrue(tileIndex.getYIndex() <= source.getTileYMax(z), 234 "Y index: " + tileIndex.getYIndex() + " greater than tileYmax: " + source.getTileYMax(z) + " at zoom: " + z); 238 235 239 236 ICoordinate x1 = source.tileXYToLatLon(tileIndex.getXIndex(), tileIndex.getYIndex(), z); … … 245 242 bounds.extend(x2.getLat(), x2.getLon()); 246 243 // test that location is within tile bounds 247 assertTrue( location + " not within " + bounds + " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex(),248 bounds.contains(location));244 assertTrue(bounds.contains(location), 245 location + " not within " + bounds + " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex()); 249 246 verifyTileSquareness(source, tileIndex.getXIndex(), tileIndex.getYIndex(), z); 250 247 } -
trunk/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.data.notes; 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.util.Date; 9 9 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.testutils.JOSMTestRules; 13 13 … … 17 17 * Unit tests for class {@link NoteComment}. 18 18 */ 19 publicclass NoteCommentTest {19 class NoteCommentTest { 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 testNoteComment() {32 void testNoteComment() { 33 33 NoteComment comment = new NoteComment(new Date(), null, "foo", null, true); 34 34 assertEquals("foo", comment.toString()); -
trunk/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.notes; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 6 7 7 import java.util.Date; 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; … … 20 20 * Unit tests for class {@link NoteComment}. 21 21 */ 22 publicclass NoteTest {22 class NoteTest { 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 testToString() {35 void testToString() { 36 36 Note note = new Note(LatLon.ZERO); 37 37 assertEquals("Note 0: null", note.toString()); … … 44 44 */ 45 45 @Test 46 publicvoid testUpdateWith() {46 void testUpdateWith() { 47 47 Note n1 = new Note(LatLon.ZERO); 48 48 n1.setId(1); … … 58 58 */ 59 59 @Test 60 publicvoid testEqualsContract() {60 void testEqualsContract() { 61 61 TestUtils.assumeWorkingEqualsVerifier(); 62 62 EqualsVerifier.forClass(Note.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java
r14119 r17275 2 2 package org.openstreetmap.josm.data.oauth; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotEquals;6 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.spi.preferences.Config; … … 19 19 * Unit tests for class {@link OAuthParameters}. 20 20 */ 21 publicclass OAuthParametersTest {21 class OAuthParametersTest { 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(); … … 33 33 @Test 34 34 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 35 publicvoid testCreateDefault() {35 void testCreateDefault() { 36 36 OAuthParameters def = OAuthParameters.createDefault(); 37 37 assertNotNull(def); … … 50 50 */ 51 51 @Test 52 publicvoid testEqualsContract() {52 void testEqualsContract() { 53 53 TestUtils.assumeWorkingEqualsVerifier(); 54 54 EqualsVerifier.forClass(OAuthParameters.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthTokenTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.oauth; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 … … 14 14 * Unit tests for class {@link OAuthToken}. 15 15 */ 16 publicclass OAuthTokenTest {16 class OAuthTokenTest { 17 17 18 18 /** … … 20 20 */ 21 21 @Test 22 publicvoid testCreateToken() {22 void testCreateToken() { 23 23 OAuthConsumer defCon = OAuthParameters.createDefault().buildConsumer(); 24 24 assertNotNull(defCon); … … 34 34 */ 35 35 @Test 36 publicvoid testEqualsContract() {36 void testEqualsContract() { 37 37 TestUtils.assumeWorkingEqualsVerifier(); 38 38 EqualsVerifier.forClass(OAuthToken.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OsmPrivilegesTest.java
r9666 r17275 2 2 package org.openstreetmap.josm.data.oauth; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 8 9 9 /** 10 10 * Unit tests for class {@link OsmPrivileges}. 11 11 */ 12 publicclass OsmPrivilegesTest {12 class OsmPrivilegesTest { 13 13 14 14 /** … … 16 16 */ 17 17 @Test 18 publicvoid testGettersSetters() {18 void testGettersSetters() { 19 19 OsmPrivileges p = new OsmPrivileges(); 20 20 assertFalse(p.isAllowModifyNotes()); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/SignpostAdaptersTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.oauth; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertNull; 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; 7 8 8 9 import java.io.IOException; … … 10 11 import java.net.URL; 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.data.oauth.SignpostAdapters.HttpRequest; 15 16 import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpResponse; … … 24 25 * Unit tests for class {@link SignpostAdapters}. 25 26 */ 26 publicclass SignpostAdaptersTest {27 class SignpostAdaptersTest { 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().https(); … … 42 43 */ 43 44 @Test 44 publicvoid testUtilityClass() throws ReflectiveOperationException {45 void testUtilityClass() throws ReflectiveOperationException { 45 46 UtilityClassTestUtil.assertUtilityClassWellDefined(SignpostAdapters.class); 46 47 } … … 51 52 */ 52 53 @Test 53 publicvoid testOAuthConsumerWrap() throws MalformedURLException {54 void testOAuthConsumerWrap() throws MalformedURLException { 54 55 assertNotNull(new OAuthConsumer("", "").wrap(newClient())); 55 56 } … … 60 61 */ 61 62 @Test 62 publicvoid testHttpRequestGetMessagePayload() throws IOException {63 void testHttpRequestGetMessagePayload() throws IOException { 63 64 assertNull(new HttpRequest(newClient()).getMessagePayload()); 64 65 } … … 66 67 /** 67 68 * Unit test of method {@link SignpostAdapters.HttpRequest#setRequestUrl}. 68 * @throws IOException never69 69 */ 70 @Test (expected = IllegalStateException.class)71 public void testHttpRequestSetRequestUrl() throws IOException{72 new HttpRequest(newClient()).setRequestUrl(null);70 @Test 71 void testHttpRequestSetRequestUrl() { 72 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).setRequestUrl(null)); 73 73 } 74 74 75 75 /** 76 76 * Unit test of method {@link SignpostAdapters.HttpRequest#getAllHeaders}. 77 * @throws IOException never78 77 */ 79 @Test (expected = IllegalStateException.class)80 public void testHttpRequestGetAllHeaders() throws IOException{81 new HttpRequest(newClient()).getAllHeaders();78 @Test 79 void testHttpRequestGetAllHeaders() { 80 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).getAllHeaders()); 82 81 } 83 82 84 83 /** 85 84 * Unit test of method {@link SignpostAdapters.HttpRequest#unwrap}. 86 * @throws IOException never87 85 */ 88 @Test (expected = IllegalStateException.class)89 public void testHttpRequestUnwrap() throws IOException{90 new HttpRequest(newClient()).unwrap();86 @Test 87 void testHttpRequestUnwrap() { 88 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).unwrap()); 91 89 } 92 90 … … 96 94 */ 97 95 @Test 98 publicvoid testHttpResponseGetReasonPhrase() throws Exception {96 void testHttpResponseGetReasonPhrase() throws Exception { 99 97 assertEquals("OK", new HttpResponse(new HttpRequest(newClient()).request.connect()).getReasonPhrase()); 100 98 } … … 102 100 /** 103 101 * Unit test of method {@link SignpostAdapters.HttpResponse#unwrap}. 104 * @throws IOException never105 102 */ 106 @Test (expected = IllegalStateException.class)107 public void testHttpResponseUnwrap() throws IOException{108 new HttpResponse(new HttpRequest(newClient()).request.connect()).unwrap();103 @Test 104 void testHttpResponseUnwrap() { 105 assertThrows(IllegalStateException.class, () -> new HttpResponse(new HttpRequest(newClient()).request.connect()).unwrap()); 109 106 } 110 107 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java
r12027 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.Collections; 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.JOSMTestRules; 12 12 … … 16 16 * Unit tests of the {@code AbstractPrimitive} class. 17 17 */ 18 publicclass AbstractPrimitiveTest {18 class AbstractPrimitiveTest { 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 testIsUndeleted() {31 void testIsUndeleted() { 32 32 AbstractPrimitive p = new Node(1); 33 33 p.setVisible(false); … … 60 60 */ 61 61 @Test 62 publicvoid testHasTagDifferent() {62 void testHasTagDifferent() { 63 63 AbstractPrimitive p = new Node(); 64 64 -
trunk/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java
r16673 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.data.coor.LatLon; … … 19 19 * Unit tests for class {@link BBox}. 20 20 */ 21 publicclass BBoxTest {21 class BBoxTest { 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 testEqualsContract() {34 void testEqualsContract() { 35 35 TestUtils.assumeWorkingEqualsVerifier(); 36 36 EqualsVerifier.forClass(BBox.class).usingGetClass() … … 43 43 */ 44 44 @Test 45 publicvoid testBboxesAreFunctionallyEqual() {45 void testBboxesAreFunctionallyEqual() { 46 46 BBox bbox1 = new BBox(0, 1, 1, 0); 47 47 BBox bbox2 = new BBox(0.1, 0.9, 0.9, 0.1); … … 63 63 */ 64 64 @Test 65 publicvoid testLatLonConstructor() {65 void testLatLonConstructor() { 66 66 LatLon latLon1 = new LatLon(10, 20); 67 67 LatLon latLon2 = new LatLon(20, 10); … … 95 95 */ 96 96 @Test 97 publicvoid testDoubleConstructor() {97 void testDoubleConstructor() { 98 98 assertTrue(new BBox(1, 2, 3, 4).isValid()); 99 99 assertFalse(new BBox(Double.NaN, 2, 3, 4).isValid()); … … 107 107 */ 108 108 @Test 109 publicvoid testNodeConstructor() {109 void testNodeConstructor() { 110 110 assertTrue(new BBox(new Node(LatLon.NORTH_POLE)).isValid()); 111 111 assertFalse(new BBox(new Node()).isValid()); … … 116 116 */ 117 117 @Test 118 publicvoid testAddLatLon() {118 void testAddLatLon() { 119 119 BBox b = new BBox(); 120 120 b.add((LatLon) null); … … 130 130 */ 131 131 @Test 132 publicvoid testAddLatLonBuffer() {132 void testAddLatLonBuffer() { 133 133 BBox b = new BBox(); 134 134 b.addLatLon(LatLon.NORTH_POLE, 0.5); … … 142 142 */ 143 143 @Test 144 publicvoid testAddDouble() {144 void testAddDouble() { 145 145 BBox b = new BBox(); 146 146 b.add(1, Double.NaN); … … 157 157 */ 158 158 @Test 159 publicvoid testAddPrimitive() {159 void testAddPrimitive() { 160 160 BBox b = new BBox(); 161 161 b.addPrimitive(new Node(LatLon.NORTH_POLE), 0.5); … … 169 169 */ 170 170 @Test 171 publicvoid testHeightWidthArea() {171 void testHeightWidthArea() { 172 172 BBox b1 = new BBox(1, 2, 3, 5); 173 173 assertEquals(2, b1.width(), 1e-7); … … 184 184 */ 185 185 @Test 186 publicvoid testToString() {186 void testToString() { 187 187 assertEquals("[ x: Infinity -> -Infinity, y: Infinity -> -Infinity ]", new BBox().toString()); 188 188 assertEquals("[ x: 1.0 -> 3.0, y: 2.0 -> 4.0 ]", new BBox(1, 2, 3, 4).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.data.osm; 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; … … 13 13 import java.util.concurrent.TimeUnit; 14 14 15 import org.junit. After;16 import org.junit. Before;17 import org.junit. Rule;18 import org.junit. Test;15 import org.junit.jupiter.api.AfterEach; 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.data.UserIdentityManager; 20 20 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 26 26 * Unit test of {@link ChangesetCache} 27 27 */ 28 publicclass ChangesetCacheTest {28 class ChangesetCacheTest { 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 test = new JOSMTestRules(); … … 40 40 * Clears cache before/after each unit test. 41 41 */ 42 @After 43 @Before 42 @AfterEach 43 @BeforeEach 44 44 public void clearCache() { 45 45 cache.listeners.clear(); … … 73 73 */ 74 74 @Test 75 publicvoid testConstructor() {75 void testConstructor() { 76 76 assertNotNull(ChangesetCache.getInstance()); 77 77 } 78 78 79 79 @Test 80 publicvoid testAddAndRemoveListeners() {80 void testAddAndRemoveListeners() { 81 81 // should work 82 82 cache.addChangesetCacheListener(null); … … 97 97 98 98 @Test 99 publicvoid testUpdateGetRemoveCycle() {99 void testUpdateGetRemoveCycle() { 100 100 cache.update(new Changeset(1)); 101 101 assertEquals(1, cache.size()); … … 107 107 108 108 @Test 109 publicvoid testUpdateTwice() {109 void testUpdateTwice() { 110 110 Changeset cs = new Changeset(1); 111 111 cs.setIncomplete(false); … … 130 130 131 131 @Test 132 publicvoid testContains() {132 void testContains() { 133 133 Changeset cs = new Changeset(1); 134 134 cache.update(cs); … … 144 144 145 145 @Test 146 publicvoid testFireingEventsAddAChangeset() {146 void testFireingEventsAddAChangeset() { 147 147 TestListener listener = new TestListener() { 148 148 @Override 149 publicvoid test() {149 void test() { 150 150 await(); 151 151 assertNotNull(event); … … 163 163 164 164 @Test 165 publicvoid testFireingEventsUpdateChangeset() {165 void testFireingEventsUpdateChangeset() { 166 166 // Waiter listener to ensure the second listener does not receive the first event 167 167 TestListener waiter = new TestListener() { … … 195 195 196 196 @Test 197 publicvoid testFireingEventsRemoveChangeset() {197 void testFireingEventsRemoveChangeset() { 198 198 // Waiter listener to ensure the second listener does not receive the first event 199 199 TestListener waiter = new TestListener() { … … 229 229 */ 230 230 @Test 231 publicvoid testGetOpenChangesets() {231 void testGetOpenChangesets() { 232 232 // empty cache => empty list 233 assertTrue( 234 "Empty cache should produce an empty list.", 235 cache.getOpenChangesets().isEmpty() 236 ); 237 assertTrue( 238 "Empty cache should produce an empty list.", 239 cache.getChangesets().isEmpty() 240 ); 233 assertTrue(cache.getOpenChangesets().isEmpty(), "Empty cache should produce an empty list."); 234 assertTrue(cache.getChangesets().isEmpty(), "Empty cache should produce an empty list."); 241 235 242 236 // cache with only closed changesets => empty list … … 244 238 closedCs.setOpen(false); 245 239 cache.update(closedCs); 246 assertTrue( 247 "Cache with only closed changesets should produce an empty list.", 248 cache.getOpenChangesets().isEmpty() 249 ); 240 assertTrue(cache.getOpenChangesets().isEmpty(), 241 "Cache with only closed changesets should produce an empty list."); 250 242 assertEquals(1, cache.getChangesets().size()); 251 243 … … 265 257 */ 266 258 @Test 267 publicvoid testGetOpenChangesetsForCurrentUser() {259 void testGetOpenChangesetsForCurrentUser() { 268 260 // empty cache => empty list 269 assertTrue( 270 "Empty cache should produce an empty list.", 271 cache.getOpenChangesetsForCurrentUser().isEmpty() 272 ); 261 assertTrue(cache.getOpenChangesetsForCurrentUser().isEmpty(), 262 "Empty cache should produce an empty list."); 273 263 274 264 Changeset openCs1 = new Changeset(1); … … 299 289 */ 300 290 @Test 301 publicvoid testRemove() {291 void testRemove() { 302 292 Changeset cs1 = new Changeset(1); 303 293 cache.update(cs1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r14961 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;7 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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.util.Date; 10 10 import java.util.Iterator; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.data.coor.LatLon; … … 25 25 * Unit tests for class {@link ChangesetDataSet}. 26 26 */ 27 publicclass ChangesetDataSetTest {27 class ChangesetDataSetTest { 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(); … … 38 38 */ 39 39 @Test 40 publicvoid testIterator() {40 void testIterator() { 41 41 final ChangesetDataSet cds = new ChangesetDataSet(); 42 42 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); … … 60 60 */ 61 61 @Test 62 publicvoid testGetEntry() {62 void testGetEntry() { 63 63 final ChangesetDataSet cds = new ChangesetDataSet(); 64 64 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); … … 80 80 */ 81 81 @Test 82 publicvoid testEnumChangesetModificationType() {82 void testEnumChangesetModificationType() { 83 83 TestUtils.superficialEnumCodeCoverage(ChangesetModificationType.class); 84 84 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java
r12035 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Date; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests for class {@link ChangesetDiscussionComment}. 16 16 */ 17 publicclass ChangesetDiscussionCommentTest {17 class ChangesetDiscussionCommentTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testChangesetDiscussionComment() {30 void testChangesetDiscussionComment() { 31 31 Date d = new Date(1000); 32 32 User foo = User.createOsmUser(1, "foo"); … … 41 41 */ 42 42 @Test 43 publicvoid testText() {43 void testText() { 44 44 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(new Date(), null); 45 45 cdc.setText("foo"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.openstreetmap.josm.data.osm.Changeset.MAX_CHANGESET_TAG_LENGTH; 9 9 … … 17 17 18 18 import org.junit.Assert; 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.extension.RegisterExtension; 20 import org.junit.jupiter.api.Test; 21 21 import org.openstreetmap.josm.data.Bounds; 22 22 import org.openstreetmap.josm.data.coor.LatLon; … … 29 29 * Unit tests for class {@link Changeset}. 30 30 */ 31 publicclass ChangesetTest {31 class ChangesetTest { 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(); … … 43 43 @Test 44 44 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 45 publicvoid testSetKeys() {45 void testSetKeys() { 46 46 final Changeset cs = new Changeset(); 47 47 // Cannot add null map => IllegalArgumentException … … 82 82 */ 83 83 @Test 84 publicvoid testCompareTo() {84 void testCompareTo() { 85 85 Changeset cs1 = new Changeset(1); 86 86 Changeset cs2 = new Changeset(2); … … 94 94 */ 95 95 @Test 96 publicvoid testGetBounds() {96 void testGetBounds() { 97 97 Changeset cs = new Changeset(); 98 98 assertNull(cs.getBounds()); … … 112 112 */ 113 113 @Test 114 publicvoid testGetSetHasContent() {114 void testGetSetHasContent() { 115 115 Changeset cs = new Changeset(); 116 116 assertNull(cs.getContent()); … … 126 126 */ 127 127 @Test 128 publicvoid testGetDisplayName() {128 void testGetDisplayName() { 129 129 assertEquals("Changeset 0", new Changeset().getDisplayName(DefaultNameFormatter.getInstance())); 130 130 } … … 134 134 */ 135 135 @Test 136 publicvoid testGetName() {136 void testGetName() { 137 137 assertEquals("changeset 0", new Changeset().getName()); 138 138 } … … 148 148 */ 149 149 @Test 150 publicvoid testHasEqualSemanticAttributes() {150 void testHasEqualSemanticAttributes() { 151 151 Date today = new Date(); 152 152 Changeset cs1 = new Changeset(); … … 244 244 */ 245 245 @Test 246 publicvoid testKeySet() {246 void testKeySet() { 247 247 Changeset cs = new Changeset(); 248 248 assertTrue(cs.keySet().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java
r12036 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 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.JOSMTestRules; 10 10 … … 14 14 * Unit tests for class {@link DataIntegrityProblemException}. 15 15 */ 16 publicclass DataIntegrityProblemExceptionTest {16 class DataIntegrityProblemExceptionTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testDataIntegrityException() {29 void testDataIntegrityException() { 30 30 DataIntegrityProblemException e1 = new DataIntegrityProblemException("foo"); 31 31 assertEquals("foo", e1.getMessage()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r16657 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.assertNotSame;8 import static org.junit. Assert.assertSame;9 import static org.junit. Assert.assertTrue;10 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.assertNotSame; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 import static org.junit.jupiter.api.Assertions.fail; 11 11 12 12 import java.io.StringWriter; … … 15 15 import java.util.Date; 16 16 17 import org.junit. After;18 import org.junit. Before;19 import org.junit. Rule;20 import org.junit. Test;17 import org.junit.jupiter.api.AfterEach; 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.data.coor.LatLon; 22 22 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 29 29 * Unit tests for class {@link DataSetMerger}. 30 30 */ 31 publicclass DataSetMergerTest {31 class DataSetMergerTest { 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(); … … 44 44 * Setup test. 45 45 */ 46 @Before 46 @BeforeEach 47 47 public void setUp() { 48 48 my = new DataSet(); … … 67 67 } 68 68 69 @After 69 @AfterEach 70 70 public void checkDatasets() { 71 71 runConsistencyTests(my); … … 80 80 */ 81 81 @Test 82 publicvoid testNodeSimpleIdenticalNoConflict() {82 void testNodeSimpleIdenticalNoConflict() { 83 83 Node n = new Node(LatLon.ZERO); 84 84 n.setOsmId(1, 1); … … 114 114 */ 115 115 @Test 116 publicvoid testNodeSimpleLocallyUnmodifiedNoConflict() {116 void testNodeSimpleLocallyUnmodifiedNoConflict() { 117 117 Node n = new Node(LatLon.ZERO); 118 118 n.setOsmId(1, 1); … … 154 154 */ 155 155 @Test 156 publicvoid testNodeSimpleTagConflict() {156 void testNodeSimpleTagConflict() { 157 157 Node n = new Node(LatLon.ZERO); 158 158 n.setOsmId(1, 1); … … 188 188 */ 189 189 @Test 190 publicvoid testNodeSimpleDeleteConflict() {190 void testNodeSimpleDeleteConflict() { 191 191 Node n = new Node(1, 1); 192 192 n.setCoor(LatLon.ZERO); … … 218 218 */ 219 219 @Test 220 publicvoid testNodeSimpleDeleteConflict2() {220 void testNodeSimpleDeleteConflict2() { 221 221 Node n = new Node(LatLon.ZERO); 222 222 n.setOsmId(1, 1); … … 246 246 */ 247 247 @Test 248 publicvoid testNodeSimpleDeleteConflict3() {248 void testNodeSimpleDeleteConflict3() { 249 249 Node n = new Node(new LatLon(1, 1)); 250 250 n.setDeleted(true); … … 269 269 */ 270 270 @Test 271 publicvoid testNodeSimpleDeleteConflict4() {271 void testNodeSimpleDeleteConflict4() { 272 272 Node n = new Node(new LatLon(1, 1)); 273 273 n.setDeleted(true); … … 294 294 */ 295 295 @Test 296 publicvoid testNodeSimpleNoIdSemanticallyEqual() {296 void testNodeSimpleNoIdSemanticallyEqual() { 297 297 298 298 User myUser = User.createOsmUser(1111, "my"); … … 334 334 */ 335 335 @Test 336 publicvoid testNodeSimpleIncompleteNode() {336 void testNodeSimpleIncompleteNode() { 337 337 338 338 Node n = new Node(1); … … 364 364 */ 365 365 @Test 366 publicvoid testWaySimpleIdenticalNodesDifferentTags() {366 void testWaySimpleIdenticalNodesDifferentTags() { 367 367 368 368 // -- the target dataset … … 436 436 */ 437 437 @Test 438 publicvoid testWaySimpleAdditionalNodesAndChangedNodes() {438 void testWaySimpleAdditionalNodesAndChangedNodes() { 439 439 440 440 // -- my data set … … 505 505 */ 506 506 @Test 507 publicvoid testWaySimpleDifferentNodesAndMyIsModified() {507 void testWaySimpleDifferentNodesAndMyIsModified() { 508 508 509 509 // -- the target dataset … … 569 569 */ 570 570 @Test 571 publicvoid testWaySimpleTheirVersionNotVisibleMyIsModified() {571 void testWaySimpleTheirVersionNotVisibleMyIsModified() { 572 572 573 573 Node mn1 = new Node(LatLon.ZERO); … … 611 611 */ 612 612 @Test 613 publicvoid testWaySimpleTwoWaysWithNoIdNodesWithId() {613 void testWaySimpleTwoWaysWithNoIdNodesWithId() { 614 614 615 615 // -- my data set … … 668 668 */ 669 669 @Test 670 publicvoid testWaySimpleTwoWaysWithNoIdNodesWithoutId() {670 void testWaySimpleTwoWaysWithNoIdNodesWithoutId() { 671 671 672 672 // -- my data set … … 723 723 */ 724 724 @Test 725 publicvoid testWayComplexMergingADeletedNode() {725 void testWayComplexMergingADeletedNode() { 726 726 727 727 // -- my dataset … … 777 777 */ 778 778 @Test 779 publicvoid testRelationComplexMergingADeletedNode() {779 void testRelationComplexMergingADeletedNode() { 780 780 781 781 Node mn1 = new Node(LatLon.ZERO); … … 826 826 */ 827 827 @Test 828 publicvoid testNewIncompleteWay() {828 void testNewIncompleteWay() { 829 829 830 830 Node n1 = new Node(1); … … 868 868 */ 869 869 @Test 870 publicvoid testIncompleteWayOntoCompleteWay() {870 void testIncompleteWayOntoCompleteWay() { 871 871 872 872 // an incomplete node … … 923 923 */ 924 924 @Test 925 publicvoid testTwoCompleteNodesOntoAnIncompleteWay() {925 void testTwoCompleteNodesOntoAnIncompleteWay() { 926 926 927 927 // -- source dataset … … 1009 1009 */ 1010 1010 @Test 1011 publicvoid testTicket07481ab() {1011 void testTicket07481ab() { 1012 1012 doTestTicket7481(my, their); 1013 1013 } … … 1017 1017 */ 1018 1018 @Test 1019 publicvoid testTicket07481ba() {1019 void testTicket07481ba() { 1020 1020 doTestTicket7481(their, my); 1021 1021 } … … 1025 1025 */ 1026 1026 @Test 1027 publicvoid testTicket12599() {1027 void testTicket12599() { 1028 1028 // Server node: no modifications 1029 1029 Node n1 = new Node(1, 1); … … 1065 1065 */ 1066 1066 @Test 1067 publicvoid testTicket12616() {1067 void testTicket12616() { 1068 1068 // Server node: no modifications 1069 1069 Node n1 = new Node(1, 1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java
r17190 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.util.ArrayList; … … 12 12 13 13 import org.junit.Assert; 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.Bounds; … … 27 27 * Unit tests for class {@link DataSet}. 28 28 */ 29 publicclass DataSetTest {29 class DataSetTest { 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(); … … 40 40 */ 41 41 @Test 42 publicvoid testSearchRelations() {42 void testSearchRelations() { 43 43 final DataSet ds = new DataSet(); 44 44 // null bbox => empty list … … 72 72 */ 73 73 @Test 74 publicvoid testSearchPrimitives() {74 void testSearchPrimitives() { 75 75 final DataSet ds = new DataSet(); 76 76 // null bbox => empty list … … 99 99 */ 100 100 @Test 101 publicvoid testChangesetTags() {101 void testChangesetTags() { 102 102 final DataSet ds = new DataSet(); 103 103 assertTrue(ds.getChangeSetTags().isEmpty()); … … 112 112 */ 113 113 @Test 114 publicvoid testAllNonDeleted() {114 void testAllNonDeleted() { 115 115 final DataSet ds = new DataSet(); 116 116 assertTrue(ds.allNonDeletedPrimitives().isEmpty()); … … 142 142 */ 143 143 @Test 144 publicvoid testTicket14186() {144 void testTicket14186() { 145 145 final DataSet ds = new DataSet(); 146 146 Node n1 = new Node(1); … … 163 163 */ 164 164 @Test 165 publicvoid testTicket19438() {165 void testTicket19438() { 166 166 final DataSet ds = new DataSet(); 167 167 Node n1 = new Node(1); … … 184 184 */ 185 185 @Test 186 publicvoid testSelectionOrderPreserved() {186 void testSelectionOrderPreserved() { 187 187 final DataSet ds = new DataSet(); 188 188 Node n1 = new Node(1); … … 222 222 */ 223 223 @Test 224 publicvoid testCopyConstructor() {224 void testCopyConstructor() { 225 225 DataSet ds = new DataSet(); 226 226 assertEqualsDataSet(ds, new DataSet(ds)); … … 249 249 */ 250 250 @Test 251 publicvoid testMergePolicies() {251 void testMergePolicies() { 252 252 DataSet ds1 = new DataSet(); 253 253 DataSet ds2 = new DataSet(); … … 293 293 */ 294 294 @Test 295 publicvoid testEnumOrder() {295 void testEnumOrder() { 296 296 assertTrue(DownloadPolicy.BLOCKED.compareTo(DownloadPolicy.NORMAL) > 0); 297 297 assertTrue(UploadPolicy.BLOCKED.compareTo(UploadPolicy.NORMAL) > 0); … … 304 304 */ 305 305 @Test 306 publicvoid testAddDataSourceListener() {306 void testAddDataSourceListener() { 307 307 DataSourceListener addListener = new DataSourceListener() { 308 308 @Override … … 322 322 */ 323 323 @Test 324 publicvoid testRemoveDataSourceListener() {324 void testRemoveDataSourceListener() { 325 325 DataSourceListener removeListener = new DataSourceListener() { 326 326 @Override … … 340 340 */ 341 341 @Test 342 publicvoid testCloneReadOnly() {342 void testCloneReadOnly() { 343 343 DataSet ds = new DataSet(); 344 344 Node n1 = new Node(LatLon.SOUTH_POLE); -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.io.InputStream; … … 15 15 import java.util.List; 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.coor.LatLon; … … 33 33 * Unit tests for class {@link Filter}. 34 34 */ 35 publicclass FilterTest {35 class FilterTest { 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(); 43 43 44 44 @Test 45 publicvoid testBasic() throws SearchParseError {45 void testBasic() throws SearchParseError { 46 46 DataSet ds = new DataSet(); 47 47 Node n1 = new Node(LatLon.ZERO); … … 71 71 72 72 @Test 73 publicvoid testFilter() throws Exception {73 void testFilter() throws Exception { 74 74 for (int i : new int[] {1, 2, 3, 11, 12, 13, 14, 15}) { 75 75 DataSet ds; … … 197 197 */ 198 198 @Test 199 publicvoid testFilterPreferenceEntry() {199 void testFilterPreferenceEntry() { 200 200 Filter f = new Filter(); 201 201 FilterPreferenceEntry fpe = f.getPreferenceEntry(); … … 243 243 */ 244 244 @Test 245 publicvoid testEqualsContract() {245 void testEqualsContract() { 246 246 TestUtils.assumeWorkingEqualsVerifier(); 247 247 EqualsVerifier.forClass(FilterPreferenceEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r15130 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 5 6 6 import java.io.InputStream; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.io.OsmReader; … … 17 17 * Unit tests of the {@code MultipolygonBuilder} class. 18 18 */ 19 publicclass MultipolygonBuilderTest {19 class MultipolygonBuilderTest { 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().projection().timeout(15000); … … 31 31 */ 32 32 @Test 33 publicvoid testTicket12376() throws Exception {33 void testTicket12376() throws Exception { 34 34 try (InputStream is = TestUtils.getRegressionDataStream(12376, "multipolygon_hang.osm.bz2")) { 35 35 for (Relation r : OsmReader.parseDataSet(is, null).getRelations()) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeDataTest.java
r11324 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.ByteArrayInputStream; … … 12 12 13 13 import org.junit.Assert; 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 17 17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 18 18 19 publicclass NodeDataTest {19 class NodeDataTest { 20 20 21 21 @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION") … … 31 31 32 32 @Test 33 publicvoid testSerializationForDragAndDrop() throws Exception {33 void testSerializationForDragAndDrop() throws Exception { 34 34 final NodeData data = new NodeData(); 35 35 data.setCoor(new LatLon(31.14, 15.9)); … … 46 46 */ 47 47 @Test 48 publicvoid testTicket13395() throws Exception {48 void testTicket13395() throws Exception { 49 49 Node n = new Node(1925320646, 1); 50 50 n.setCoor(null); -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java
r12478 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.Arrays; … … 9 9 import java.util.List; 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.JOSMTestRules; 14 14 … … 18 18 * Unit tests of the {@code NodeGraph} class. 19 19 */ 20 publicclass NodeGraphTest {20 class NodeGraphTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 31 31 */ 32 32 @Test 33 publicvoid testNodePairs() {33 void testNodePairs() { 34 34 assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), true).isEmpty()); 35 35 assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), false).isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java
r16077 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.assertNull; 8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 import static org.junit.jupiter.api.Assertions.assertThrows; 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.Bounds; 13 14 import org.openstreetmap.josm.data.DataSource; … … 21 22 * Unit tests of the {@code Node} class. 22 23 */ 23 publicclass NodeTest {24 class NodeTest { 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(); … … 34 35 */ 35 36 @Test 36 publicvoid testTicket12060() {37 void testTicket12060() { 37 38 DataSet ds = new DataSet(); 38 39 ds.addDataSource(new DataSource(new Bounds(LatLon.ZERO), null)); … … 51 52 */ 52 53 @Test 53 publicvoid testBBox() {54 void testBBox() { 54 55 DataSet ds = new DataSet(); 55 56 Node n1 = new Node(1); … … 85 86 * Test that {@link Node#cloneFrom} throws IAE for invalid arguments 86 87 */ 87 @Test (expected = IllegalArgumentException.class)88 publicvoid testCloneFromIAE() {89 new Node().cloneFrom(new Way());88 @Test 89 void testCloneFromIAE() { 90 assertThrows(IllegalArgumentException.class, () -> new Node().cloneFrom(new Way())); 90 91 } 91 92 … … 93 94 * Test that {@link Node#mergeFrom} throws IAE for invalid arguments 94 95 */ 95 @Test (expected = IllegalArgumentException.class)96 publicvoid testMergeFromIAE() {97 new Node().mergeFrom(new Way());96 @Test 97 void testMergeFromIAE() { 98 assertThrows(IllegalArgumentException.class, () -> new Node().mergeFrom(new Way())); 98 99 } 99 100 … … 101 102 * Test that {@link Node#load} throws IAE for invalid arguments 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 publicvoid testLoadIAE() {105 new Node().load(new WayData());104 @Test 105 void testLoadIAE() { 106 assertThrows(IllegalArgumentException.class, () -> new Node().load(new WayData())); 106 107 } 107 108 … … 110 111 */ 111 112 @Test 112 publicvoid testOutsideWorld() {113 void testOutsideWorld() { 113 114 Node n = new Node(1, 1); 114 115 n.setCoor(LatLon.ZERO); … … 134 135 */ 135 136 @Test 136 publicvoid testDirectional() {137 void testDirectional() { 137 138 assertFalse(OsmUtils.createPrimitive("node oneway=yes").hasDirectionKeys()); 138 139 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java
r14101 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 import org.openstreetmap.josm.data.notes.Note; … … 13 13 * Unit tests of the {@code NoteData} class. 14 14 */ 15 publicclass NoteDataTest {15 class NoteDataTest { 16 16 17 17 /** … … 19 19 */ 20 20 @Test 21 publicvoid testNoteData() {21 void testNoteData() { 22 22 NoteData empty = new NoteData(); 23 23 assertEquals(0, empty.getNotes().size()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
r11933 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 17 17 * {@link Node} for the tests, {@link OsmPrimitive} is abstract. 18 18 */ 19 publicclass OsmPrimitiveKeyHandlingTest {19 class OsmPrimitiveKeyHandlingTest { 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 testEmptyNode() {32 void testEmptyNode() { 33 33 Node n = new Node(); 34 34 testKeysSize(n, 0); … … 44 44 */ 45 45 @Test 46 publicvoid testPut() {46 void testPut() { 47 47 Node n = new Node(); 48 48 n.put("akey", "avalue"); … … 56 56 */ 57 57 @Test 58 publicvoid testPut2() {58 void testPut2() { 59 59 Node n = new Node(); 60 60 n.put("key.1", "value.1"); … … 74 74 @Test 75 75 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test that equals is used and not ==") 76 publicvoid testRemove() {76 void testRemove() { 77 77 Node n = new Node(); 78 78 n.put("key.1", "value.1"); … … 106 106 */ 107 107 @Test 108 publicvoid testRemoveAll() {108 void testRemoveAll() { 109 109 Node n = new Node(); 110 110 … … 121 121 */ 122 122 @Test 123 publicvoid testHasEqualSemanticAttributes() {123 void testHasEqualSemanticAttributes() { 124 124 Node n1 = new Node(1); 125 125 n1.setCoor(LatLon.ZERO); … … 139 139 */ 140 140 @Test 141 publicvoid testHasEqualSemanticAttributes2() {141 void testHasEqualSemanticAttributes2() { 142 142 Node n1 = new Node(1); 143 143 n1.setCoor(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r16913 r17275 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import static org.junit.jupiter.api.Assertions.assertThrows; 3 5 4 6 import java.util.Arrays; … … 6 8 7 9 import org.junit.Assert; 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 11 13 import org.openstreetmap.josm.data.coor.LatLon; 12 14 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 19 21 * Unit tests of the {@code OsmPrimitive} class. 20 22 */ 21 publicclass OsmPrimitiveTest {23 class OsmPrimitiveTest { 22 24 23 25 /** 24 26 * Setup test. 25 27 */ 26 @R ule28 @RegisterExtension 27 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 30 public JOSMTestRules test = new JOSMTestRules(); … … 38 40 * Setup test. 39 41 */ 40 @Before Class42 @BeforeAll 41 43 public static void setUp() { 42 44 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator … … 44 46 45 47 @Test 46 publicvoid testSimpleReferrersTest() {48 void testSimpleReferrersTest() { 47 49 Node n1 = new Node(LatLon.ZERO); 48 50 Way w1 = new Way(); … … 54 56 55 57 @Test 56 publicvoid testAddAndRemoveReferrer() {58 void testAddAndRemoveReferrer() { 57 59 Node n1 = new Node(LatLon.ZERO); 58 60 Node n2 = new Node(LatLon.ZERO); … … 70 72 71 73 @Test 72 publicvoid testMultipleReferrers() {74 void testMultipleReferrers() { 73 75 Node n1 = new Node(LatLon.ZERO); 74 76 Way w1 = new Way(); … … 86 88 87 89 @Test 88 publicvoid testRemoveMemberFromRelationReferrerTest() {90 void testRemoveMemberFromRelationReferrerTest() { 89 91 Node n1 = new Node(LatLon.ZERO); 90 92 Relation r1 = new Relation(); … … 98 100 99 101 @Test 100 publicvoid testSetRelationMemberReferrerTest() {102 void testSetRelationMemberReferrerTest() { 101 103 Node n1 = new Node(LatLon.ZERO); 102 104 Node n2 = new Node(LatLon.ZERO); … … 115 117 116 118 @Test 117 publicvoid testRemovePrimitiveReferrerTest() {119 void testRemovePrimitiveReferrerTest() { 118 120 Node n1 = new Node(LatLon.ZERO); 119 121 Way w1 = new Way(); … … 137 139 138 140 @Test 139 publicvoid testNodeFromMultipleDatasets() {141 void testNodeFromMultipleDatasets() { 140 142 // n has two referrers - w1 and w2. But only w1 is returned because it is in the same dataset as n 141 143 Node n = new Node(LatLon.ZERO); … … 151 153 } 152 154 153 @Test (expected = DataIntegrityProblemException.class)154 publicvoid testCheckMustBeInDatasate() {155 @Test 156 void testCheckMustBeInDatasate() { 155 157 Node n = new Node(); 156 n.getReferrers();158 assertThrows(DataIntegrityProblemException.class, () -> n.getReferrers()); 157 159 } 158 160 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java
r12027 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 6 import static org.junit.Assert.assertTrue; 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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.Collection; 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.TestUtils; 13 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 19 * Unit tests of the {@code OsmPrimitiveType} class. 19 20 */ 20 publicclass OsmPrimitiveTypeTest {21 class OsmPrimitiveTypeTest { 21 22 22 23 /** 23 24 * Setup test. 24 25 */ 25 @R ule26 @RegisterExtension 26 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 28 public JOSMTestRules test = new JOSMTestRules(); … … 31 32 */ 32 33 @Test 33 publicvoid testEnum() {34 void testEnum() { 34 35 TestUtils.superficialEnumCodeCoverage(OsmPrimitiveType.class); 35 36 } … … 39 40 */ 40 41 @Test 41 publicvoid testGetApiName() {42 void testGetApiName() { 42 43 assertEquals("node", OsmPrimitiveType.NODE.getAPIName()); 43 44 assertEquals("way", OsmPrimitiveType.WAY.getAPIName()); … … 49 50 */ 50 51 @Test 51 publicvoid testGetOsmClass() {52 void testGetOsmClass() { 52 53 assertEquals(Node.class, OsmPrimitiveType.NODE.getOsmClass()); 53 54 assertEquals(Way.class, OsmPrimitiveType.WAY.getOsmClass()); … … 61 62 */ 62 63 @Test 63 publicvoid testGetDataClass() {64 void testGetDataClass() { 64 65 assertEquals(NodeData.class, OsmPrimitiveType.NODE.getDataClass()); 65 66 assertEquals(WayData.class, OsmPrimitiveType.WAY.getDataClass()); … … 73 74 */ 74 75 @Test 75 publicvoid testFromApiTypeName() {76 void testFromApiTypeName() { 76 77 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.fromApiTypeName("node")); 77 78 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.fromApiTypeName("way")); … … 82 83 * Unit test of {@link OsmPrimitiveType#fromApiTypeName} method - error case. 83 84 */ 84 @Test (expected = IllegalArgumentException.class)85 publicvoid testFromApiTypeNameError() {86 OsmPrimitiveType.fromApiTypeName("foo");85 @Test 86 void testFromApiTypeNameError() { 87 assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.fromApiTypeName("foo")); 87 88 } 88 89 … … 91 92 */ 92 93 @Test 93 publicvoid testFromIPrimitive() {94 void testFromIPrimitive() { 94 95 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from(new Node())); 95 96 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from(new Way())); … … 100 101 * Unit test of {@link OsmPrimitiveType#from(IPrimitive)} method - error case. 101 102 */ 102 @Test (expected = IllegalArgumentException.class)103 publicvoid testFromIPrimitiveError() {104 OsmPrimitiveType.from((IPrimitive) null);103 @Test 104 void testFromIPrimitiveError() { 105 assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.from((IPrimitive) null)); 105 106 } 106 107 … … 109 110 */ 110 111 @Test 111 publicvoid testFromString() {112 void testFromString() { 112 113 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from("node")); 113 114 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from("WAY")); … … 122 123 */ 123 124 @Test 124 publicvoid testDataValues() {125 void testDataValues() { 125 126 Collection<OsmPrimitiveType> values = OsmPrimitiveType.dataValues(); 126 127 assertEquals(3, values.size()); … … 134 135 */ 135 136 @Test 136 publicvoid testNewInstance() {137 void testNewInstance() { 137 138 OsmPrimitive n = OsmPrimitiveType.NODE.newInstance(1, false); 138 139 OsmPrimitive w = OsmPrimitiveType.WAY.newInstance(2, false); … … 151 152 * Unit test of {@link OsmPrimitiveType#newInstance} method - error case. 152 153 */ 153 @Test (expected = AssertionError.class)154 publicvoid testNewInstanceError() {155 OsmPrimitiveType.CLOSEDWAY.newInstance(1, false);154 @Test 155 void testNewInstanceError() { 156 assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newInstance(1, false)); 156 157 } 157 158 … … 160 161 */ 161 162 @Test 162 publicvoid testNewVersionedInstance() {163 void testNewVersionedInstance() { 163 164 OsmPrimitive n = OsmPrimitiveType.NODE.newVersionedInstance(1, 4); 164 165 OsmPrimitive w = OsmPrimitiveType.WAY.newVersionedInstance(2, 5); … … 181 182 * Unit test of {@link OsmPrimitiveType#newVersionedInstance} method - error case. 182 183 */ 183 @Test (expected = AssertionError.class)184 publicvoid testNewVersionedInstanceError() {185 OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0);184 @Test 185 void testNewVersionedInstanceError() { 186 assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0)); 186 187 } 187 188 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java
r15951 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.Arrays; 10 11 import java.util.stream.Collectors; 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.JOSMTestRules; 15 16 … … 19 20 * Unit tests for class {@link OsmUtils}. 20 21 */ 21 publicclass OsmUtilsTest {22 class OsmUtilsTest { 22 23 23 24 /** 24 25 * Setup test. 25 26 */ 26 @R ule27 @RegisterExtension 27 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 29 public JOSMTestRules test = new JOSMTestRules(); … … 32 33 */ 33 34 @Test 34 publicvoid testCreatePrimitive() {35 void testCreatePrimitive() { 35 36 final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail"); 36 37 assertTrue(p instanceof Way); … … 44 45 */ 45 46 @Test 46 publicvoid testArea() {47 void testArea() { 47 48 final OsmPrimitive p = OsmUtils.createPrimitive("area name=Foo railway=rail"); 48 49 assertEquals(OsmPrimitiveType.WAY, p.getType()); … … 53 54 * Unit test of {@link OsmUtils#createPrimitive} 54 55 */ 55 @Test (expected = IllegalArgumentException.class)56 publicvoid testCreatePrimitiveFail() {57 OsmUtils.createPrimitive("noway name=Foo");56 @Test 57 void testCreatePrimitiveFail() { 58 assertThrows(IllegalArgumentException.class, () -> OsmUtils.createPrimitive("noway name=Foo")); 58 59 } 59 60 … … 62 63 */ 63 64 @Test 64 publicvoid testSplitMultipleValues() {65 void testSplitMultipleValues() { 65 66 // examples from https://wiki.openstreetmap.org/wiki/Semi-colon_value_separator 66 67 assertEquals(Arrays.asList("B500", "B550"), OsmUtils.splitMultipleValues("B500;B550").collect(Collectors.toList())); … … 74 75 */ 75 76 @Test 76 publicvoid testTrueFalse() {77 void testTrueFalse() { 77 78 assertFalse(OsmUtils.isTrue(null)); 78 79 assertFalse(OsmUtils.isFalse(null)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r16547 r17275 16 16 17 17 import org.junit.Assert; 18 import org.junit. Rule;19 import org.junit. Test;18 import org.junit.jupiter.api.extension.RegisterExtension; 19 import org.junit.jupiter.api.Test; 20 20 import org.openstreetmap.josm.data.coor.LatLon; 21 21 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 30 30 * Unit tests of {@link QuadBuckets}. 31 31 */ 32 publicclass QuadBucketsTest {32 class QuadBucketsTest { 33 33 34 34 /** 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules(); … … 83 83 */ 84 84 @Test 85 publicvoid testRemove() throws Exception {85 void testRemove() throws Exception { 86 86 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 87 87 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) { … … 96 96 */ 97 97 @Test 98 publicvoid testMove() throws Exception {98 void testMove() throws Exception { 99 99 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 100 100 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) { … … 113 113 */ 114 114 @Test 115 publicvoid testSpecialBBox() {115 void testSpecialBBox() { 116 116 QuadBuckets<Node> qbNodes = new QuadBuckets<>(); 117 117 QuadBuckets<Way> qbWays = new QuadBuckets<>(); … … 195 195 */ 196 196 @Test 197 publicvoid testSplitsWithIncompleteData() {197 void testSplitsWithIncompleteData() { 198 198 DataSet ds = new DataSet(); 199 199 long nodeId = 1; -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r11383 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import org.junit.Assert; 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.coor.LatLon; 12 13 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 16 16 publicclass RelationTest {17 class RelationTest { 17 18 18 19 /** 19 20 * Setup test. 20 21 */ 21 @R ule22 @RegisterExtension 22 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 24 public JOSMTestRules test = new JOSMTestRules(); 24 25 25 @Test (expected = NullPointerException.class)26 publicvoid testCreateNewRelation() {27 new Relation(null);26 @Test 27 void testCreateNewRelation() { 28 assertThrows(NullPointerException.class, () -> new Relation(null)); 28 29 } 29 30 30 31 @Test 31 publicvoid testEqualSemanticsToNull() {32 void testEqualSemanticsToNull() { 32 33 Relation relation = new Relation(); 33 34 assertFalse(relation.hasEqualTechnicalAttributes(null)); … … 35 36 36 37 @Test 37 publicvoid testBbox() {38 void testBbox() { 38 39 DataSet ds = new DataSet(); 39 40 … … 88 89 89 90 @Test 90 publicvoid testBBoxNotInDataset() {91 void testBBoxNotInDataset() { 91 92 Node n1 = new Node(new LatLon(10, 10)); 92 93 Node n2 = new Node(new LatLon(20, 20)); … … 122 123 */ 123 124 @Test 124 publicvoid testTicket12467() throws Exception {125 void testTicket12467() throws Exception { 125 126 Relation r = new Relation(); 126 127 r.put("type", "boundary"); … … 143 144 * Test that {@link Relation#cloneFrom} throws IAE for invalid arguments 144 145 */ 145 @Test (expected = IllegalArgumentException.class)146 publicvoid testCloneFromIAE() {147 new Relation().cloneFrom(new Node());146 @Test 147 void testCloneFromIAE() { 148 assertThrows(IllegalArgumentException.class, () -> new Relation().cloneFrom(new Node())); 148 149 } 149 150 … … 151 152 * Test that {@link Relation#load} throws IAE for invalid arguments 152 153 */ 153 @Test (expected = IllegalArgumentException.class)154 publicvoid testLoadIAE() {155 new Relation().load(new NodeData());154 @Test 155 void testLoadIAE() { 156 assertThrows(IllegalArgumentException.class, () -> new Relation().load(new NodeData())); 156 157 } 157 158 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/SimplePrimitiveIdTest.java
r13969 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 7 8 8 9 /** 9 10 * Unit tests of {@link SimplePrimitiveId} class. 10 11 */ 11 publicclass SimplePrimitiveIdTest {12 class SimplePrimitiveIdTest { 12 13 13 14 /** … … 15 16 */ 16 17 @Test 17 publicvoid testFromStringNode() {18 void testFromStringNode() { 18 19 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node/123")); 19 20 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("n123")); … … 26 27 */ 27 28 @Test 28 publicvoid testFromStringWay() {29 void testFromStringWay() { 29 30 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way/123")); 30 31 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("w123")); … … 37 38 */ 38 39 @Test 39 publicvoid testFromStringRelation() {40 void testFromStringRelation() { 40 41 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("relation/123")); 41 42 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("r123")); … … 47 48 * Unit test of {@link SimplePrimitiveId#fromString} for invalid input. 48 49 */ 49 @Test (expected = IllegalArgumentException.class)50 publicvoid testFromStringBad() {51 SimplePrimitiveId.fromString("foobar");50 @Test 51 void testFromStringBad() { 52 assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.fromString("foobar")); 52 53 } 53 54 … … 56 57 */ 57 58 @Test 58 publicvoid testFuzzyParse() {59 void testFuzzyParse() { 59 60 assertEquals("[relation 123]", 60 61 SimplePrimitiveId.fuzzyParse("foo relation/123 bar").toString()); … … 68 69 69 70 @Test 70 publicvoid testFromCopyAction() {71 void testFromCopyAction() { 71 72 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node 123")); 72 73 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way 123")); … … 78 79 */ 79 80 @Test 80 publicvoid testMultipleFromString() {81 void testMultipleFromString() { 81 82 assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234").toString()); 82 83 assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234-234").toString()); … … 101 102 * Unit test of {@link SimplePrimitiveId#multipleFromString} for invalid data. 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 publicvoid testMultipleFromStringBad() {105 SimplePrimitiveId.multipleFromString("foo node123 bar");104 @Test 105 void testMultipleFromStringBad() { 106 assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.multipleFromString("foo node123 bar")); 106 107 } 107 108 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.osm; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link Storage}. 15 15 */ 16 publicclass StorageTest {16 class StorageTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 EqualsVerifier.forClass(Storage.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java
r16643 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.util.Arrays; … … 17 17 import java.util.stream.Stream; 18 18 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 22 … … 27 27 * @author Michael Zangl 28 28 */ 29 publicclass TagCollectionTest {29 class TagCollectionTest { 30 30 private final Tag tagA = new Tag("k", "v"); 31 31 private final Tag tagB = new Tag("k", "b"); … … 39 39 * We need prefs for using primitives 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 54 54 */ 55 55 @Test 56 publicvoid testFromTagged() {56 void testFromTagged() { 57 57 TagCollection c = TagCollection.from(tagA); 58 58 assertTagCounts(c, 1, 0, 0, 0); … … 72 72 */ 73 73 @Test 74 publicvoid testFromMapOfStringString() {74 void testFromMapOfStringString() { 75 75 TagCollection c = TagCollection.from(tagA.getKeys()); 76 76 assertTagCounts(c, 1, 0, 0, 0); … … 90 90 */ 91 91 @Test 92 publicvoid testUnionOfAllPrimitivesCollectionOfQextendsTagged() {92 void testUnionOfAllPrimitivesCollectionOfQextendsTagged() { 93 93 TagCollection c = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA)); 94 94 assertEquals(1, c.getTagOccurrence(tagA)); … … 111 111 */ 112 112 @Test 113 publicvoid testTagCollection() {113 void testTagCollection() { 114 114 TagCollection c = new TagCollection(); 115 115 assertTagCounts(c, 0, 0, 0, 0); … … 120 120 */ 121 121 @Test 122 publicvoid testTagCollectionTagCollection() {122 void testTagCollectionTagCollection() { 123 123 TagCollection blueprint = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA, tagC, tagC)); 124 124 TagCollection c = new TagCollection(blueprint); … … 133 133 */ 134 134 @Test 135 publicvoid testTagCollectionCollectionOfTag() {135 void testTagCollectionCollectionOfTag() { 136 136 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 137 137 assertTagCounts(c, 1, 0, 2, 0); … … 145 145 */ 146 146 @Test 147 publicvoid testSize() {147 void testSize() { 148 148 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 149 149 assertEquals(2, c.size()); … … 157 157 */ 158 158 @Test 159 publicvoid testIsEmpty() {159 void testIsEmpty() { 160 160 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 161 161 assertFalse(c.isEmpty()); … … 169 169 */ 170 170 @Test 171 publicvoid testAddTag() {171 void testAddTag() { 172 172 TagCollection c = new TagCollection(); 173 173 assertTagCounts(c, 0, 0, 0, 0); … … 182 182 183 183 /** 184 * Test method for {@link TagCollection#getTagOccur ence(Tag)}.185 */ 186 @Test 187 publicvoid testGetTagCount() {184 * Test method for {@link TagCollection#getTagOccurrence}. 185 */ 186 @Test 187 void testGetTagCount() { 188 188 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 189 189 assertEquals(2, c.getTagOccurrence(tagC)); … … 197 197 */ 198 198 @Test 199 publicvoid testAddCollectionOfTag() {199 void testAddCollectionOfTag() { 200 200 TagCollection c = new TagCollection(); 201 201 assertTagCounts(c, 0, 0, 0, 0); … … 214 214 */ 215 215 @Test 216 publicvoid testAddTagCollection() {216 void testAddTagCollection() { 217 217 TagCollection c = new TagCollection(); 218 218 assertTagCounts(c, 0, 0, 0, 0); … … 231 231 */ 232 232 @Test 233 publicvoid testRemoveTag() {233 void testRemoveTag() { 234 234 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 235 235 assertTagCounts(c, 1, 0, 2, 0); … … 246 246 */ 247 247 @Test 248 publicvoid testRemoveCollectionOfTag() {248 void testRemoveCollectionOfTag() { 249 249 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 250 250 assertTagCounts(c, 1, 0, 2, 0); … … 259 259 */ 260 260 @Test 261 publicvoid testRemoveTagCollection() {261 void testRemoveTagCollection() { 262 262 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 263 263 assertTagCounts(c, 1, 0, 2, 0); … … 274 274 */ 275 275 @Test 276 publicvoid testRemoveByKeyString() {276 void testRemoveByKeyString() { 277 277 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC)); 278 278 assertTagCounts(c, 1, 2, 1, 0); … … 287 287 */ 288 288 @Test 289 publicvoid testRemoveByKeyCollectionOfString() {289 void testRemoveByKeyCollectionOfString() { 290 290 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC, tagD)); 291 291 assertTagCounts(c, 1, 2, 1, 1); … … 300 300 */ 301 301 @Test 302 publicvoid testContains() {302 void testContains() { 303 303 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB)); 304 304 assertTrue(c.contains(tagA)); … … 311 311 */ 312 312 @Test 313 publicvoid testContainsAll() {313 void testContainsAll() { 314 314 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB)); 315 315 assertTrue(c.containsAll(Arrays.asList(tagA, tagB))); … … 323 323 */ 324 324 @Test 325 publicvoid testContainsAllKeys() {325 void testContainsAllKeys() { 326 326 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 327 327 assertTrue(c.containsAllKeys(Arrays.asList("k", "k2"))); … … 335 335 */ 336 336 @Test 337 publicvoid testGetNumTagsFor() {337 void testGetNumTagsFor() { 338 338 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 339 339 assertEquals(2, c.getNumTagsFor("k")); … … 346 346 */ 347 347 @Test 348 publicvoid testHasTagsFor() {348 void testHasTagsFor() { 349 349 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 350 350 assertTrue(c.hasTagsFor("k")); … … 357 357 */ 358 358 @Test 359 publicvoid testHasValuesFor() {359 void testHasValuesFor() { 360 360 TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty)); 361 361 assertFalse(c.hasValuesFor("k")); … … 368 368 */ 369 369 @Test 370 publicvoid testHasUniqueNonEmptyValue() {370 void testHasUniqueNonEmptyValue() { 371 371 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty)); 372 372 assertTrue(c.hasUniqueNonEmptyValue("k")); … … 384 384 */ 385 385 @Test 386 publicvoid testHasEmptyValue() {386 void testHasEmptyValue() { 387 387 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty)); 388 388 assertTrue(c.hasEmptyValue("k")); … … 395 395 */ 396 396 @Test 397 publicvoid testHasUniqueEmptyValue() {397 void testHasUniqueEmptyValue() { 398 398 TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty)); 399 399 assertTrue(c.hasUniqueEmptyValue("k")); … … 411 411 */ 412 412 @Test 413 publicvoid testGetTagsForString() {413 void testGetTagsForString() { 414 414 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty)); 415 415 TagCollection collection = d.getTagsFor("k"); … … 422 422 */ 423 423 @Test 424 publicvoid testGetTagsForCollectionOfString() {424 void testGetTagsForCollectionOfString() { 425 425 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty)); 426 426 TagCollection collection = d.getTagsFor(Arrays.asList("k", "k2")); … … 433 433 */ 434 434 @Test 435 publicvoid testAsSet() {435 void testAsSet() { 436 436 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 437 437 Set<Tag> set = d.asSet(); … … 446 446 */ 447 447 @Test 448 publicvoid testAsList() {448 void testAsList() { 449 449 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 450 450 List<Tag> set = d.asList(); … … 459 459 */ 460 460 @Test 461 publicvoid testIterator() {461 void testIterator() { 462 462 TagCollection d = new TagCollection(Arrays.asList(tagA)); 463 463 Iterator<Tag> it = d.iterator(); … … 471 471 */ 472 472 @Test 473 publicvoid testGetKeys() {473 void testGetKeys() { 474 474 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 475 475 Set<String> set = d.getKeys(); … … 483 483 */ 484 484 @Test 485 publicvoid testGetKeysWithMultipleValues() {485 void testGetKeysWithMultipleValues() { 486 486 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 487 487 Set<String> set = d.getKeysWithMultipleValues(); … … 494 494 */ 495 495 @Test 496 publicvoid testSetUniqueForKeyTag() {496 void testSetUniqueForKeyTag() { 497 497 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC)); 498 498 assertTagCounts(d, 2, 1, 2, 0); … … 505 505 */ 506 506 @Test 507 publicvoid testSetUniqueForKeyStringString() {507 void testSetUniqueForKeyStringString() { 508 508 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC)); 509 509 assertTagCounts(d, 2, 1, 2, 0); … … 516 516 */ 517 517 @Test 518 publicvoid testGetValues() {518 void testGetValues() { 519 519 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagEmpty)); 520 520 Set<String> set = d.getValues(); … … 529 529 */ 530 530 @Test 531 publicvoid testGetValuesString() {531 void testGetValuesString() { 532 532 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagC, tagEmpty)); 533 533 Set<String> set = d.getValues("k"); … … 541 541 */ 542 542 @Test 543 publicvoid testIsApplicableToPrimitive() {543 void testIsApplicableToPrimitive() { 544 544 TagCollection c = new TagCollection(); 545 545 assertTrue(c.isApplicableToPrimitive()); … … 554 554 */ 555 555 @Test 556 publicvoid testApplyToTagged() {556 void testApplyToTagged() { 557 557 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 558 558 NodeData tagged = new NodeData(); … … 572 572 */ 573 573 @Test 574 publicvoid testApplyToCollectionOfQextendsTagged() {574 void testApplyToCollectionOfQextendsTagged() { 575 575 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 576 576 NodeData tagged = new NodeData(); … … 590 590 */ 591 591 @Test 592 publicvoid testReplaceTagsOfTagged() {592 void testReplaceTagsOfTagged() { 593 593 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 594 594 NodeData tagged = new NodeData(); … … 605 605 */ 606 606 @Test 607 publicvoid testReplaceTagsOfCollectionOfQextendsTagged() {607 void testReplaceTagsOfCollectionOfQextendsTagged() { 608 608 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 609 609 NodeData tagged = new NodeData(); … … 623 623 */ 624 624 @Test 625 publicvoid testIntersect() {625 void testIntersect() { 626 626 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 627 627 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 636 636 */ 637 637 @Test 638 publicvoid testMinus() {638 void testMinus() { 639 639 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 640 640 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 649 649 */ 650 650 @Test 651 publicvoid testUnion() {651 void testUnion() { 652 652 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 653 653 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 664 664 */ 665 665 @Test 666 publicvoid testEmptyTagsForKeysMissingIn() {666 void testEmptyTagsForKeysMissingIn() { 667 667 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 668 668 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 677 677 */ 678 678 @Test 679 publicvoid testGetJoinedValues() {679 void testGetJoinedValues() { 680 680 TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "a"))); 681 681 assertEquals("a", c.getJoinedValues("k")); … … 696 696 */ 697 697 @Test 698 publicvoid testGetSummedValues() {698 void testGetSummedValues() { 699 699 TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "10"), new Tag("k", "20"))); 700 700 assertEquals("30", c.getSummedValues("k")); … … 711 711 */ 712 712 @Test 713 publicvoid testCommonToAllPrimitives() {713 void testCommonToAllPrimitives() { 714 714 Tagged t1 = new Node(); 715 715 t1.put("k1", "10"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/TagMapTest.java
r9969 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 8 8 /** 9 9 * Unit tests of the {@code TagMap} class. 10 10 */ 11 publicclass TagMapTest {11 class TagMapTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testToString() {17 void testToString() { 18 18 assertEquals("TagMap[]", new TagMap().toString()); 19 19 assertEquals("TagMap[key=val]", new TagMap(new String[]{"key", "val"}).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/UserTest.java
r12750 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertSame;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Tests of {@link User}. 16 16 */ 17 publicclass UserTest {17 class UserTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testCreateOsmUser() {30 void testCreateOsmUser() { 31 31 User user1 = User.createOsmUser(1, "name1"); 32 32 assertEquals(1, user1.getId()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java
r13907 r17275 9 9 10 10 import org.junit.Assert; 11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 12 13 13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 14 15 publicclass WayDataTest {15 class WayDataTest { 16 16 17 17 @Test 18 18 @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION") 19 publicvoid testSerializationForDragAndDrop() throws Exception {19 void testSerializationForDragAndDrop() throws Exception { 20 20 final WayData data = new WayData(); 21 21 data.setNodeIds(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java
r10945 r17275 5 5 6 6 import org.junit.Assert; 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.coor.LatLon; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 15 15 * Unit tests of the {@code WaySegment} class. 16 16 */ 17 publicclass WaySegmentTest {17 class WaySegmentTest { 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 test = new JOSMTestRules(); 25 25 26 26 @Test 27 publicvoid testForNodePair() throws Exception {27 void testForNodePair() throws Exception { 28 28 final DataSet ds = new DataSet(); 29 29 final Node n1 = new Node(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WayTest.java
r17186 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.Arrays; 9 10 import java.util.HashSet; 10 11 11 import org.junit. BeforeClass;12 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 13 14 import org.openstreetmap.josm.JOSMFixture; 14 15 import org.openstreetmap.josm.data.coor.LatLon; … … 18 19 * @since 11270 19 20 */ 20 publicclass WayTest {21 class WayTest { 21 22 22 23 /** 23 24 * Setup test. 24 25 */ 25 @Before Class26 @BeforeAll 26 27 public static void setUpBeforeClass() { 27 28 JOSMFixture.createUnitTestFixture().init(); … … 32 33 */ 33 34 @Test 34 publicvoid testBBox() {35 void testBBox() { 35 36 DataSet ds = new DataSet(); 36 37 Node n1 = new Node(1); … … 61 62 */ 62 63 @Test 63 publicvoid testRemoveNode() {64 void testRemoveNode() { 64 65 DataSet ds = new DataSet(); 65 66 Node n1 = new Node(1); … … 87 88 way.removeNode(n1); 88 89 assertEquals(Arrays.asList(n2, n3, n4, n2), way.getNodes()); 89 90 90 } 91 91 … … 94 94 */ 95 95 @Test 96 publicvoid testRemoveNodes() {96 void testRemoveNodes() { 97 97 DataSet ds = new DataSet(); 98 98 Node n1 = new Node(1); … … 123 123 * Test that {@link Way#cloneFrom} throws IAE for invalid arguments 124 124 */ 125 @Test (expected = IllegalArgumentException.class)126 publicvoid testCloneFromIAE() {127 new Way().cloneFrom(new Node());125 @Test 126 void testCloneFromIAE() { 127 assertThrows(IllegalArgumentException.class, () -> new Way().cloneFrom(new Node())); 128 128 } 129 129 … … 131 131 * Test that {@link Way#load} throws IAE for invalid arguments 132 132 */ 133 @Test (expected = IllegalArgumentException.class)134 publicvoid testLoadIAE() {135 new Way().load(new NodeData());133 @Test 134 void testLoadIAE() { 135 assertThrows(IllegalArgumentException.class, () -> new Way().load(new NodeData())); 136 136 } 137 137 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link ChangesetIdChangedEvent} class. 14 14 */ 15 publicclass ChangesetIdChangedEventTest {15 class ChangesetIdChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("CHANGESET_ID_CHANGED", new ChangesetIdChangedEvent(null, null, 0, 0).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link DataChangedEvent} class. 14 14 */ 15 publicclass DataChangedEventTest {15 class DataChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("DATA_CHANGED", new DataChangedEvent(null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceAddedEventTest.java
r15609 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.Collections; 8 8 import java.util.stream.Stream; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.Bounds; 12 12 import org.openstreetmap.josm.data.DataSource; … … 19 19 * @author Taylor Smock 20 20 */ 21 publicclass DataSourceAddedEventTest {21 class DataSourceAddedEventTest { 22 22 /** 23 23 * Get getting the originating data source 24 24 */ 25 25 @Test 26 publicvoid testGetDataEventSource() {26 void testGetDataEventSource() { 27 27 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 28 28 DataSet ds = new DataSet(); … … 34 34 */ 35 35 @Test 36 publicvoid testGetAddedSource() {36 void testGetAddedSource() { 37 37 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 38 38 assertTrue( … … 49 49 */ 50 50 @Test 51 publicvoid testGetRemovedSource() {51 void testGetRemovedSource() { 52 52 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 53 53 assertTrue( … … 64 64 */ 65 65 @Test 66 publicvoid testGetDataSources() {66 void testGetDataSources() { 67 67 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 68 68 DataSourceChangeEvent event = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(), … … 76 76 */ 77 77 @Test 78 publicvoid testToString() {78 void testToString() { 79 79 String toString = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString(); 80 80 assertTrue(toString.contains("added")); -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceRemovedEventTest.java
r15609 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.util.Collections; 9 9 import java.util.stream.Stream; 10 10 11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.data.Bounds; 13 13 import org.openstreetmap.josm.data.DataSource; … … 21 21 */ 22 22 23 publicclass DataSourceRemovedEventTest {23 class DataSourceRemovedEventTest { 24 24 /** 25 25 * Get getting the originating data source 26 26 */ 27 27 @Test 28 publicvoid testGetDataEventSource() {28 void testGetDataEventSource() { 29 29 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 30 30 DataSet ds = new DataSet(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetAddedSource() {38 void testGetAddedSource() { 39 39 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 40 40 assertTrue( … … 51 51 */ 52 52 @Test 53 publicvoid testGetRemovedSource() {53 void testGetRemovedSource() { 54 54 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 55 55 assertTrue(new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).getRemoved() … … 66 66 */ 67 67 @Test 68 publicvoid testGetDataSources() {68 void testGetDataSources() { 69 69 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 70 70 DataSourceChangeEvent event = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), … … 83 83 */ 84 84 @Test 85 publicvoid testToString() {85 void testToString() { 86 86 String toString = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString(); 87 87 assertTrue(toString.contains("added")); -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link NodeMovedEvent} class. 14 14 */ 15 publicclass NodeMovedEventTest {15 class NodeMovedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("NODE_MOVED", new NodeMovedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link PrimitiveFlagsChangedEvent} class. 14 14 */ 15 publicclass PrimitiveFlagsChangedEventTest {15 class PrimitiveFlagsChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("PRIMITIVE_FLAGS_CHANGED", new PrimitiveFlagsChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Collections; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests of {@link PrimitivesAddedEvent} class. 16 16 */ 17 publicclass PrimitivesAddedEventTest {17 class PrimitivesAddedEventTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testToString() {30 void testToString() { 31 31 assertEquals("PRIMITIVES_ADDED", new PrimitivesAddedEvent(null, Collections.emptyList(), false).toString()); 32 32 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Collections; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests of {@link PrimitivesRemovedEvent} class. 16 16 */ 17 publicclass PrimitivesRemovedEventTest {17 class PrimitivesRemovedEventTest { 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 test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testToString() {30 void testToString() { 31 31 assertEquals("PRIMITIVES_REMOVED", new PrimitivesRemovedEvent(null, Collections.emptyList(), false).toString()); 32 32 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link RelationMembersChangedEvent} class. 14 14 */ 15 publicclass RelationMembersChangedEventTest {15 class RelationMembersChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("RELATION_MEMBERS_CHANGED", new RelationMembersChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java
r14247 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; … … 9 9 import java.util.List; 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.command.CommandTest.CommandTestDataWithRelation; 14 14 import org.openstreetmap.josm.data.osm.DataSelectionListener; … … 25 25 * @since 12048 26 26 */ 27 publicclass SelectionEventManagerTest {27 class SelectionEventManagerTest { 28 28 private final class SelectionListener implements DataSelectionListener { 29 29 private Collection<? extends OsmPrimitive> newSelection; … … 42 42 /** 43 43 */ 44 @R ule44 @RegisterExtension 45 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 46 46 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 50 50 */ 51 51 @Test 52 publicvoid testEventPropagation() {52 void testEventPropagation() { 53 53 // automatically adds the layers 54 54 CommandTestDataWithRelation testData1 = new CommandTestDataWithRelation(); … … 99 99 GuiHelper.runInEDTAndWait(() -> { }); 100 100 for (SelectionListener listener : listeners) { 101 assertEquals( listener.name, should, listener.newSelection);101 assertEquals(should, listener.newSelection, listener.name); 102 102 listener.newSelection = null; 103 103 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link TagsChangedEvent} class. 14 14 */ 15 publicclass TagsChangedEventTest {15 class TagsChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("TAGS_CHANGED", new TagsChangedEvent(null, null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link WayNodesChangedEvent} class. 14 14 */ 15 publicclass WayNodesChangedEventTest {15 class WayNodesChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("WAY_NODES_CHANGED", new WayNodesChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java
r12663 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 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.Date; … … 9 9 import java.util.Map; 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.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 23 23 * Unit tests for class {@link HistoryNode}. 24 24 */ 25 publicclass HistoryNodeTest {25 class HistoryNodeTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 48 48 */ 49 49 @Test 50 publicvoid testHistoryNode() {50 void testHistoryNode() { 51 51 Date d = new Date(); 52 52 HistoryNode node = create(d); … … 65 65 */ 66 66 @Test 67 publicvoid testGetType() {67 void testGetType() { 68 68 assertEquals(OsmPrimitiveType.NODE, create(new Date()).getType()); 69 69 } … … 73 73 */ 74 74 @Test 75 publicvoid testGetCoords() {75 void testGetCoords() { 76 76 Node n = new Node(new LatLon(45, 0)); 77 77 n.setOsmId(1, 2); … … 85 85 */ 86 86 @Test 87 publicvoid testGetDisplayName() {87 void testGetDisplayName() { 88 88 HistoryNode node = create(new Date()); 89 89 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java
r12663 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 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.Date; … … 9 9 import java.util.Map; 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.data.osm.DefaultNameFormatter; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 22 22 * Unit tests for class {@link HistoryRelation}. 23 23 */ 24 publicclass HistoryRelationTest {24 class HistoryRelationTest { 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(); … … 46 46 */ 47 47 @Test 48 publicvoid testHistoryRelation() {48 void testHistoryRelation() { 49 49 Date d = new Date(); 50 50 HistoryRelation rel = create(d); … … 63 63 */ 64 64 @Test 65 publicvoid testGetType() {65 void testGetType() { 66 66 assertEquals(OsmPrimitiveType.RELATION, create(new Date()).getType()); 67 67 } … … 71 71 */ 72 72 @Test 73 publicvoid testGetDisplayName() {73 void testGetDisplayName() { 74 74 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 75 75 HistoryRelation rel0 = create(new Date()); // 0 member -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
r16445 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 8 import java.util.Date; … … 11 11 import java.util.Map; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 24 24 * Unit tests for class {@link HistoryWay}. 25 25 */ 26 publicclass HistoryWayTest {26 class HistoryWayTest { 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(); … … 48 48 */ 49 49 @Test 50 publicvoid testHistoryWay() {50 void testHistoryWay() { 51 51 Date d = new Date(); 52 52 HistoryWay way = create(d); … … 67 67 */ 68 68 @Test 69 publicvoid testGetType() {69 void testGetType() { 70 70 assertEquals(OsmPrimitiveType.WAY, create(new Date()).getType()); 71 71 } 72 72 73 73 @Test 74 publicvoid testNodeManipulation() {74 void testNodeManipulation() { 75 75 HistoryWay way = create(new Date()); 76 76 … … 92 92 93 93 @Test 94 publicvoid testIterating() {94 void testIterating() { 95 95 HistoryWay way = create(new Date()); 96 96 … … 108 108 */ 109 109 @Test 110 publicvoid testGetDisplayName() {110 void testGetDisplayName() { 111 111 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 112 112 HistoryWay way0 = create(new Date()); // no node -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java
r12656 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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; 7 7 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token; … … 13 13 * Unit tests for class {@link SearchCompiler}. 14 14 */ 15 publicclass PushbackTokenizerTest {15 class PushbackTokenizerTest { 16 16 17 17 /** 18 18 * Setup rules. 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 testEnumToken() {28 void testEnumToken() { 29 29 TestUtils.superficialEnumCodeCoverage(Token.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r17114 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 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.assertNotNull; 9 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 10 11 11 import java.lang.reflect.Field; … … 19 19 20 20 import org.junit.Assert; 21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.Test; 22 import org.junit.jupiter.api.extension.RegisterExtension; 23 23 import org.openstreetmap.josm.TestUtils; 24 24 import org.openstreetmap.josm.data.coor.LatLon; … … 53 53 * Unit tests for class {@link SearchCompiler}. 54 54 */ 55 publicclass SearchCompilerTest {55 class SearchCompilerTest { 56 56 57 57 /** 58 58 * We need prefs for this. We access preferences when creating OSM primitives. 59 59 */ 60 @R ule60 @RegisterExtension 61 61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 62 public JOSMTestRules test = new JOSMTestRules().preferences().timeout(30000); … … 95 95 private void match(OsmPrimitive p, boolean cond) { 96 96 if (cond) { 97 assertTrue( p.toString(), m.match(p));98 assertFalse( p.toString(), n.match(p));97 assertTrue(m.match(p), p::toString); 98 assertFalse(n.match(p), p::toString); 99 99 } else { 100 assertFalse( p.toString(), m.match(p));101 assertTrue( p.toString(), n.match(p));100 assertFalse(m.match(p), p::toString); 101 assertTrue(n.match(p), p::toString); 102 102 } 103 103 } … … 109 109 */ 110 110 @Test 111 publicvoid testAny() throws SearchParseError {111 void testAny() throws SearchParseError { 112 112 final SearchCompiler.Match c = SearchCompiler.compile("foo"); 113 113 assertTrue(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 122 122 */ 123 123 @Test 124 publicvoid testEquals() throws SearchParseError {124 void testEquals() throws SearchParseError { 125 125 final SearchCompiler.Match c = SearchCompiler.compile("foo=bar"); 126 126 assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 136 136 */ 137 137 @Test 138 publicvoid testRegexp() throws SearchParseError {138 void testRegexp() throws SearchParseError { 139 139 final SearchCompiler.Match c = SearchCompiler.compile("foo~[Bb]a[rz]"); 140 140 assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 151 151 */ 152 152 @Test 153 publicvoid testCompare() throws SearchParseError {153 void testCompare() throws SearchParseError { 154 154 final SearchCompiler.Match c1 = SearchCompiler.compile("start_date>1950"); 155 155 assertTrue(c1.match(OsmUtils.createPrimitive("node start_date=1950-01-01"))); … … 191 191 */ 192 192 @Test 193 publicvoid testNth() throws SearchParseError {193 void testNth() throws SearchParseError { 194 194 final DataSet dataSet = new DataSet(); 195 195 final Way way = new Way(); … … 219 219 */ 220 220 @Test 221 publicvoid testNthParseNegative() throws SearchParseError {221 void testNthParseNegative() throws SearchParseError { 222 222 assertEquals("Nth{nth=-1, modulo=false}", SearchCompiler.compile("nth:-1").toString()); 223 223 } … … 228 228 */ 229 229 @Test 230 publicvoid testModified() throws SearchParseError {230 void testModified() throws SearchParseError { 231 231 SearchContext sc = new SearchContext("modified"); 232 232 // Not modified but new 233 233 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 234 assertFalse(p. toString(), p.isModified());235 assertTrue(p. toString(), p.isNewOrUndeleted());234 assertFalse(p.isModified(), p::toString); 235 assertTrue(p.isNewOrUndeleted(), p::toString); 236 236 sc.match(p, true); 237 237 } … … 239 239 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 240 240 p.setModified(true); 241 assertTrue(p. toString(), p.isModified());242 assertTrue(p. toString(), p.isNewOrUndeleted());241 assertTrue(p.isModified(), p::toString); 242 assertTrue(p.isNewOrUndeleted(), p::toString); 243 243 sc.match(p, true); 244 244 } … … 246 246 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 247 247 p.setOsmId(1, 1); 248 assertTrue(p. toString(), p.isModified());249 assertFalse(p. toString(), p.isNewOrUndeleted());248 assertTrue(p.isModified(), p::toString); 249 assertFalse(p.isNewOrUndeleted(), p::toString); 250 250 sc.match(p, true); 251 251 } … … 253 253 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 254 254 p.setOsmId(2, 2); 255 assertFalse(p. toString(), p.isModified());256 assertFalse(p. toString(), p.isNewOrUndeleted());255 assertFalse(p.isModified(), p::toString); 256 assertFalse(p.isNewOrUndeleted(), p::toString); 257 257 sc.match(p, false); 258 258 } … … 264 264 */ 265 265 @Test 266 publicvoid testSelected() throws SearchParseError {266 void testSelected() throws SearchParseError { 267 267 SearchContext sc = new SearchContext("selected"); 268 268 // Not selected 269 269 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 270 assertFalse(p. toString(), p.isSelected());270 assertFalse(p.isSelected(), p::toString); 271 271 sc.match(p, false); 272 272 } … … 274 274 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 275 275 sc.ds.addSelected(p); 276 assertTrue(p. toString(), p.isSelected());276 assertTrue(p.isSelected(), p::toString); 277 277 sc.match(p, true); 278 278 } … … 284 284 */ 285 285 @Test 286 publicvoid testIncomplete() throws SearchParseError {286 void testIncomplete() throws SearchParseError { 287 287 SearchContext sc = new SearchContext("incomplete"); 288 288 // Not incomplete 289 289 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 290 assertFalse(p. toString(), p.isIncomplete());290 assertFalse(p.isIncomplete(), p::toString); 291 291 sc.match(p, false); 292 292 } … … 300 300 sc.r2.load(rd); 301 301 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 302 assertTrue(p. toString(), p.isIncomplete());302 assertTrue(p.isIncomplete(), p::toString); 303 303 sc.match(p, true); 304 304 } … … 310 310 */ 311 311 @Test 312 publicvoid testUntagged() throws SearchParseError {312 void testUntagged() throws SearchParseError { 313 313 SearchContext sc = new SearchContext("untagged"); 314 314 // Untagged 315 315 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 316 assertFalse(p. toString(), p.isTagged());316 assertFalse(p.isTagged(), p::toString); 317 317 sc.match(p, true); 318 318 } … … 320 320 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 321 321 p.put("foo", "bar"); 322 assertTrue(p. toString(), p.isTagged());322 assertTrue(p.isTagged(), p::toString); 323 323 sc.match(p, false); 324 324 } … … 330 330 */ 331 331 @Test 332 publicvoid testClosed() throws SearchParseError {332 void testClosed() throws SearchParseError { 333 333 SearchContext sc = new SearchContext("closed"); 334 334 // Closed 335 335 sc.w1.addNode(sc.n1); 336 336 for (Way w : new Way[]{sc.w1}) { 337 assertTrue(w. toString(), w.isClosed());337 assertTrue(w.isClosed(), w::toString); 338 338 sc.match(w, true); 339 339 } … … 349 349 */ 350 350 @Test 351 publicvoid testNew() throws SearchParseError {351 void testNew() throws SearchParseError { 352 352 SearchContext sc = new SearchContext("new"); 353 353 // New 354 354 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 355 assertTrue(p. toString(), p.isNew());355 assertTrue(p.isNew(), p::toString); 356 356 sc.match(p, true); 357 357 } … … 359 359 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 360 360 p.setOsmId(2, 2); 361 assertFalse(p. toString(), p.isNew());361 assertFalse(p.isNew(), p::toString); 362 362 sc.match(p, false); 363 363 } … … 369 369 */ 370 370 @Test 371 publicvoid testTypeNode() throws SearchParseError {371 void testTypeNode() throws SearchParseError { 372 372 final SearchContext sc = new SearchContext("type:node"); 373 373 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 381 381 */ 382 382 @Test 383 publicvoid testTypeWay() throws SearchParseError {383 void testTypeWay() throws SearchParseError { 384 384 final SearchContext sc = new SearchContext("type:way"); 385 385 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 393 393 */ 394 394 @Test 395 publicvoid testTypeRelation() throws SearchParseError {395 void testTypeRelation() throws SearchParseError { 396 396 final SearchContext sc = new SearchContext("type:relation"); 397 397 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 405 405 */ 406 406 @Test 407 publicvoid testUser() throws SearchParseError {407 void testUser() throws SearchParseError { 408 408 final SearchContext foobar = new SearchContext("user:foobar"); 409 409 foobar.n1.setUser(User.createLocalUser("foobar")); … … 421 421 */ 422 422 @Test 423 publicvoid testFooTypeBar() throws SearchParseError {423 void testFooTypeBar() throws SearchParseError { 424 424 Exception e = assertThrows(SearchParseError.class, () -> SearchCompiler.compile("foo type bar")); 425 425 assertEquals("<html>Expecting <code>:</code> after <i>type</i></html>", e.getMessage()); … … 431 431 */ 432 432 @Test 433 publicvoid testTimestamp() throws SearchParseError {433 void testTimestamp() throws SearchParseError { 434 434 final Node n1 = new Node(); 435 435 n1.setTimestamp(DateUtils.fromString("2010-01-22")); … … 448 448 */ 449 449 @Test 450 publicvoid testBooleanLogic() throws SearchParseError {450 void testBooleanLogic() throws SearchParseError { 451 451 final SearchCompiler.Match c1 = SearchCompiler.compile("foo AND bar AND baz"); 452 452 assertTrue(c1.match(OsmUtils.createPrimitive("node foobar=baz"))); … … 471 471 */ 472 472 @Test 473 publicvoid testBuildSearchStringForTag() throws SearchParseError {473 void testBuildSearchStringForTag() throws SearchParseError { 474 474 final Tag tag1 = new Tag("foo=", "bar\""); 475 475 final Tag tag2 = new Tag("foo=", "=bar"); … … 486 486 /** 487 487 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13870">Bug #13870</a>. 488 * @throws SearchParseError always 489 */ 490 @Test(expected = SearchParseError.class) 491 public void testPattern13870() throws SearchParseError { 488 */ 489 @Test 490 void testPattern13870() { 492 491 // https://bugs.openjdk.java.net/browse/JI-9044959 493 492 SearchSetting setting = new SearchSetting(); 494 493 setting.regexSearch = true; 495 494 setting.text = "["; 496 SearchCompiler.compile(setting);495 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting)); 497 496 } 498 497 … … 502 501 */ 503 502 @Test 504 publicvoid testTicket14217() throws Exception {503 void testTicket14217() throws Exception { 505 504 assertNotNull(SearchCompiler.compile(new String(Files.readAllBytes( 506 505 Paths.get(TestUtils.getRegressionDataFile(14217, "filter.txt"))), StandardCharsets.UTF_8))); … … 509 508 /** 510 509 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17112">Bug #17112</a>. 511 * @throws SearchParseError always 512 */ 513 @Test(expected = SearchParseError.class) 514 public void testTicket17112() throws SearchParseError { 510 */ 511 @Test 512 void testTicket17112() { 515 513 SearchSetting setting = new SearchSetting(); 516 514 setting.mapCSSSearch = true; 517 515 setting.text = "w"; // partial input 518 SearchCompiler.compile(setting);516 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting)); 519 517 } 520 518 … … 524 522 */ 525 523 @Test 526 publicvoid testEmptyValues15943() throws SearchParseError {524 void testEmptyValues15943() throws SearchParseError { 527 525 Match matcher = SearchCompiler.compile("access="); 528 526 assertTrue(matcher.match(new Tag("access", null))); … … 536 534 */ 537 535 @Test 538 publicvoid testKeyExists15943() throws SearchParseError {536 void testKeyExists15943() throws SearchParseError { 539 537 Match matcher = SearchCompiler.compile("surface:"); 540 538 assertTrue(matcher.match(new Tag("surface", ""))); … … 549 547 */ 550 548 @Test 551 publicvoid testEnumExactKeyValueMode() {549 void testEnumExactKeyValueMode() { 552 550 assertDoesNotThrow(() -> TestUtils.superficialEnumCodeCoverage(ExactKeyValue.Mode.class)); 553 551 } … … 555 553 /** 556 554 * Robustness test for preset searching. Ensures that the query 'preset:' is not accepted. 557 * @throws SearchParseError always558 555 * @since 12464 559 556 */ 560 @Test (expected = SearchParseError.class)561 public void testPresetSearchMissingValue() throws SearchParseError{557 @Test 558 void testPresetSearchMissingValue() { 562 559 SearchSetting settings = new SearchSetting(); 563 560 settings.text = "preset:"; … … 566 563 TaggingPresets.readFromPreferences(); 567 564 568 SearchCompiler.compile(settings);565 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings)); 569 566 } 570 567 … … 572 569 * Robustness test for preset searching. Validates that it is not possible to search for 573 570 * non existing presets. 574 * @throws SearchParseError always575 571 * @since 12464 576 572 */ 577 @Test (expected = SearchParseError.class)578 public void testPresetNotExist() throws SearchParseError{573 @Test 574 void testPresetNotExist() { 579 575 String testPresetName = "groupnamethatshouldnotexist/namethatshouldnotexist"; 580 576 SearchSetting settings = new SearchSetting(); … … 585 581 TaggingPresets.readFromPreferences(); 586 582 587 SearchCompiler.compile(settings);583 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings)); 588 584 } 589 585 … … 591 587 * Robustness tests for preset searching. Ensures that combined preset names (having more than 592 588 * 1 word) must be enclosed with " . 593 * @throws SearchParseError always594 589 * @since 12464 595 590 */ 596 @Test (expected = SearchParseError.class)597 public void testPresetMultipleWords() throws SearchParseError{591 @Test 592 void testPresetMultipleWords() { 598 593 TaggingPreset testPreset = new TaggingPreset(); 599 594 testPreset.name = "Test Combined Preset Name"; … … 609 604 TaggingPresets.readFromPreferences(); 610 605 611 SearchCompiler.compile(settings);606 assertThrows(IllegalArgumentException.class, () -> SearchCompiler.compile(settings)); 612 607 } 613 608 … … 621 616 */ 622 617 @Test 623 publicvoid testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException {618 void testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException { 624 619 TaggingPreset testPreset = new TaggingPreset(); 625 620 testPreset.name = "Test Preset Name"; … … 660 655 */ 661 656 @Test 662 publicvoid testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException {657 void testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException { 663 658 TaggingPresetMenu group = new TaggingPresetMenu(); 664 659 group.name = "TestPresetGroup"; … … 705 700 */ 706 701 @Test 707 publicvoid testPreset() throws SearchParseError {702 void testPreset() throws SearchParseError { 708 703 final String presetName = "Test Preset Name"; 709 704 final String presetGroupName = "Test Preset Group"; … … 744 739 */ 745 740 @Test 746 publicvoid testEqualsContract() {741 void testEqualsContract() { 747 742 TestUtils.assumeWorkingEqualsVerifier(); 748 743 Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class); … … 768 763 */ 769 764 @Test 770 publicvoid testNodeCount() throws SearchParseError {765 void testNodeCount() throws SearchParseError { 771 766 final SearchContext sc = new SearchContext("nodes:2"); 772 767 sc.match(sc.n1, false); … … 784 779 */ 785 780 @Test 786 publicvoid testWayCount() throws SearchParseError {781 void testWayCount() throws SearchParseError { 787 782 final SearchContext sc = new SearchContext("ways:2"); 788 783 sc.match(sc.n1, true); … … 800 795 */ 801 796 @Test 802 publicvoid testMemberCount() throws SearchParseError {797 void testMemberCount() throws SearchParseError { 803 798 final SearchContext sc = new SearchContext("members:2"); 804 799 sc.match(sc.n1, false); … … 814 809 */ 815 810 @Test 816 publicvoid testRole() throws SearchParseError {811 void testRole() throws SearchParseError { 817 812 final SearchContext sc = new SearchContext("role:foo"); 818 813 sc.match(sc.r1, false); -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java
r12659 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests for class {@link SearchMode}. 13 13 */ 14 publicclass SearchModeTest {14 class SearchModeTest { 15 15 16 16 /** 17 17 * Setup rules. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 25 25 */ 26 26 @Test 27 publicvoid testEnumSearchMode() {27 void testEnumSearchMode() { 28 28 TestUtils.superficialEnumCodeCoverage(SearchMode.class); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r16445 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor; 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 9 import java.util.Collection; 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.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * Unit tests for class {@link MergeSourceBuildingVisitor}. 27 27 */ 28 publicclass MergeSourceBuildingVisitorTest {28 class MergeSourceBuildingVisitorTest { 29 29 30 30 protected OsmPrimitive lookupByName(Collection<? extends OsmPrimitive> primitives, String name) { … … 39 39 * Setup test. 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules(); 44 44 45 45 @Test 46 publicvoid testNodes() {46 void testNodes() { 47 47 DataSet source = new DataSet(); 48 48 Node n1 = new Node(1); … … 78 78 79 79 @Test 80 publicvoid testOneWay() {80 void testOneWay() { 81 81 DataSet source = new DataSet(); 82 82 Node n1 = new Node(1); … … 110 110 111 111 @Test 112 publicvoid testOneWayNodesSelectedToo() {112 void testOneWayNodesSelectedToo() { 113 113 DataSet source = new DataSet(); 114 114 Node n1 = new Node(1); … … 142 142 143 143 @Test 144 publicvoid testOneWayIncomplete() {144 void testOneWayIncomplete() { 145 145 DataSet source = new DataSet(); 146 146 Way w1 = new Way(3); … … 160 160 161 161 @Test 162 publicvoid testOneRelationExistingMembersSelected() {162 void testOneRelationExistingMembersSelected() { 163 163 DataSet source = new DataSet(); 164 164 Relation r1 = new Relation(1, 1); … … 219 219 220 220 @Test 221 publicvoid testOneRelationExistingMembersNotSelected() {221 void testOneRelationExistingMembersNotSelected() { 222 222 DataSet source = new DataSet(); 223 223 Relation r1 = new Relation(1, 1); … … 278 278 279 279 @Test 280 publicvoid testOneRelationNewMembersNotSelected() {280 void testOneRelationNewMembersNotSelected() { 281 281 DataSet source = new DataSet(); 282 282 Relation r1 = new Relation(); … … 345 345 346 346 @Test 347 publicvoid testOneRelationExistingRecursive() {347 void testOneRelationExistingRecursive() { 348 348 DataSet source = new DataSet(); 349 349 Relation r1 = new Relation(1, 1); … … 364 364 365 365 @Test 366 publicvoid testOneRelationNewRecursive() {366 void testOneRelationNewRecursive() { 367 367 DataSet source = new DataSet(); 368 368 Relation r1 = new Relation(); … … 384 384 385 385 @Test 386 publicvoid testTwoRelationExistingCircular() {386 void testTwoRelationExistingCircular() { 387 387 DataSet source = new DataSet(); 388 388 Relation r1 = new Relation(1, 1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererTest.java
r14694 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 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. Test;7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.StyleRecord; … … 17 17 * @since 12078 18 18 */ 19 publicclass StyledMapRendererTest {19 class StyledMapRendererTest { 20 20 21 21 /** … … 23 23 */ 24 24 @Test 25 publicvoid testFloatToFixed() {25 void testFloatToFixed() { 26 26 long inf = floatToFixedCheckBits(Float.POSITIVE_INFINITY, 24); 27 27 long big = floatToFixedCheckBits(Float.MAX_VALUE, 24); … … 85 85 */ 86 86 @Test 87 publicvoid testEqualsContract() {87 void testEqualsContract() { 88 88 TestUtils.assumeWorkingEqualsVerifier(); 89 89 EqualsVerifier.forClass(StyleRecord.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java
r14119 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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.spi.preferences.Config; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link JosmUrls} class. 15 15 */ 16 publicclass JosmUrlsTest {16 class JosmUrlsTest { 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().devAPI(); … … 27 27 */ 28 28 @Test 29 publicvoid testGetBaseUserUrl() {29 void testGetBaseUserUrl() { 30 30 assertEquals("https://api06.dev.openstreetmap.org/user", Config.getUrls().getBaseUserUrl()); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java
r17119 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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.awt.Color; … … 11 11 import javax.swing.UIManager; 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.data.Preferences; 17 17 import org.openstreetmap.josm.spi.preferences.Config; … … 24 24 * @author Michael Zangl 25 25 */ 26 publicclass NamedColorPropertyTest {26 class NamedColorPropertyTest { 27 27 /** 28 28 * This is a preference test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 36 36 * Set up test case 37 37 */ 38 @Before 38 @BeforeEach 39 39 public void createTestProperty() { 40 40 base = new NamedColorProperty("test", Color.RED); … … 45 45 */ 46 46 @Test 47 publicvoid testGet() {47 void testGet() { 48 48 assertEquals(Color.RED, base.get()); 49 49 … … 65 65 */ 66 66 @Test 67 publicvoid testPut() {67 void testPut() { 68 68 assertEquals(Color.RED, base.get()); 69 69 … … 80 80 */ 81 81 @Test 82 publicvoid testColorAlpha() {82 void testColorAlpha() { 83 83 assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha()); 84 84 assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar"))); … … 90 90 */ 91 91 @Test 92 publicvoid testColorNameAlpha() {92 void testColorNameAlpha() { 93 93 assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha()); 94 94 } … … 98 98 */ 99 99 @Test 100 publicvoid testGetChildColor() {100 void testGetChildColor() { 101 101 AbstractProperty<Color> child = base.getChildColor("test2"); 102 102 -
trunk/test/unit/org/openstreetmap/josm/data/preferences/PreferencesWriterTest.java
r12884 r17275 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; … … 13 13 import java.util.TreeMap; 14 14 15 import org.junit. Test;15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.data.Version; 17 17 import org.openstreetmap.josm.spi.preferences.Setting; … … 25 25 * Unit tests for class {@link PreferencesWriter}. 26 26 */ 27 publicclass PreferencesWriterTest {27 class PreferencesWriterTest { 28 28 29 29 private static <T extends AbstractSetting<?>> T setting(T s, long time) { … … 37 37 */ 38 38 @Test 39 publicvoid testListList() throws IOException {39 void testListList() throws IOException { 40 40 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 41 41 long time = System.currentTimeMillis() / 1000; … … 56 56 */ 57 57 @Test 58 publicvoid testList() throws IOException {58 void testList() throws IOException { 59 59 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 60 60 long time = System.currentTimeMillis() / 1000; … … 73 73 */ 74 74 @Test 75 publicvoid testMapList() throws IOException {75 void testMapList() throws IOException { 76 76 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 77 77 long time = System.currentTimeMillis() / 1000; … … 94 94 */ 95 95 @Test 96 publicvoid testString() throws IOException {96 void testString() throws IOException { 97 97 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 98 98 long time = System.currentTimeMillis() / 1000; … … 109 109 */ 110 110 @Test 111 publicvoid testWrite() throws IOException {111 void testWrite() throws IOException { 112 112 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 113 113 long time = System.currentTimeMillis() / 1000; … … 132 132 */ 133 133 @Test 134 publicvoid testNullValue() throws IOException {134 void testNullValue() throws IOException { 135 135 long time = System.currentTimeMillis() / 1000; 136 136 // CHECKSTYLE.OFF: LineLength -
trunk/test/unit/org/openstreetmap/josm/data/preferences/StrokePropertyTest.java
r15775 r17275 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.awt.BasicStroke; 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.spi.preferences.Config; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * @author Michael Zangl 19 19 */ 20 publicclass StrokePropertyTest {20 class StrokePropertyTest { 21 21 /** 22 22 * This is a preference test 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testGetValue() {32 void testGetValue() { 33 33 StrokeProperty property = new StrokeProperty("x", "1"); 34 34 … … 75 75 */ 76 76 @Test 77 publicvoid testPutValue() {77 void testPutValue() { 78 78 StrokeProperty property = new StrokeProperty("x", new BasicStroke(12)); 79 79 BasicStroke bs = property.get(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/CustomProjectionTest.java
r13602 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 8 import java.util.stream.Stream; 9 9 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.coor.LatLon; 13 13 import org.openstreetmap.josm.data.projection.CustomProjection.Polarity; … … 20 20 * @author Michael Zangl 21 21 */ 22 publicclass CustomProjectionTest {22 class CustomProjectionTest { 23 23 /** 24 24 * Need pref to load pref. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testParseAngle() throws ProjectionConfigurationException {35 void testParseAngle() throws ProjectionConfigurationException { 36 36 assertEquals(0, CustomProjection.parseAngle("0", "xxx"), 1e-10); 37 37 assertEquals(1, CustomProjection.parseAngle("1", "xxx"), 1e-10); … … 86 86 */ 87 87 @Test 88 publicvoid testPolarity() {88 void testPolarity() { 89 89 assertEquals(LatLon.NORTH_POLE, Polarity.NORTH.getLatLon()); 90 90 assertEquals(LatLon.SOUTH_POLE, Polarity.SOUTH.getLatLon()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
r11324 r17275 6 6 7 7 import org.junit.Assert; 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 … … 12 12 * Unit tests for class {@link Ellipsoid}. 13 13 */ 14 publicclass EllipsoidTest {14 class EllipsoidTest { 15 15 16 16 private static final double EPSILON = 1e-8; … … 20 20 */ 21 21 @Test 22 publicvoid testLatLon2Cart2LatLon() {22 void testLatLon2Cart2LatLon() { 23 23 Random r = new SecureRandom(); 24 24 double maxErrLat = 0, maxErrLon = 0; -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r16643 r17275 34 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 35 35 import org.junit.Assert; 36 import org.junit. Rule;37 import org.junit. Test;36 import org.junit.jupiter.api.extension.RegisterExtension; 37 import org.junit.jupiter.api.Test; 38 38 import org.openstreetmap.josm.data.Bounds; 39 39 import org.openstreetmap.josm.data.coor.EastNorth; … … 59 59 * of the algorithm, given a certain definition. 60 60 */ 61 publicclass ProjectionRefTest {61 class ProjectionRefTest { 62 62 63 63 private static final String CS2CS_EXE = "cs2cs"; … … 86 86 * Setup test. 87 87 */ 88 @R ule88 @RegisterExtension 89 89 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 90 90 public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000); … … 373 373 */ 374 374 @Test 375 publicvoid testProjections() throws IOException {375 void testProjections() throws IOException { 376 376 StringBuilder fail = new StringBuilder(); 377 377 Map<String, Set<String>> failingProjs = new HashMap<>(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r16643 r17275 19 19 import java.util.stream.Collectors; 20 20 21 import org.junit. BeforeClass;22 import org.junit. Test;21 import org.junit.jupiter.api.BeforeAll; 22 import org.junit.jupiter.api.Test; 23 23 import org.openstreetmap.josm.JOSMFixture; 24 24 import org.openstreetmap.josm.data.Bounds; … … 39 39 * test data, by running the main method of this class and commit the new data file. 40 40 */ 41 publicclass ProjectionRegressionTest {41 class ProjectionRegressionTest { 42 42 43 43 private static final String PROJECTION_DATA_FILE = "nodist/data/projection/projection-regression-test-data"; … … 136 136 * Setup test. 137 137 */ 138 @Before Class138 @BeforeAll 139 139 public static void setUp() { 140 140 JOSMFixture.createUnitTestFixture().init(); … … 146 146 */ 147 147 @Test 148 publicvoid testNonRegression() throws IOException {148 void testNonRegression() throws IOException { 149 149 List<TestData> allData = readData(); 150 150 Set<String> dataCodes = allData.stream().map(data -> data.code).collect(Collectors.toSet()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.security.SecureRandom; … … 11 11 12 12 import org.junit.Assert; 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.Bounds; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; … … 19 19 * Unit tests for class {@link Projection}. 20 20 */ 21 publicclass ProjectionTest {21 class ProjectionTest { 22 22 23 23 private static final Random rand = new SecureRandom(); … … 30 30 */ 31 31 @Test 32 publicvoid testProjections() {32 void testProjections() { 33 33 error = false; 34 34 text = ""; … … 120 120 */ 121 121 @Test 122 publicvoid testProjs() {122 void testProjs() { 123 123 error2 = false; 124 124 text2 = ""; … … 150 150 Assert.fail(); 151 151 } 152 assertTrue( "missing test: "+projIds, projIds.isEmpty());152 assertTrue(projIds.isEmpty(), "missing test: "+projIds); 153 153 } 154 154 … … 170 170 EastNorth en = p.latlon2eastNorth(ll1); 171 171 LatLon ll2 = p.eastNorth2latlon(en); 172 assertTrue( p.toCode() + " at " + ll1 + " is " + ll2, ll2.isValid());172 assertTrue(ll2.isValid(), p.toCode() + " at " + ll1 + " is " + ll2); 173 173 double dist = ll1.greatCircleDistance(ll2); 174 174 if (dist > eps) { … … 189 189 */ 190 190 @Test 191 publicvoid testSwedishProjections() {191 void testSwedishProjections() { 192 192 for (int code = 3006; code <= 3018; code++) { 193 193 assertTrue(Projections.getProjectionByCode("EPSG:"+code).switchXY()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ShiftedProjectionTest.java
r12161 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Comparator; … … 11 11 import java.util.stream.Collectors; 12 12 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.ProjectionBounds; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; … … 21 21 * @author Michael Zangl 22 22 */ 23 publicclass ShiftedProjectionTest {23 class ShiftedProjectionTest { 24 24 private static final class ProjectingBase implements Projecting { 25 25 @Override … … 57 57 */ 58 58 @Test 59 publicvoid testLatlon2eastNorth() {59 void testLatlon2eastNorth() { 60 60 Projecting base = new ProjectingBase(); 61 61 … … 81 81 */ 82 82 @Test 83 publicvoid testEastNorth2latlonClamped() {83 void testEastNorth2latlonClamped() { 84 84 Projecting base = new ProjectingBase(); 85 85 … … 105 105 */ 106 106 @Test 107 publicvoid testGetProjectingsForArea() {107 void testGetProjectingsForArea() { 108 108 Projecting base = new ProjectingBase(); 109 109 ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7)); … … 124 124 */ 125 125 @Test 126 publicvoid testGetProjectingsForAreaMultiple() {126 void testGetProjectingsForAreaMultiple() { 127 127 Projecting base = new ProjectingBase(); 128 128 ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7)); -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertSame;5 import static org.junit. Assert.assertTrue;6 7 import org.junit. BeforeClass;8 import org.junit. Rule;9 import org.junit. Test;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 7 import org.junit.jupiter.api.BeforeAll; 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.coor.LatLon; … … 17 17 * Unit tests for the Swiss projection grid. 18 18 */ 19 publicclass SwissGridTest {19 class SwissGridTest { 20 20 private static final String SWISS_EPSG_CODE = "EPSG:21781"; 21 21 private final boolean debug = false; … … 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().projectionNadGrids(); … … 31 31 * Setup test. 32 32 */ 33 @Before Class33 @BeforeAll 34 34 public static void setUp() { 35 35 ProjectionRegistry.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid … … 79 79 } 80 80 } 81 assertSame(errs. toString(), errs.length(), 0);81 assertSame(errs.length(), 0, errs::toString); 82 82 } 83 83 … … 86 86 */ 87 87 @Test 88 publicvoid testProjReferenceTestAccurate() {88 void testProjReferenceTestAccurate() { 89 89 projReferenceTest(EPSILON_ACCURATE); 90 90 } … … 94 94 */ 95 95 @Test 96 publicvoid testAlatlon2eastNorth() {96 void testAlatlon2eastNorth() { 97 97 LatLon ll = new LatLon(46.518, 6.567); 98 98 EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); … … 100 100 System.out.println(en); 101 101 } 102 assertTrue( "Lausanne", Math.abs(en.east() - 533112.13) < 0.1);103 assertTrue( "Lausanne", Math.abs(en.north() - 152227.35) < 0.1);102 assertTrue(Math.abs(en.east() - 533112.13) < 0.1, "Lausanne"); 103 assertTrue(Math.abs(en.north() - 152227.35) < 0.1, "Lausanne"); 104 104 105 105 ll = new LatLon(47.78, 8.58); … … 108 108 System.out.println(en); 109 109 } 110 assertTrue( "Schafouse", Math.abs(en.east() - 685542.97) < 0.1);111 assertTrue( "Schafouse", Math.abs(en.north() - 292783.21) < 0.1);110 assertTrue(Math.abs(en.east() - 685542.97) < 0.1, "Schafouse"); 111 assertTrue(Math.abs(en.north() - 292783.21) < 0.1, "Schafouse"); 112 112 113 113 ll = new LatLon(46.58, 10.48); … … 116 116 System.out.println(en); 117 117 } 118 assertTrue( "Grinson", Math.abs(en.east() - 833066.95) < 0.1);119 assertTrue( "Grinson", Math.abs(en.north() - 163265.32) < 0.1);118 assertTrue(Math.abs(en.east() - 833066.95) < 0.1, "Grinson"); 119 assertTrue(Math.abs(en.north() - 163265.32) < 0.1, "Grinson"); 120 120 121 121 ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600); … … 124 124 System.out.println(en); 125 125 } 126 assertTrue( "Berne", Math.abs(en.east() - 600000.0) < 0.1);127 assertTrue( "Berne", Math.abs(en.north() - 200000.0) < 0.1);126 assertTrue(Math.abs(en.east() - 600000.0) < 0.1, "Berne"); 127 assertTrue(Math.abs(en.north() - 200000.0) < 0.1, "Berne"); 128 128 129 129 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 … … 133 133 System.out.println(en); 134 134 } 135 assertTrue( "Ref", Math.abs(en.east() - 700000.0) < 0.1);136 assertTrue( "Ref", Math.abs(en.north() - 100000.0) < 0.1);135 assertTrue(Math.abs(en.east() - 700000.0) < 0.1, "Ref"); 136 assertTrue(Math.abs(en.north() - 100000.0) < 0.1, "Ref"); 137 137 } 138 138 … … 141 141 */ 142 142 @Test 143 publicvoid testBeastNorth2latlon() {143 void testBeastNorth2latlon() { 144 144 EastNorth en = new EastNorth(533112.13, 152227.35); 145 145 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); … … 147 147 System.out.println(ll); 148 148 } 149 assertTrue( "Lausanne", Math.abs(ll.lat() - 46.518) < 0.00001);150 assertTrue( "Lausanne", Math.abs(ll.lon() - 6.567) < 0.00001);149 assertTrue(Math.abs(ll.lat() - 46.518) < 0.00001, "Lausanne"); 150 assertTrue(Math.abs(ll.lon() - 6.567) < 0.00001, "Lausanne"); 151 151 152 152 en = new EastNorth(685542.97, 292783.21); … … 155 155 System.out.println(ll); 156 156 } 157 assertTrue( "Schafouse", Math.abs(ll.lat() - 47.78) < 0.00001);158 assertTrue( "Schafouse", Math.abs(ll.lon() - 8.58) < 0.00001);157 assertTrue(Math.abs(ll.lat() - 47.78) < 0.00001, "Schafouse"); 158 assertTrue(Math.abs(ll.lon() - 8.58) < 0.00001, "Schafouse"); 159 159 160 160 en = new EastNorth(833066.95, 163265.32); … … 163 163 System.out.println(ll); 164 164 } 165 assertTrue( "Grinson", Math.abs(ll.lat() - 46.58) < 0.00001);166 assertTrue( "Grinson", Math.abs(ll.lon() - 10.48) < 0.00001);165 assertTrue(Math.abs(ll.lat() - 46.58) < 0.00001, "Grinson"); 166 assertTrue(Math.abs(ll.lon() - 10.48) < 0.00001, "Grinson"); 167 167 168 168 en = new EastNorth(600000.0, 200000.0); … … 171 171 System.out.println(ll); 172 172 } 173 assertTrue( "Berne", Math.abs(ll.lat() - (46.0 + 57.0 / 60 + 3.89813884505 / 3600)) < 0.00001);174 assertTrue( "Berne", Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001);173 assertTrue(Math.abs(ll.lat() - (46.0 + 57.0 / 60 + 3.89813884505 / 3600)) < 0.00001, "Berne"); 174 assertTrue(Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001, "Berne"); 175 175 176 176 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 … … 180 180 System.out.println(ll); 181 181 } 182 assertTrue( "Ref", Math.abs(ll.lat() - 46.04412093223244) < 0.00001);183 assertTrue( "Ref", Math.abs(ll.lon() - 8.730497366167727) < 0.00001);182 assertTrue(Math.abs(ll.lat() - 46.04412093223244) < 0.00001, "Ref"); 183 assertTrue(Math.abs(ll.lon() - 8.730497366167727) < 0.00001, "Ref"); 184 184 } 185 185 … … 188 188 */ 189 189 @Test 190 publicvoid testCsendandreturn() {190 void testCsendandreturn() { 191 191 EastNorth en = new EastNorth(533111.69, 152227.85); 192 192 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); … … 198 198 System.out.println(en.north() - en2.north()); 199 199 } 200 assertTrue( "Lausanne", Math.abs(en.east() - en2.east()) < 0.002);201 assertTrue( "Lausanne", Math.abs(en.north() - en2.north()) < 0.002);200 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Lausanne"); 201 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Lausanne"); 202 202 203 203 en = new EastNorth(685544.16, 292782.91); … … 210 210 System.out.println(en.north() - en2.north()); 211 211 } 212 assertTrue( "Schafouse", Math.abs(en.east() - en2.east()) < 0.002);213 assertTrue( "Schafouse", Math.abs(en.north() - en2.north()) < 0.002);212 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Schafouse"); 213 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Schafouse"); 214 214 215 215 en = new EastNorth(833068.04, 163265.39); … … 222 222 System.out.println(en.north() - en2.north()); 223 223 } 224 assertTrue( "Grinson", Math.abs(en.east() - en2.east()) < 0.002);225 assertTrue( "Grinson", Math.abs(en.north() - en2.north()) < 0.002);224 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Grinson"); 225 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Grinson"); 226 226 227 227 en = new EastNorth(600000.0, 200000.0); … … 234 234 System.out.println(en.north() - en2.north()); 235 235 } 236 assertTrue( "Berne", Math.abs(en.east() - en2.east()) < 0.002);237 assertTrue( "Berne", Math.abs(en.north() - en2.north()) < 0.002);236 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Berne"); 237 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Berne"); 238 238 239 239 en = new EastNorth(700000.0, 100000.0); … … 246 246 System.out.println(en.north() - en2.north()); 247 247 } 248 assertTrue( "Ref", Math.abs(en.east() - en2.east()) < 0.002);249 assertTrue( "Ref", Math.abs(en.north() - en2.north()) < 0.002);248 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Ref"); 249 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Ref"); 250 250 } 251 251 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java
r11931 r17275 2 2 package org.openstreetmap.josm.data.projection.proj; 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 * Tests for {@link LonLat}. 14 14 */ 15 publicclass LonLatTest {15 class LonLatTest { 16 16 /** 17 17 * Setup rule. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 25 25 */ 26 26 @Test 27 publicvoid testLonIsLinearToEast() {27 void testLonIsLinearToEast() { 28 28 assertFalse(new LonLat().lonIsLinearToEast()); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java
r11931 r17275 2 2 package org.openstreetmap.josm.data.projection.proj; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Tests for {@link Mercator}. 14 14 */ 15 publicclass MercatorTest {15 class MercatorTest { 16 16 /** 17 17 * Setup rule. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 25 25 */ 26 26 @Test 27 publicvoid testLonIsLinearToEast() {27 void testLonIsLinearToEast() { 28 28 assertTrue(new Mercator().lonIsLinearToEast()); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.tagging.ac; 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; … … 12 12 import java.util.TreeSet; 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.testutils.JOSMTestRules; … … 23 23 * Unit tests of {@link AutoCompletionPriority}. 24 24 */ 25 publicclass AutoCompletionPriorityTest {25 class AutoCompletionPriorityTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetters() {38 void testGetters() { 39 39 assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInStandard()); 40 40 assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInDataSet()); … … 69 69 */ 70 70 @Test 71 publicvoid testOrdering() {71 void testOrdering() { 72 72 SortedSet<AutoCompletionPriority> set = new TreeSet<>(); 73 73 set.add(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET); … … 96 96 */ 97 97 @Test 98 publicvoid testEqualsContract() {98 void testEqualsContract() { 99 99 TestUtils.assumeWorkingEqualsVerifier(); 100 100 EqualsVerifier.forClass(AutoCompletionPriority.class).usingGetClass() … … 106 106 */ 107 107 @Test 108 publicvoid testToString() {108 void testToString() { 109 109 assertEquals("<Priority; userInput: no, inDataSet: true, inStandard: false, selected: false>", 110 110 AutoCompletionPriority.IS_IN_DATASET.toString()); … … 117 117 */ 118 118 @Test 119 publicvoid testMergeWith() {119 void testMergeWith() { 120 120 assertEquals(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET, 121 121 AutoCompletionPriority.IS_IN_DATASET.mergeWith(AutoCompletionPriority.IS_IN_STANDARD)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java
r16447 r17275 2 2 package org.openstreetmap.josm.data.validation; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotEquals;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.validation.tests.Addresses; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * Unit tests for class {@link OsmValidator}. 19 19 */ 20 publicclass OsmValidatorTest {20 class OsmValidatorTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().projection(); … … 31 31 * @throws Exception if an error occurs 32 32 */ 33 @Before 33 @BeforeEach 34 34 public void setUp() throws Exception { 35 35 OsmValidator.clearIgnoredErrors(); … … 41 41 */ 42 42 @Test 43 publicvoid testUtilityClass() throws ReflectiveOperationException {43 void testUtilityClass() throws ReflectiveOperationException { 44 44 UtilityClassTestUtil.assertUtilityClassWellDefined(OsmValidator.class); 45 45 } … … 49 49 */ 50 50 @Test 51 publicvoid testCleanupIgnoredErrors1() {51 void testCleanupIgnoredErrors1() { 52 52 OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way"); 53 53 OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way"); … … 64 64 */ 65 65 @Test 66 publicvoid testCleanupIgnoredErrorsTicket17837() {66 void testCleanupIgnoredErrorsTicket17837() { 67 67 OsmValidator.addIgnoredError("120"); 68 68 OsmValidator.addIgnoredError("3000"); … … 77 77 */ 78 78 @Test 79 publicvoid testCleanupIgnoredErrorsTicket18223() {79 void testCleanupIgnoredErrorsTicket18223() { 80 80 OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way"); 81 81 OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way"); … … 90 90 */ 91 91 @Test 92 publicvoid testRemoveTests() {92 void testRemoveTests() { 93 93 org.openstreetmap.josm.data.validation.Test test = new org.openstreetmap.josm.data.validation.Test("test") { 94 94 }; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTest.java
r12620 r17275 22 22 import static org.junit.Assert.assertNull; 23 23 import static org.junit.Assert.assertTrue; 24 import static org.junit. Assert.fail;24 import static org.junit.jupiter.api.Assertions.fail; 25 25 26 26 import java.lang.reflect.Field; … … 28 28 import java.util.Locale; 29 29 30 import org.junit. Before;31 import org.junit. Test;30 import org.junit.jupiter.api.BeforeEach; 31 import org.junit.jupiter.api.Test; 32 32 import org.openstreetmap.josm.data.validation.routines.DomainValidator.ArrayType; 33 33 import org.openstreetmap.josm.tools.Logging; … … 38 38 * @version $Revision: 1741724 $ 39 39 */ 40 publicclass DomainValidatorTest {40 class DomainValidatorTest { 41 41 42 42 private DomainValidator validator; … … 45 45 * Setup test. 46 46 */ 47 @Before 47 @BeforeEach 48 48 public void setUp() { 49 49 validator = DomainValidator.getInstance(); … … 55 55 */ 56 56 @Test 57 publicvoid testValidDomains() {57 void testValidDomains() { 58 58 assertTrue("apache.org should validate", validator.isValid("apache.org")); 59 59 assertTrue("www.google.com should validate", validator.isValid("www.google.com")); … … 75 75 */ 76 76 @Test 77 publicvoid testInvalidDomains() {77 void testInvalidDomains() { 78 78 assertFalse("bare TLD .org shouldn't validate", validator.isValid(".org")); 79 79 assertFalse("domain name with spaces shouldn't validate", validator.isValid(" apache.org ")); … … 94 94 */ 95 95 @Test 96 publicvoid testTopLevelDomains() {96 void testTopLevelDomains() { 97 97 // infrastructure TLDs 98 98 assertTrue(".arpa should validate as iTLD", validator.isValidInfrastructureTld(".arpa")); … … 121 121 */ 122 122 @Test 123 publicvoid testAllowLocal() {123 void testAllowLocal() { 124 124 DomainValidator noLocal = DomainValidator.getInstance(false); 125 125 DomainValidator allowLocal = DomainValidator.getInstance(true); … … 147 147 */ 148 148 @Test 149 publicvoid testIDN() {149 void testIDN() { 150 150 assertTrue("b\u00fccher.ch in IDN should validate", validator.isValid("www.xn--bcher-kva.ch")); 151 151 } … … 155 155 */ 156 156 @Test 157 publicvoid testIDNJava6OrLater() {157 void testIDNJava6OrLater() { 158 158 String version = System.getProperty("java.version"); 159 159 if (version.compareTo("1.6") < 0) { … … 171 171 */ 172 172 @Test 173 publicvoid testRFC2396domainlabel() { // use fixed valid TLD173 void testRFC2396domainlabel() { // use fixed valid TLD 174 174 assertTrue("a.ch should validate", validator.isValid("a.ch")); 175 175 assertTrue("9.ch should validate", validator.isValid("9.ch")); … … 185 185 */ 186 186 @Test 187 publicvoid testRFC2396toplabel() {187 void testRFC2396toplabel() { 188 188 // These tests use non-existent TLDs so currently need to use a package protected method 189 189 assertTrue("a.c (alpha) should validate", validator.isValidDomainSyntax("a.c")); … … 203 203 */ 204 204 @Test 205 publicvoid testDomainNoDots() {205 void testDomainNoDots() { 206 206 assertTrue("a (alpha) should validate", validator.isValidDomainSyntax("a")); 207 207 assertTrue("9 (alphanum) should validate", validator.isValidDomainSyntax("9")); … … 217 217 */ 218 218 @Test 219 publicvoid testValidator297() {219 void testValidator297() { 220 220 assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai")); // This uses a valid TLD 221 221 } … … 226 226 */ 227 227 @Test 228 publicvoid testValidator306() {228 void testValidator306() { 229 229 final String longString = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789A"; 230 230 assertEquals(63, longString.length()); // 26 * 2 + 11 … … 251 251 */ 252 252 @Test 253 publicvoid testUnicodeToASCII() {253 void testUnicodeToASCII() { 254 254 String[] asciidots = { 255 255 "", … … 289 289 */ 290 290 @Test 291 publicvoid test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {291 void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception { 292 292 final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS"); 293 293 assertTrue(sorted); … … 299 299 */ 300 300 @Test 301 publicvoid test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {301 void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception { 302 302 final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS"); 303 303 assertTrue(sorted); … … 309 309 */ 310 310 @Test 311 publicvoid test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {311 void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception { 312 312 final boolean sorted = isSortedLowerCase("GENERIC_TLDS"); 313 313 assertTrue(sorted); … … 319 319 */ 320 320 @Test 321 publicvoid test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {321 void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception { 322 322 final boolean sorted = isSortedLowerCase("LOCAL_TLDS"); 323 323 assertTrue(sorted); … … 328 328 */ 329 329 @Test 330 publicvoid testEnumIsPublic() {330 void testEnumIsPublic() { 331 331 assertTrue(Modifier.isPublic(DomainValidator.ArrayType.class.getModifiers())); 332 332 } … … 336 336 */ 337 337 @Test 338 publicvoid testUpdateBaseArrays() {338 void testUpdateBaseArrays() { 339 339 try { 340 340 DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"}); … … 371 371 */ 372 372 @Test 373 publicvoid testGetArray() {373 void testGetArray() { 374 374 assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS)); 375 375 assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_PLUS)); … … 386 386 */ 387 387 @Test 388 publicvoid testUpdateCountryCode() {388 void testUpdateCountryCode() { 389 389 assertFalse(validator.isValidCountryCodeTld("com")); // cannot be valid 390 390 DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_PLUS, new String[]{"com"}); … … 404 404 */ 405 405 @Test 406 publicvoid testUpdateGeneric() {406 void testUpdateGeneric() { 407 407 assertFalse(validator.isValidGenericTld("ch")); // cannot be valid 408 408 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); … … 422 422 */ 423 423 @Test 424 publicvoid testCannotUpdate() {424 void testCannotUpdate() { 425 425 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); // OK 426 426 DomainValidator dv = DomainValidator.getInstance(); … … 484 484 */ 485 485 @Test 486 publicvoid testValidatorName() {486 void testValidatorName() { 487 487 assertNull(DomainValidator.getInstance().getValidatorName()); 488 488 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r16765 r17275 47 47 import java.util.regex.Pattern; 48 48 49 import org.junit. Rule;50 import org.junit. Test;49 import org.junit.jupiter.api.extension.RegisterExtension; 50 import org.junit.jupiter.api.Test; 51 51 import org.openstreetmap.josm.testutils.JOSMTestRules; 52 52 import org.openstreetmap.josm.tools.Logging; … … 59 59 * @version $Revision: 1723861 $ 60 60 */ 61 publicclass DomainValidatorTestIT {61 class DomainValidatorTestIT { 62 62 63 63 /** 64 64 * Setup rule 65 65 */ 66 @R ule66 @RegisterExtension 67 67 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 68 68 public JOSMTestRules test = new JOSMTestRules().https(); … … 75 75 */ 76 76 @Test 77 publicvoid testIanaTldList() throws Exception {77 void testIanaTldList() throws Exception { 78 78 // Check the arrays first as this affects later checks 79 79 // Doing this here makes it easier when updating the lists -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java
r10378 r17275 21 21 import static org.junit.Assert.assertTrue; 22 22 23 import org.junit. Before;24 import org.junit. Ignore;25 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Disabled; 25 import org.junit.jupiter.api.Test; 26 26 27 27 /** … … 31 31 * @version $Revision: 1741724 $ 32 32 */ 33 publicclass EmailValidatorTest {33 class EmailValidatorTest { 34 34 35 35 /** … … 49 49 * Setup 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void setUp() { 53 53 validator = EmailValidator.getInstance(); … … 58 58 */ 59 59 @Test 60 publicvoid testEmail() {60 void testEmail() { 61 61 assertTrue(validator.isValid("jsmith@apache.org")); 62 62 assertFalse(validator.isValid(null)); … … 67 67 */ 68 68 @Test 69 publicvoid testEmailWithNumericAddress() {69 void testEmailWithNumericAddress() { 70 70 assertTrue(validator.isValid("someone@[216.109.118.76]")); 71 71 assertTrue(validator.isValid("someone@yahoo.com")); … … 76 76 */ 77 77 @Test 78 publicvoid testEmailExtension() {78 void testEmailExtension() { 79 79 assertTrue(validator.isValid("jsmith@apache.org")); 80 80 … … 99 99 */ 100 100 @Test 101 publicvoid testEmailWithDash() {101 void testEmailWithDash() { 102 102 assertTrue(validator.isValid("andy.noble@data-workshop.com")); 103 103 … … 114 114 */ 115 115 @Test 116 publicvoid testEmailWithDotEnd() {116 void testEmailWithDotEnd() { 117 117 assertFalse(validator.isValid("andy.noble@data-workshop.com.")); 118 118 } … … 123 123 */ 124 124 @Test 125 publicvoid testEmailWithBogusCharacter() {125 void testEmailWithBogusCharacter() { 126 126 127 127 assertFalse(validator.isValid("andy.noble@\u008fdata-workshop.com")); … … 148 148 */ 149 149 @Test 150 publicvoid testVALIDATOR_315() {150 void testVALIDATOR_315() { 151 151 assertFalse(validator.isValid("me@at&t.net")); 152 152 assertTrue(validator.isValid("me@att.net")); // Make sure TLD is not the cause of the failure … … 157 157 */ 158 158 @Test 159 publicvoid testVALIDATOR_278() {159 void testVALIDATOR_278() { 160 160 assertFalse(validator.isValid("someone@-test.com")); // hostname starts with dash/hyphen 161 161 assertFalse(validator.isValid("someone@test-.com")); // hostname ends with dash/hyphen … … 166 166 */ 167 167 @Test 168 publicvoid testValidator235() {168 void testValidator235() { 169 169 String version = System.getProperty("java.version"); 170 170 if (version.compareTo("1.6") < 0) { … … 184 184 */ 185 185 @Test 186 publicvoid testEmailWithCommas() {186 void testEmailWithCommas() { 187 187 assertFalse(validator.isValid("joeblow@apa,che.org")); 188 188 … … 196 196 */ 197 197 @Test 198 publicvoid testEmailWithSpaces() {198 void testEmailWithSpaces() { 199 199 assertFalse(validator.isValid("joeblow @apache.org")); // TODO - this should be valid? 200 200 … … 215 215 */ 216 216 @Test 217 publicvoid testEmailWithControlChars() {217 void testEmailWithControlChars() { 218 218 for (char c = 0; c < 32; c++) { 219 219 assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com")); … … 227 227 */ 228 228 @Test 229 publicvoid testEmailLocalhost() {229 void testEmailLocalhost() { 230 230 // Check the default is not to allow 231 231 EmailValidator noLocal = EmailValidator.getInstance(false); … … 258 258 */ 259 259 @Test 260 publicvoid testEmailWithSlashes() {260 void testEmailWithSlashes() { 261 261 assertTrue( 262 262 "/ and ! valid in username", … … 278 278 */ 279 279 @Test 280 publicvoid testEmailUserName() {280 void testEmailUserName() { 281 281 282 282 assertTrue(validator.isValid("joe1blow@apache.org")); … … 490 490 * The real solution is to fix the email parsing. 491 491 */ 492 @ Ignore("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing")493 @Test 494 publicvoid testEmailFromPerl() {492 @Disabled("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing") 493 @Test 494 void testEmailFromPerl() { 495 495 for (int index = 0; index < testEmailFromPerl.length; index++) { 496 496 String item = testEmailFromPerl[index].item; … … 507 507 */ 508 508 @Test 509 publicvoid testValidator293() {509 void testValidator293() { 510 510 assertTrue(validator.isValid("abc-@abc.com")); 511 511 assertTrue(validator.isValid("abc_@abc.com")); … … 519 519 */ 520 520 @Test 521 publicvoid testValidator365() {521 void testValidator365() { 522 522 assertFalse(validator.isValid( 523 523 "Loremipsumdolorsitametconsecteturadipiscingelit.Nullavitaeligulamattisrhoncusnuncegestasmattisleo."+ … … 554 554 */ 555 555 @Test 556 publicvoid testEmailAtTLD() {556 void testEmailAtTLD() { 557 557 EmailValidator val = EmailValidator.getInstance(false, true); 558 558 assertTrue(val.isValid("test@com")); … … 563 563 */ 564 564 @Test 565 publicvoid testValidator359() {565 void testValidator359() { 566 566 EmailValidator val = EmailValidator.getInstance(false, true); 567 567 assertFalse(val.isValid("test@.com")); … … 572 572 */ 573 573 @Test 574 publicvoid testValidator374() {574 void testValidator374() { 575 575 assertTrue(validator.isValid("abc@school.school")); 576 576 } … … 580 580 */ 581 581 @Test 582 publicvoid testValidatorName() {582 void testValidatorName() { 583 583 assertEquals("Email validator", EmailValidator.getInstance().getValidatorName()); 584 584 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java
r10378 r17275 15 15 * limitations under the License. 16 16 */ 17 18 17 package org.openstreetmap.josm.data.validation.routines; 19 18 … … 22 21 import static org.junit.Assert.assertTrue; 23 22 24 import org.junit. Before;25 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Test; 26 25 27 26 /** … … 30 29 * @version $Revision: 1741724 $ 31 30 */ 32 publicclass InetAddressValidatorTest {31 class InetAddressValidatorTest { 33 32 34 33 private InetAddressValidator validator; … … 37 36 * Setup 38 37 */ 39 @Before 38 @BeforeEach 40 39 public void setUp() { 41 40 validator = new InetAddressValidator(); … … 46 45 */ 47 46 @Test 48 publicvoid testInetAddressesFromTheWild() {47 void testInetAddressesFromTheWild() { 49 48 // CHECKSTYLE.OFF: SingleSpaceSeparator 50 49 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); … … 59 58 */ 60 59 @Test 61 publicvoid testVALIDATOR_335() {60 void testVALIDATOR_335() { 62 61 assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid", 63 62 validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35")); … … 68 67 */ 69 68 @Test 70 publicvoid testInetAddressesByClass() {69 void testInetAddressesByClass() { 71 70 // CHECKSTYLE.OFF: SingleSpaceSeparator 72 71 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); … … 91 90 */ 92 91 @Test 93 publicvoid testReservedInetAddresses() {92 void testReservedInetAddresses() { 94 93 assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1")); 95 94 assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255")); … … 100 99 */ 101 100 @Test 102 publicvoid testBrokenInetAddresses() {101 void testBrokenInetAddresses() { 103 102 // CHECKSTYLE.OFF: SingleSpaceSeparator 104 103 assertFalse("IP with characters should be invalid", validator.isValid("124.14.32.abc")); … … 119 118 */ 120 119 @Test 121 publicvoid testIPv6() {120 void testIPv6() { 122 121 // The original Perl script contained a lot of duplicate tests. 123 122 // I removed the duplicates I noticed, but there may be more. … … 627 626 */ 628 627 @Test 629 publicvoid testValidatorName() {628 void testValidatorName() { 630 629 assertNull(new InetAddressValidator().getValidatorName()); 631 630 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java
r12620 r17275 21 21 import static org.junit.Assert.assertNull; 22 22 import static org.junit.Assert.assertTrue; 23 import static org.junit. Assert.fail;23 import static org.junit.jupiter.api.Assertions.fail; 24 24 25 25 import java.util.Arrays; 26 26 import java.util.regex.PatternSyntaxException; 27 27 28 import org.junit. Test;28 import org.junit.jupiter.api.Test; 29 29 import org.openstreetmap.josm.tools.Logging; 30 30 … … 35 35 * @since Validator 1.4 36 36 */ 37 publicclass RegexValidatorTest {37 class RegexValidatorTest { 38 38 39 39 private static final String REGEX = "^([abc]*)(?:\\-)([DEF]*)(?:\\-)([123]*)$"; … … 55 55 */ 56 56 @Test 57 publicvoid testSingle() {57 void testSingle() { 58 58 RegexValidator sensitive = new RegexValidator(REGEX); 59 59 RegexValidator insensitive = new RegexValidator(REGEX, false); … … 84 84 */ 85 85 @Test 86 publicvoid testMultipleSensitive() {86 void testMultipleSensitive() { 87 87 88 88 // ------------ Set up Sensitive Validators … … 126 126 */ 127 127 @Test 128 publicvoid testMultipleInsensitive() {128 void testMultipleInsensitive() { 129 129 130 130 // ------------ Set up In-sensitive Validators … … 168 168 */ 169 169 @Test 170 publicvoid testNullValue() {170 void testNullValue() { 171 171 RegexValidator validator = new RegexValidator(REGEX); 172 172 assertFalse("Instance isValid()", validator.isValid(null)); … … 181 181 */ 182 182 @Test 183 publicvoid testMissingRegex() {183 void testMissingRegex() { 184 184 185 185 // Single Regular Expression - null … … 238 238 */ 239 239 @Test 240 publicvoid testExceptions() {240 void testExceptions() { 241 241 String invalidRegex = "^([abCD12]*$"; 242 242 try { … … 252 252 */ 253 253 @Test 254 publicvoid testToString() {254 void testToString() { 255 255 RegexValidator single = new RegexValidator(REGEX); 256 256 assertEquals("Single", "RegexValidator{" + REGEX + "}", single.toString()); … … 264 264 */ 265 265 @Test 266 publicvoid testValidatorName() {266 void testValidatorName() { 267 267 assertNull(new RegexValidator(".*").getValidatorName()); 268 268 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java
r11621 r17275 21 21 import static org.junit.Assert.assertTrue; 22 22 23 import org.junit. Before;24 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Test; 25 25 26 26 /** … … 29 29 * @version $Revision: 1741724 $ 30 30 */ 31 publicclass UrlValidatorTest {31 class UrlValidatorTest { 32 32 33 33 private static final boolean printStatus = false; … … 37 37 * Setup 38 38 */ 39 @Before 39 @BeforeEach 40 40 public void setUp() { 41 41 for (int index = 0; index < testPartsIndex.length - 1; index++) { … … 140 140 */ 141 141 @Test 142 publicvoid testValidator202() {142 void testValidator202() { 143 143 String[] schemes = {"http", "https"}; 144 144 UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS); … … 151 151 */ 152 152 @Test 153 publicvoid testValidator204() {153 void testValidator204() { 154 154 String[] schemes = {"http", "https"}; 155 155 UrlValidator urlValidator = new UrlValidator(schemes); … … 161 161 */ 162 162 @Test 163 publicvoid testValidator218() {163 void testValidator218() { 164 164 UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_2_SLASHES); 165 165 assertTrue("parentheses should be valid in URLs", … … 171 171 */ 172 172 @Test 173 publicvoid testValidator235() {173 void testValidator235() { 174 174 String version = System.getProperty("java.version"); 175 175 if (version.compareTo("1.6") < 0) { … … 190 190 */ 191 191 @Test 192 publicvoid testValidator248() {192 void testValidator248() { 193 193 RegexValidator regex = new RegexValidator(new String[] {"localhost", ".*\\.my-testing"}); 194 194 UrlValidator validator = new UrlValidator(regex, 0); … … 224 224 */ 225 225 @Test 226 publicvoid testValidator288() {226 void testValidator288() { 227 227 UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); 228 228 … … 262 262 */ 263 263 @Test 264 publicvoid testValidator276() {264 void testValidator276() { 265 265 // file:// isn't allowed by default 266 266 UrlValidator validator = new UrlValidator(); … … 319 319 */ 320 320 @Test 321 publicvoid testValidator309() {321 void testValidator309() { 322 322 UrlValidator urlValidator = new UrlValidator(); 323 323 assertTrue(urlValidator.isValid("http://sample.ondemand.com/")); … … 334 334 */ 335 335 @Test 336 publicvoid testValidator339() {336 void testValidator339() { 337 337 UrlValidator urlValidator = new UrlValidator(); 338 338 assertTrue(urlValidator.isValid("http://www.cnn.com/WORLD/?hpt=sitenav")); // without … … 347 347 */ 348 348 @Test 349 publicvoid testValidator339IDN() {349 void testValidator339IDN() { 350 350 UrlValidator urlValidator = new UrlValidator(); 351 351 assertTrue(urlValidator.isValid("http://президент.рф/WORLD/?hpt=sitenav")); // without … … 360 360 */ 361 361 @Test 362 publicvoid testValidator342() {362 void testValidator342() { 363 363 UrlValidator urlValidator = new UrlValidator(); 364 364 assertTrue(urlValidator.isValid("http://example.rocks/")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java
r15745 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;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 7 import static org.openstreetmap.josm.data.coor.LatLon.NORTH_POLE; 8 8 import static org.openstreetmap.josm.data.coor.LatLon.SOUTH_POLE; … … 11 11 import java.util.List; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * JUnit Test of {@link Addresses} validation test. 28 28 */ 29 publicclass AddressesTest {29 class AddressesTest { 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(); … … 57 57 */ 58 58 @Test 59 publicvoid testHouseNumberWithoutStreet() {59 void testHouseNumberWithoutStreet() { 60 60 assertNull(doTestHouseNumberWithoutStreet("", null, null)); 61 61 assertNotNull(doTestHouseNumberWithoutStreet("addr:housenumber=1", null, null)); … … 90 90 */ 91 91 @Test 92 publicvoid testDuplicateHouseNumber() {92 void testDuplicateHouseNumber() { 93 93 String num1 = "addr:housenumber=1 addr:street=Foo "; 94 94 String num2 = "addr:housenumber=2 addr:street=Foo "; … … 116 116 */ 117 117 @Test 118 publicvoid testMultiAddressDuplicates() {118 void testMultiAddressDuplicates() { 119 119 String num1 = "addr:housenumber=1,3 addr:street=Foo"; 120 120 String num2 = "addr:housenumber=1 addr:street=Foo"; -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java
r16006 r17275 4 4 import java.util.stream.Collectors; 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 * JUnit Test of {@link Coastlines} validation test. 14 14 */ 15 publicclass CoastlinesTest {15 class CoastlinesTest { 16 16 17 17 private static final Coastlines COASTLINES = new Coastlines(); … … 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(); … … 30 30 */ 31 31 @Test 32 publicvoid testCoastlineFile() throws Exception {32 void testCoastlineFile() throws Exception { 33 33 ValidatorTestUtils.testSampleFile("nodist/data/coastlines.osm", 34 34 ds -> ds.getWays().stream().filter( -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java
r15071 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 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.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit test of {@link ConditionalKeys}. 16 16 */ 17 publicclass ConditionalKeysTest {17 class ConditionalKeysTest { 18 18 19 19 private final ConditionalKeys test = new ConditionalKeys(); … … 22 22 * Setup test 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules rule = new JOSMTestRules().presets(); … … 30 30 * @throws Exception if an error occurs 31 31 */ 32 @Before 32 @BeforeEach 33 33 public void setUp() throws Exception { 34 34 test.initialize(); … … 39 39 */ 40 40 @Test 41 publicvoid testKeyValid() {41 void testKeyValid() { 42 42 assertTrue(test.isKeyValid("maxspeed:conditional")); 43 43 assertTrue(test.isKeyValid("motor_vehicle:conditional")); … … 55 55 */ 56 56 @Test 57 publicvoid testValueValid() {57 void testValueValid() { 58 58 assertTrue(test.isValueValid("maxspeed:conditional", "120 @ (06:00-19:00)")); 59 59 assertFalse(test.isValueValid("maxspeed:conditional", " @ (06:00-19:00)")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java
r16298 r17275 3 3 4 4 import org.junit.Assert; 5 import org.junit. Before;6 import org.junit. Test;5 import org.junit.jupiter.api.BeforeEach; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.JOSMFixture; 8 8 import org.openstreetmap.josm.TestUtils; … … 17 17 * @author Taylor Smock 18 18 */ 19 publicclass ConnectivityRelationsTest {19 class ConnectivityRelationsTest { 20 20 private ConnectivityRelations check; 21 21 private static final String CONNECTIVITY = "connectivity"; … … 25 25 * @throws Exception if an error occurs 26 26 */ 27 @Before 27 @BeforeEach 28 28 public void setUp() throws Exception { 29 29 JOSMFixture.createUnitTestFixture().init(); … … 43 43 */ 44 44 @Test 45 publicvoid testNoConnectivityTag() {45 void testNoConnectivityTag() { 46 46 Relation relation = createDefaultTestRelation(); 47 47 check.visit(relation); … … 58 58 */ 59 59 @Test 60 publicvoid testMisMatchedLanes() {60 void testMisMatchedLanes() { 61 61 Relation relation = createDefaultTestRelation(); 62 62 check.visit(relation); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java
r15961 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.util.HashMap; 9 9 import java.util.List; 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.coor.EastNorth; … … 27 27 * Unit test of {@link CrossingWays}. 28 28 */ 29 publicclass CrossingWaysTest {29 class CrossingWaysTest { 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 rule = new JOSMTestRules().preferences(); … … 48 48 */ 49 49 @Test 50 publicvoid testGetSegments() {50 void testGetSegments() { 51 51 List<List<WaySegment>> list = CrossingWays.getSegments(new HashMap<>(), EastNorth.ZERO, EastNorth.ZERO); 52 52 assertEquals(1, list.size()); … … 58 58 */ 59 59 @Test 60 publicvoid testIsCoastline() {60 void testIsCoastline() { 61 61 assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=water"))); 62 62 assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=coastline"))); … … 69 69 */ 70 70 @Test 71 publicvoid testIsHighway() {71 void testIsHighway() { 72 72 assertTrue(CrossingWays.isHighway(TestUtils.newWay("highway=motorway"))); 73 73 assertFalse(CrossingWays.isHighway(TestUtils.newWay("highway=rest_area"))); … … 78 78 */ 79 79 @Test 80 publicvoid testIsRailway() {80 void testIsRailway() { 81 81 assertTrue(CrossingWays.isRailway(TestUtils.newWay("railway=rail"))); 82 82 assertFalse(CrossingWays.isRailway(TestUtils.newWay("railway=subway"))); … … 88 88 */ 89 89 @Test 90 publicvoid testIsSubwayOrTramOrRazed() {90 void testIsSubwayOrTramOrRazed() { 91 91 assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=subway"))); 92 92 assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=construction construction=tram"))); … … 101 101 */ 102 102 @Test 103 publicvoid testIsProposedOrAbandoned() {103 void testIsProposedOrAbandoned() { 104 104 assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("highway=proposed"))); 105 105 assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("railway=proposed"))); … … 112 112 */ 113 113 @Test 114 publicvoid testWays() {114 void testWays() { 115 115 Ways test = new CrossingWays.Ways(); 116 116 // isPrimitiveUsable … … 157 157 */ 158 158 @Test 159 publicvoid testBoundaries() {159 void testBoundaries() { 160 160 Boundaries test = new CrossingWays.Boundaries(); 161 161 // isPrimitiveUsable … … 171 171 */ 172 172 @Test 173 publicvoid testSelfCrossing() {173 void testSelfCrossing() { 174 174 SelfCrossing test = new CrossingWays.SelfCrossing(); 175 175 // isPrimitiveUsable -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
r11747 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.coor.LatLon; 9 9 import org.openstreetmap.josm.data.osm.DataSet; … … 20 20 * JUnit Test of "Duplicate node" validation test. 21 21 */ 22 publicclass DuplicateNodeTest {22 class DuplicateNodeTest { 23 23 24 24 /** 25 25 * Setup test by initializing JOSM preferences and projection. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 70 70 */ 71 71 @Test 72 publicvoid testDuplicateNode() {72 void testDuplicateNode() { 73 73 DataSet ds = new DataSet(); 74 74 … … 88 88 */ 89 89 @Test 90 publicvoid testDuplicateNodeMixed() {90 void testDuplicateNodeMixed() { 91 91 doTest(DuplicateNode.DUPLICATE_NODE_MIXED, new Tag("building", "foo"), new Tag("highway", "bar")); 92 92 } … … 96 96 */ 97 97 @Test 98 publicvoid testDuplicateNodeOther() {98 void testDuplicateNodeOther() { 99 99 doTest(DuplicateNode.DUPLICATE_NODE_OTHER); 100 100 } … … 104 104 */ 105 105 @Test 106 publicvoid testDuplicateNodeBuilding() {106 void testDuplicateNodeBuilding() { 107 107 doTest(DuplicateNode.DUPLICATE_NODE_BUILDING, new Tag("building", "foo")); 108 108 } … … 112 112 */ 113 113 @Test 114 publicvoid testDuplicateNodeBoundary() {114 void testDuplicateNodeBoundary() { 115 115 doTest(DuplicateNode.DUPLICATE_NODE_BOUNDARY, new Tag("boundary", "foo")); 116 116 } … … 120 120 */ 121 121 @Test 122 publicvoid testDuplicateNodeHighway() {122 void testDuplicateNodeHighway() { 123 123 doTest(DuplicateNode.DUPLICATE_NODE_HIGHWAY, new Tag("highway", "foo")); 124 124 } … … 128 128 */ 129 129 @Test 130 publicvoid testDuplicateNodeLanduse() {130 void testDuplicateNodeLanduse() { 131 131 doTest(DuplicateNode.DUPLICATE_NODE_LANDUSE, new Tag("landuse", "foo")); 132 132 } … … 136 136 */ 137 137 @Test 138 publicvoid testDuplicateNodeNatural() {138 void testDuplicateNodeNatural() { 139 139 doTest(DuplicateNode.DUPLICATE_NODE_NATURAL, new Tag("natural", "foo")); 140 140 } … … 144 144 */ 145 145 @Test 146 publicvoid testDuplicateNodePower() {146 void testDuplicateNodePower() { 147 147 doTest(DuplicateNode.DUPLICATE_NODE_POWER, new Tag("power", "foo")); 148 148 } … … 152 152 */ 153 153 @Test 154 publicvoid testDuplicateNodeRailway() {154 void testDuplicateNodeRailway() { 155 155 doTest(DuplicateNode.DUPLICATE_NODE_RAILWAY, new Tag("railway", "foo")); 156 156 } … … 160 160 */ 161 161 @Test 162 publicvoid testDuplicateNodeWaterway() {162 void testDuplicateNodeWaterway() { 163 163 doTest(DuplicateNode.DUPLICATE_NODE_WATERWAY, new Tag("waterway", "foo")); 164 164 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateRelationTest.java
r14817 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.TestUtils; 9 9 import org.openstreetmap.josm.data.coor.LatLon; … … 20 20 * JUnit Test of "Duplicate relation" validation test. 21 21 */ 22 publicclass DuplicateRelationTest {22 class DuplicateRelationTest { 23 23 24 24 /** 25 25 * Setup test by initializing JOSM preferences and projection. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 71 71 */ 72 72 @Test 73 publicvoid testDuplicateRelationNoTags() {73 void testDuplicateRelationNoTags() { 74 74 doTest("", "", 75 75 new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true), … … 81 81 */ 82 82 @Test 83 publicvoid testDuplicateRelationSameTags() {83 void testDuplicateRelationSameTags() { 84 84 doTest("type=boundary", "type=boundary", 85 85 new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true), … … 91 91 */ 92 92 @Test 93 publicvoid testDuplicateRelationDifferentTags() {93 void testDuplicateRelationDifferentTags() { 94 94 doTest("type=boundary", "type=multipolygon", 95 95 new ExpectedResult(DuplicateRelation.SAME_RELATION, false)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java
r17222 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.nio.file.Files; 9 9 import java.nio.file.Paths; 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.command.Command; … … 26 26 * JUnit Test of "Duplicate way" validation test. 27 27 */ 28 publicclass DuplicateWayTest {28 class DuplicateWayTest { 29 29 30 30 /** 31 31 * Setup test by initializing JOSM preferences and projection. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 76 76 */ 77 77 @Test 78 publicvoid testDuplicateWayNoTags() {78 void testDuplicateWayNoTags() { 79 79 doTest(DuplicateWay.DUPLICATE_WAY); 80 80 } … … 84 84 */ 85 85 @Test 86 publicvoid testDuplicateWaySameTags() {86 void testDuplicateWaySameTags() { 87 87 doTest(DuplicateWay.DUPLICATE_WAY, "highway=motorway"); 88 88 } … … 92 92 */ 93 93 @Test 94 publicvoid testDuplicateWayDifferentTags() {94 void testDuplicateWayDifferentTags() { 95 95 doTest(DuplicateWay.SAME_WAY, "highway=motorway", "highway=trunk", false); 96 96 } … … 101 101 */ 102 102 @Test 103 publicvoid testFixError() throws Exception {103 void testFixError() throws Exception { 104 104 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "duplicate-ways.osm")), null); 105 105 TEST.startTest(NullProgressMonitor.INSTANCE); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java
r14779 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;7 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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.io.InputStream; 10 10 import java.util.Collection; 11 11 12 import org.junit. Before;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.TestUtils; … … 24 24 * Unit test of {@link HighwaysTest}. 25 25 */ 26 publicclass HighwaysTest {26 class HighwaysTest { 27 27 28 28 /** 29 29 * Setup test. 30 30 */ 31 @Before 31 @BeforeEach 32 32 public void setUp() { 33 33 JOSMFixture.createUnitTestFixture().init(); … … 77 77 */ 78 78 @Test 79 publicvoid testCombinations() {79 void testCombinations() { 80 80 assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary_link"))); 81 81 assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary"))); … … 90 90 */ 91 91 @Test 92 publicvoid testSourceMaxSpeedUnitedKingdom() {92 void testSourceMaxSpeedUnitedKingdom() { 93 93 Way link = createTestSetting("primary", "primary"); 94 94 link.put("maxspeed", "60 mph"); … … 108 108 */ 109 109 @Test 110 publicvoid testTicket14891() throws Exception {110 void testTicket14891() throws Exception { 111 111 try (InputStream is = TestUtils.getRegressionDataStream(14891, "14891.osm.bz2")) { 112 112 Collection<Way> ways = OsmReader.parseDataSet(is, null).getWays(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java
r14803 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import static org.openstreetmap.josm.tools.I18n.tr; 9 9 10 10 import java.util.List; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.data.validation.TestError; … … 24 24 * JUnit Test of "Internet Tags" validation test. 25 25 */ 26 publicclass InternetTagsTest {26 class InternetTagsTest { 27 27 28 28 private static final InternetTags TEST = new InternetTags(); … … 31 31 * Setup test by initializing JOSM preferences and projection. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 39 39 */ 40 40 @Test 41 publicvoid testValidUrls() {41 void testValidUrls() { 42 42 testUrl("url", "www.domain.com", true); // No protocol 43 43 testUrl("url", "http://josm.openstreetmap.de", true); // Simple HTTP … … 57 57 */ 58 58 @Test 59 publicvoid testMultipleUrls() {59 void testMultipleUrls() { 60 60 testUrl("url", "http://www.domain-a.com;https://www.domain-b.com", true); // multiple values 61 61 } … … 65 65 */ 66 66 @Test 67 publicvoid testInvalidUrls() {67 void testInvalidUrls() { 68 68 testUrl("url", "something://www.domain.com", false); // invalid protocol 69 69 testUrl("url", "http://www.domain.invalidtld", false); // invalid TLD … … 74 74 */ 75 75 @Test 76 publicvoid testValidEmails() {76 void testValidEmails() { 77 77 testEmail("email", "contact@www.domain.com", true); // Simple email 78 78 testEmail("contact:email", "john.doe@other-domain.org", true); // Key with : + dash in domain … … 83 83 */ 84 84 @Test 85 publicvoid testInvalidEmails() {85 void testInvalidEmails() { 86 86 testEmail("email", "contact at www.domain.com", false); // No @ 87 87 testEmail("contact:email", "john.doe@other-domain.invalidtld", false); // invalid TLD … … 92 92 */ 93 93 @Test 94 publicvoid testInvalidSlashes() {94 void testInvalidSlashes() { 95 95 TestError error = testUrl("website", "http:\\\\www.sjoekurs.no", false).get(0); 96 96 assertEquals(tr("''{0}'': {1}", "website", tr("URL contains backslashes instead of slashes")), error.getDescription()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java
r11403 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 import org.openstreetmap.josm.data.osm.OsmUtils; … … 13 13 * Unit tests of {@link Lanes}. 14 14 */ 15 publicclass LanesTest {15 class LanesTest { 16 16 17 17 private final Lanes lanes = new Lanes(); … … 21 21 * @throws Exception if an error occurs 22 22 */ 23 @Before 23 @BeforeEach 24 24 public void setUp() throws Exception { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testLanesCount() {34 void testLanesCount() { 35 35 assertEquals(0, Lanes.getLanesCount("")); 36 36 assertEquals(1, Lanes.getLanesCount("left")); … … 41 41 42 42 @Test 43 publicvoid test1() {43 void test1() { 44 44 lanes.check(OsmUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes")); 45 45 assertEquals("Number of lane dependent values inconsistent", lanes.getErrors().get(0).getMessage()); … … 47 47 48 48 @Test 49 publicvoid test2() {49 void test2() { 50 50 lanes.check(OsmUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated")); 51 51 assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage()); … … 53 53 54 54 @Test 55 publicvoid test3() {55 void test3() { 56 56 lanes.check(OsmUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left")); 57 57 assertTrue(lanes.getErrors().isEmpty()); … … 59 59 60 60 @Test 61 publicvoid test4() {61 void test4() { 62 62 lanes.check(OsmUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3")); 63 63 assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage()); … … 65 65 66 66 @Test 67 publicvoid test5() {67 void test5() { 68 68 lanes.check(OsmUtils.createPrimitive("way lanes:forward=5 turn:lanes:forward=left|right")); 69 69 assertEquals("Number of lanes:forward greater than *:lanes:forward", lanes.getErrors().get(0).getMessage()); … … 71 71 72 72 @Test 73 publicvoid test6() {73 void test6() { 74 74 lanes.check(OsmUtils.createPrimitive("way lanes:forward=foo|bar turn:lanes:forward=foo+bar")); 75 75 assertTrue(lanes.getErrors().isEmpty()); … … 77 77 78 78 @Test 79 publicvoid test7() {79 void test7() { 80 80 lanes.check(OsmUtils.createPrimitive("way lanes=3 lanes:forward=3 lanes:backward=7")); 81 81 assertEquals("Number of lanes:forward+lanes:backward greater than lanes", lanes.getErrors().get(0).getMessage()); … … 83 83 84 84 @Test 85 publicvoid test8() {85 void test8() { 86 86 lanes.check(OsmUtils.createPrimitive( 87 87 "way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none")); … … 90 90 91 91 @Test 92 publicvoid test9() {92 void test9() { 93 93 lanes.check(OsmUtils.createPrimitive("way highway=secondary lanes=2 source:lanes=survey")); 94 94 assertTrue(lanes.getErrors().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.coor.LatLon; 9 9 import org.openstreetmap.josm.data.osm.Node; … … 16 16 * JUnit Test of "Long Segment" validation test. 17 17 */ 18 publicclass LongSegmentTest {18 class LongSegmentTest { 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(); … … 39 39 */ 40 40 @Test 41 publicvoid testLongSegment() throws Exception {41 void testLongSegment() throws Exception { 42 42 // Long way 43 43 Way w = new Way(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r16360 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.io.InputStream; … … 16 16 import java.util.Set; 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.ChangePropertyCommand; … … 51 51 * JUnit Test of {@link MapCSSTagChecker}. 52 52 */ 53 publicclass MapCSSTagCheckerTest {53 class MapCSSTagCheckerTest { 54 54 55 55 /** 56 56 * Setup test. 57 57 */ 58 @R ule58 @RegisterExtension 59 59 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 60 60 public JOSMTestRules test = new JOSMTestRules().projection().territories().preferences(); … … 63 63 * Setup test. 64 64 */ 65 @Before 65 @BeforeEach 66 66 public void setUp() { 67 67 MapCSSTagCheckerAsserts.clear(); … … 72 72 Set<String> errors = new HashSet<>(); 73 73 test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css), errors::add).parseChecks); 74 assertTrue(errors. toString(), errors.isEmpty());74 assertTrue(errors.isEmpty(), errors::toString); 75 75 return test; 76 76 } … … 81 81 */ 82 82 @Test 83 publicvoid testNaturalMarsh() throws ParseException {83 void testNaturalMarsh() throws ParseException { 84 84 ParseResult result = TagCheck.readMapCSS(new StringReader( 85 85 "*[natural=marsh] {\n" + … … 122 122 */ 123 123 @Test 124 publicvoid testTicket10913() throws ParseException {124 void testTicket10913() throws ParseException { 125 125 final OsmPrimitive p = TestUtils.addFakeDataSet(TestUtils.newWay("highway=tertiary construction=yes")); 126 126 final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" + … … 141 141 */ 142 142 @Test 143 publicvoid testTicket9782() throws ParseException {143 void testTicket9782() throws ParseException { 144 144 final MapCSSTagChecker test = buildTagChecker("*[/.+_name/][!name] {" + 145 145 "throwWarning: tr(\"has {0} but not {1}\", \"{0.key}\", \"{1.key}\");}"); … … 156 156 */ 157 157 @Test 158 publicvoid testTicket10859() throws ParseException {158 void testTicket10859() throws ParseException { 159 159 final MapCSSTagChecker test = buildTagChecker("way[highway=footway][foot?!] {\n" + 160 160 " throwWarning: tr(\"{0} used with {1}\", \"{0.value}\", \"{1.tag}\");}"); … … 171 171 */ 172 172 @Test 173 publicvoid testTicket13630() throws ParseException {173 void testTicket13630() throws ParseException { 174 174 ParseResult result = TagCheck.readMapCSS(new StringReader( 175 175 "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}")); … … 183 183 */ 184 184 @Test 185 publicvoid testPreprocessing() throws ParseException {185 void testPreprocessing() throws ParseException { 186 186 final MapCSSTagChecker test = buildTagChecker( 187 187 "@supports (min-josm-version: 0) { *[foo] { throwWarning: \"!\"; } }\n" + … … 196 196 */ 197 197 @Test 198 publicvoid testInit() throws Exception {198 void testInit() throws Exception { 199 199 Logging.clearLastErrorAndWarnings(); 200 200 MapCSSTagChecker c = new MapCSSTagChecker(); 201 201 c.initialize(); 202 202 203 assertTrue( "no warnings/errors are logged", Logging.getLastErrorAndWarnings().isEmpty());203 assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), "no warnings/errors are logged"); 204 204 205 205 // to trigger MapCSSStyleIndex code … … 214 214 */ 215 215 @Test 216 publicvoid testAssertions() throws Exception {216 void testAssertions() throws Exception { 217 217 MapCSSTagChecker c = new MapCSSTagChecker(); 218 218 Set<String> assertionErrors = new LinkedHashSet<>(); … … 226 226 Logging.error(msg); 227 227 } 228 assertTrue( "not all assertions included in the tests are met", assertionErrors.isEmpty());228 assertTrue(assertionErrors.isEmpty(), "not all assertions included in the tests are met"); 229 229 } 230 230 … … 234 234 */ 235 235 @Test 236 publicvoid testAssertInsideCountry() throws ParseException {236 void testAssertInsideCountry() throws ParseException { 237 237 final MapCSSTagChecker test = buildTagChecker( 238 238 "node[amenity=parking][inside(\"BR\")] {\n" + … … 249 249 */ 250 250 @Test 251 publicvoid testTicket17058() throws ParseException {251 void testTicket17058() throws ParseException { 252 252 final MapCSSTagChecker test = buildTagChecker( 253 253 "*[name =~ /(?i).*Straße.*/][inside(\"LI,CH\")] {\n" + … … 264 264 */ 265 265 @Test 266 publicvoid testTicket13762() throws ParseException {266 void testTicket13762() throws ParseException { 267 267 final ParseResult parseResult = TagCheck.readMapCSS(new StringReader("" + 268 268 "meta[lang=de] {\n" + … … 277 277 */ 278 278 @Test 279 publicvoid testTicket14287() throws Exception {279 void testTicket14287() throws Exception { 280 280 final MapCSSTagChecker test = buildTagChecker( 281 281 "node[amenity=parking] ∈ *[amenity=parking] {" + … … 293 293 */ 294 294 @Test 295 publicvoid testTicket17053() throws ParseException {295 void testTicket17053() throws ParseException { 296 296 final MapCSSTagChecker test = buildTagChecker( 297 297 "way[highway=cycleway][cycleway=track] {\n" + … … 336 336 */ 337 337 @Test 338 publicvoid testTicket12627() throws Exception {338 void testTicket12627() throws Exception { 339 339 doTestNaturalWood(12627, "overlapping.osm", 1, 1); 340 340 } … … 345 345 */ 346 346 @Test 347 publicvoid testTicket14289() throws Exception {347 void testTicket14289() throws Exception { 348 348 doTestNaturalWood(14289, "example2.osm", 3, 3); 349 349 } … … 354 354 */ 355 355 @Test 356 publicvoid testTicket15641() throws ParseException {356 void testTicket15641() throws ParseException { 357 357 assertNotNull(buildTagChecker( 358 358 "relation[type=public_transport][public_transport=stop_area_group] > way {" + … … 366 366 */ 367 367 @Test 368 publicvoid testTicket17358() throws ParseException {368 void testTicket17358() throws ParseException { 369 369 final Collection<TestError> errors = buildTagChecker( 370 370 "*[/^name/=~/Test/]{" + … … 379 379 */ 380 380 @Test 381 publicvoid testTicket17695() throws Exception {381 void testTicket17695() throws Exception { 382 382 final MapCSSTagChecker test = buildTagChecker( 383 383 "*[building] ∈ *[building] {" + … … 396 396 */ 397 397 @Test 398 publicvoid testTicket13165() throws Exception {398 void testTicket13165() throws Exception { 399 399 final MapCSSTagChecker test = buildTagChecker( 400 400 "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {" … … 413 413 */ 414 414 @Test 415 publicvoid testTicket13165IncompleteMP() throws Exception {415 void testTicket13165IncompleteMP() throws Exception { 416 416 final MapCSSTagChecker test = buildTagChecker( 417 417 "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {" … … 431 431 */ 432 432 @Test 433 publicvoid testTicket19053() throws ParseException {433 void testTicket19053() throws ParseException { 434 434 final MapCSSTagChecker test = buildTagChecker( 435 435 "*[ele][ele =~ /^-?[0-9]+\\.[0-9][0-9][0-9]+$/] {" -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.InputStream; 8 8 import java.util.stream.Collectors; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.data.osm.Relation; … … 20 20 * JUnit Test of Multipolygon validation test. 21 21 */ 22 publicclass MultipolygonTestTest {22 class MultipolygonTestTest { 23 23 24 24 … … 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().projection().mapStyles().presets().main().preferences(); … … 35 35 */ 36 36 @Test 37 publicvoid testMultipolygonFile() throws Exception {37 void testMultipolygonFile() throws Exception { 38 38 final MultipolygonTest MULTIPOLYGON_TEST = new MultipolygonTest(); 39 39 final RelationChecker RELATION_TEST = new RelationChecker(); … … 48 48 */ 49 49 @Test 50 publicvoid testTicket17768TouchingInner() throws Exception {50 void testTicket17768TouchingInner() throws Exception { 51 51 try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner.osm")) { 52 52 MultipolygonTest mpTest = new MultipolygonTest(); … … 62 62 */ 63 63 @Test 64 publicvoid testTicket17768TouchingInnerOuter() throws Exception {64 void testTicket17768TouchingInnerOuter() throws Exception { 65 65 try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner-outer.osm")) { 66 66 MultipolygonTest mpTest = new MultipolygonTest(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java
r11131 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.List; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.OsmUtils; 11 11 import org.openstreetmap.josm.data.validation.TestError; … … 17 17 * JUnit Test of "Name mismatch" validation test. 18 18 */ 19 publicclass NameMismatchTest {19 class NameMismatchTest { 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(); … … 36 36 */ 37 37 @Test 38 publicvoid testCase0() {38 void testCase0() { 39 39 final List<TestError> errors = test("node name:de=Europa"); 40 40 assertEquals(1, errors.size()); … … 46 46 */ 47 47 @Test 48 publicvoid testCase1() {48 void testCase1() { 49 49 final List<TestError> errors = test("node name=Europe name:de=Europa"); 50 50 assertEquals(1, errors.size()); … … 56 56 */ 57 57 @Test 58 publicvoid testCase2() {58 void testCase2() { 59 59 final List<TestError> errors = test("node name=Europe name:de=Europa name:en=Europe"); 60 60 assertEquals(0, errors.size()); … … 65 65 */ 66 66 @Test 67 publicvoid testCase3() {67 void testCase3() { 68 68 List<TestError> errors; 69 69 errors = test("node \"name\"=\"Italia - Italien - Italy\""); … … 82 82 */ 83 83 @Test 84 publicvoid testEtymologyWikidata() {84 void testEtymologyWikidata() { 85 85 final List<TestError> errors = test("node name=Foo name:etymology:wikidata=Bar"); 86 86 assertEquals(0, errors.size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r17085 r17275 6 6 import static org.hamcrest.CoreMatchers.not; 7 7 import static org.hamcrest.MatcherAssert.assertThat; 8 import static org.junit. Assert.assertEquals;9 import static org.junit. Assert.assertNotNull;10 import static org.junit. Assert.assertTrue;8 import static org.junit.jupiter.api.Assertions.assertEquals; 9 import static org.junit.jupiter.api.Assertions.assertNotNull; 10 import static org.junit.jupiter.api.Assertions.assertTrue; 11 11 12 12 import java.util.Arrays; … … 17 17 import java.util.Set; 18 18 19 import org.junit. Before;20 import org.junit. Rule;21 import org.junit. Test;19 import org.junit.jupiter.api.BeforeEach; 20 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.api.extension.RegisterExtension; 22 22 import org.openstreetmap.josm.command.ChangePropertyCommand; 23 23 import org.openstreetmap.josm.data.coor.LatLon; … … 41 41 * @see OpeningHourTest 42 42 */ 43 publicclass OpeningHourTestTest {43 class OpeningHourTestTest { 44 44 /** 45 45 * We need preferences for this. We check strings so we need i18n. 46 46 */ 47 @R ule47 @RegisterExtension 48 48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 49 49 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 55 55 * @throws Exception if test cannot be initialized 56 56 */ 57 @Before 57 @BeforeEach 58 58 public void setUp() throws Exception { 59 59 openingHourTest = new OpeningHourTest(); … … 66 66 */ 67 67 @Test 68 publicvoid testCheckOpeningHourSyntax1() {68 void testCheckOpeningHourSyntax1() { 69 69 final String key = "opening_hours"; 70 70 // frequently used tags according to https://taginfo.openstreetmap.org/keys/opening_hours#values … … 82 82 */ 83 83 @Test 84 publicvoid testI18n() {84 void testI18n() { 85 85 final String key = "opening_hours"; 86 86 String value = "."; … … 100 100 */ 101 101 @Test 102 publicvoid testCheckOpeningHourSyntax2() {102 void testCheckOpeningHourSyntax2() { 103 103 final String key = "opening_hours"; 104 104 final List<TestError> errors = checkOpeningHourSyntax(key, "Mo-Tue"); … … 113 113 */ 114 114 @Test 115 publicvoid testCheckOpeningHourSyntax3() {115 void testCheckOpeningHourSyntax3() { 116 116 final String key = "opening_hours"; 117 117 final List<TestError> errors = checkOpeningHourSyntax(key, "Sa-Su 10.00-20.00"); … … 126 126 */ 127 127 @Test 128 publicvoid testCheckOpeningHourSyntax4() {128 void testCheckOpeningHourSyntax4() { 129 129 assertThat(checkOpeningHourSyntax(null, null), isEmpty()); 130 130 assertThat(checkOpeningHourSyntax(null, ""), isEmpty()); … … 139 139 */ 140 140 @Test 141 publicvoid testCheckOpeningHourSyntax5() {141 void testCheckOpeningHourSyntax5() { 142 142 final String key = "opening_hours"; 143 143 assertThat(checkOpeningHourSyntax(key, "badtext"), hasSize(1)); … … 153 153 */ 154 154 @Test 155 publicvoid testCheckOpeningHourSyntax6() {155 void testCheckOpeningHourSyntax6() { 156 156 final String key = "opening_hours"; 157 157 assertThat(checkOpeningHourSyntax(key, "PH open \"always open on public holidays\""), isEmpty()); … … 162 162 */ 163 163 @Test 164 publicvoid testCheckOpeningHourSyntax7() {164 void testCheckOpeningHourSyntax7() { 165 165 final String key = "opening_hours"; 166 166 assertThat(checkOpeningHourSyntax(key, "9:00-18:00"), hasSize(1)); … … 173 173 */ 174 174 @Test 175 publicvoid testCheckOpeningHourSyntaxTicket9367() {175 void testCheckOpeningHourSyntaxTicket9367() { 176 176 final String key = "opening_hours"; 177 177 assertEquals(Severity.WARNING, checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getSeverity()); … … 184 184 */ 185 185 @Test 186 publicvoid testCheckServiceTimeSyntax1() {186 void testCheckServiceTimeSyntax1() { 187 187 final String key = "service_times"; 188 188 // frequently used tags according to https://taginfo.openstreetmap.org/keys/service_times#values … … 203 203 */ 204 204 @Test 205 publicvoid testCheckCollectionTimeSyntax1() {205 void testCheckCollectionTimeSyntax1() { 206 206 final String key = "collection_times"; 207 207 // frequently used tags according to https://taginfo.openstreetmap.org/keys/collection_times#values … … 221 221 */ 222 222 @Test 223 publicvoid testPresetValues() {223 void testPresetValues() { 224 224 final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false, false); 225 225 final Set<Tag> values = new LinkedHashSet<>(); … … 247 247 */ 248 248 @Test 249 publicvoid testTicket17932() {249 void testTicket17932() { 250 250 Logging.clearLastErrorAndWarnings(); 251 251 assertTrue(checkOpeningHourSyntax("opening_hours", "SH off").isEmpty()); … … 261 261 262 262 private static void assertFixEquals(String value, TestError error) { 263 assertNotNull( "fix is not null", error.getFix());264 assertTrue( "fix is ChangePropertyCommand", error.getFix() instanceof ChangePropertyCommand);263 assertNotNull(error.getFix(), "fix is not null"); 264 assertTrue(error.getFix() instanceof ChangePropertyCommand, "fix is ChangePropertyCommand"); 265 265 final ChangePropertyCommand command = (ChangePropertyCommand) error.getFix(); 266 266 assertEquals(1, command.getTags().size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java
r13411 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 import java.util.List; 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.osm.Node; … … 21 21 * JUnit Test of "Public Transport Route" validation test. 22 22 */ 23 publicclass PublicTransportRouteTestTest {23 class PublicTransportRouteTestTest { 24 24 25 25 final PublicTransportRouteTest test = new PublicTransportRouteTest(); … … 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules rules = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testVarious() {38 void testVarious() { 39 39 final List<Node> nodes = Arrays.asList(new Node(), new Node(), new Node(), new Node(), new Node(), new Node()); 40 40 final Way w1 = TestUtils.newWay("", nodes.get(0), nodes.get(1)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java
r16703 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import static org.openstreetmap.josm.data.osm.OsmUtils.createPrimitive; 7 7 8 8 import java.util.List; 9 9 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.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmUtils; … … 23 23 * Unit tests of {@link RelationChecker} class. 24 24 */ 25 publicclass RelationCheckerTest {25 class RelationCheckerTest { 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 rule = new JOSMTestRules().presets(); … … 48 48 49 49 @Test 50 publicvoid testUnknownType() {50 void testUnknownType() { 51 51 Relation r = createRelation("type=foobar"); 52 52 r.addMember(new RelationMember("", new Way())); … … 58 58 59 59 @Test 60 publicvoid testEmpty() {60 void testEmpty() { 61 61 List<TestError> errors = testRelation(createRelation("type=multipolygon")); 62 62 assertEquals(1, errors.size()); … … 65 65 66 66 @Test 67 publicvoid testNormal() {67 void testNormal() { 68 68 Relation r = createRelation("type=multipolygon"); 69 69 r.addMember(new RelationMember("outer", new Way())); … … 73 73 74 74 @Test 75 publicvoid testOuter2() {75 void testOuter2() { 76 76 Relation r = createRelation("type=multipolygon"); 77 77 r.addMember(new RelationMember("outer", new Way())); … … 84 84 85 85 @Test 86 publicvoid testRestrictionViaMissing() {86 void testRestrictionViaMissing() { 87 87 Relation r = createRelation("type=restriction"); 88 88 r.addMember(new RelationMember("from", new Way())); … … 95 95 96 96 @Test 97 publicvoid testRestrictionViaRelation() {97 void testRestrictionViaRelation() { 98 98 Relation r = createRelation("type=restriction"); 99 99 r.addMember(new RelationMember("from", new Way())); … … 108 108 109 109 @Test 110 publicvoid testRestrictionTwoFrom() {110 void testRestrictionTwoFrom() { 111 111 Relation r = createRelation("type=restriction"); 112 112 r.addMember(new RelationMember("from", new Way())); … … 121 121 122 122 @Test 123 publicvoid testRestrictionEmpty() {123 void testRestrictionEmpty() { 124 124 Relation r = createRelation("type=restriction"); 125 125 r.addMember(new RelationMember("from", new Way())); … … 134 134 135 135 @Test 136 publicvoid testPowerMemberExpression() {136 void testPowerMemberExpression() { 137 137 Relation r = createRelation("type=route route=power"); 138 138 r.addMember(new RelationMember("", new Way())); … … 145 145 146 146 @Test 147 publicvoid testBuildingMemberExpression() {147 void testBuildingMemberExpression() { 148 148 Relation r = createRelation("type=building"); 149 149 r.addMember(new RelationMember("outline", new Way())); … … 161 161 162 162 @Test 163 publicvoid testHikingRouteMembers() {163 void testHikingRouteMembers() { 164 164 Relation r = createRelation("type=route route=hiking"); 165 165 r.addMember(new RelationMember("", OsmUtils.createPrimitive("way highway=path"))); … … 176 176 177 177 @Test 178 publicvoid testRouteMemberExpression() {178 void testRouteMemberExpression() { 179 179 Relation r = createRelation("type=route route=tram public_transport:version=2"); 180 180 r.addMember(new RelationMember("", createPrimitive("way railway=tram"))); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java
r16445 r17275 8 8 9 9 import org.junit.Assert; 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 import org.openstreetmap.josm.data.coor.LatLon; … … 19 19 * JUnit Test of Multipolygon validation test. 20 20 */ 21 publicclass SelfIntersectingWayTest {21 class SelfIntersectingWayTest { 22 22 23 23 /** … … 25 25 * @throws Exception if test cannot be initialized 26 26 */ 27 @Before Class27 @BeforeAll 28 28 public static void setUp() throws Exception { 29 29 JOSMFixture.createUnitTestFixture().init(); … … 45 45 */ 46 46 @Test 47 publicvoid testUnclosedWayNormal() {47 void testUnclosedWayNormal() { 48 48 List<Node> nodes = createNodes(); 49 49 … … 68 68 */ 69 69 @Test 70 publicvoid testUnclosedWayFirst() {70 void testUnclosedWayFirst() { 71 71 List<Node> nodes = createNodes(); 72 72 … … 90 90 */ 91 91 @Test 92 publicvoid testUnclosedWayFirstRepeated() {92 void testUnclosedWayFirstRepeated() { 93 93 List<Node> nodes = createNodes(); 94 94 … … 112 112 */ 113 113 @Test 114 publicvoid testUnclosedWayLast() {114 void testUnclosedWayLast() { 115 115 List<Node> nodes = createNodes(); 116 116 … … 134 134 */ 135 135 @Test 136 publicvoid testClosedWay() {136 void testClosedWay() { 137 137 List<Node> nodes = createNodes(); 138 138 … … 158 158 */ 159 159 @Test 160 publicvoid testSpikeWithStartInClosedWay() {160 void testSpikeWithStartInClosedWay() { 161 161 List<Node> nodes = createNodes(); 162 162 … … 181 181 */ 182 182 @Test 183 publicvoid testSpikeWithEndInClosedWay() {183 void testSpikeWithEndInClosedWay() { 184 184 List<Node> nodes = createNodes(); 185 185 … … 204 204 */ 205 205 @Test 206 publicvoid testSpikeInClosedWay() {206 void testSpikeInClosedWay() { 207 207 List<Node> nodes = createNodes(); 208 208 … … 227 227 */ 228 228 @Test 229 publicvoid testClosedWayBarbell() {229 void testClosedWayBarbell() { 230 230 List<Node> nodes = createNodes(); 231 231 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java
r15412 r17275 3 3 4 4 import org.junit.Assert; 5 import org.junit. Before;6 import org.junit. Test;5 import org.junit.jupiter.api.BeforeEach; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.JOSMFixture; 8 8 import org.openstreetmap.josm.TestUtils; … … 14 14 * JUnit Test of the Sharp Angles validation test. 15 15 */ 16 17 public class SharpAnglesTest { 16 class SharpAnglesTest { 18 17 private SharpAngles angles; 19 18 … … 22 21 * @throws Exception if an error occurs 23 22 */ 24 @Before 23 @BeforeEach 25 24 public void setUp() throws Exception { 26 25 JOSMFixture.createUnitTestFixture().init(); … … 33 32 */ 34 33 @Test 35 publicvoid testClosedLoopNoSharpAngles() {34 void testClosedLoopNoSharpAngles() { 36 35 Way way = TestUtils.newWay("highway=residential", 37 36 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 46 45 */ 47 46 @Test 48 publicvoid testClosedLoopSharpAngles() {47 void testClosedLoopSharpAngles() { 49 48 Way way = TestUtils.newWay("highway=residential", 50 49 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 60 59 */ 61 60 @Test 62 publicvoid testMultipleSharpAngles() {61 void testMultipleSharpAngles() { 63 62 Way way = TestUtils.newWay("highway=residential", 64 63 new Node(new LatLon(0.005069377713748322, -0.0014832642674429382)), … … 75 74 */ 76 75 @Test 77 publicvoid testNoSharpAngles() {76 void testNoSharpAngles() { 78 77 Way way = TestUtils.newWay("highway=residential", 79 78 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 88 87 */ 89 88 @Test 90 publicvoid testCheckBadAnglesFromSameNodeTwice() {89 void testCheckBadAnglesFromSameNodeTwice() { 91 90 Way way = TestUtils.newWay("highway=service oneway=yes", 92 91 new Node(new LatLon(52.8903308, 8.4302322)), … … 106 105 */ 107 106 @Test 108 publicvoid testIgnoredCases() {107 void testIgnoredCases() { 109 108 Way way = TestUtils.newWay("highway=residential", 110 109 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java
r15749 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import org.junit. Before;8 import org.junit. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 … … 12 12 * Unit test of {@link SimilarNamedWays} 13 13 */ 14 publicclass SimilarNamedWaysTest {14 class SimilarNamedWaysTest { 15 15 16 16 private final SimilarNamedWays test = new SimilarNamedWays(); … … 19 19 * Setup test 20 20 */ 21 @Before 21 @BeforeEach 22 22 public void setUp() { 23 23 JOSMFixture.createUnitTestFixture().init(); … … 26 26 private void checkSimilarity(String message, String name1, String name2, boolean expected) { 27 27 boolean actual = test.similaryName(name1, name2); 28 assertEquals( message, expected, actual);28 assertEquals(expected, actual, message); 29 29 } 30 30 … … 33 33 */ 34 34 @Test 35 publicvoid testSimilarNames() {35 void testSimilarNames() { 36 36 checkSimilarity("same string", "Testname", "Testname", false); 37 37 checkSimilarity("different case", "Testname", "TestName", true); … … 81 81 */ 82 82 @Test 83 publicvoid testSimilarNamesRegression() {83 void testSimilarNamesRegression() { 84 84 assertFalse(test.similaryName("Unnecessary Name", "Third")); 85 85 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
r16788 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.io.IOException; … … 12 12 13 13 import org.junit.Assert; 14 import org.junit. Ignore;15 import org.junit. Rule;16 import org.junit. Test;14 import org.junit.jupiter.api.Disabled; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 28 * JUnit Test of {@link TagChecker}. 29 29 */ 30 publicclass TagCheckerTest {30 class TagCheckerTest { 31 31 32 32 /** 33 33 * Setup test. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules rule = new JOSMTestRules().presets(); … … 55 55 */ 56 56 @Test 57 publicvoid testMisspelledKey1() throws IOException {57 void testMisspelledKey1() throws IOException { 58 58 final List<TestError> errors = test(OsmUtils.createPrimitive("node Name=Main")); 59 59 assertEquals(1, errors.size()); … … 68 68 */ 69 69 @Test 70 publicvoid testMisspelledKey2() throws IOException {70 void testMisspelledKey2() throws IOException { 71 71 final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse;=forest")); 72 72 assertEquals(1, errors.size()); … … 81 81 */ 82 82 @Test 83 publicvoid testMisspelledKeyButAlternativeInUse() throws IOException {83 void testMisspelledKeyButAlternativeInUse() throws IOException { 84 84 // ticket 12329 85 85 final List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=fuel brand=bah Brand=foo")); … … 97 97 */ 98 98 @Test 99 publicvoid testUpperCaseIgnoredKey() throws IOException {99 void testUpperCaseIgnoredKey() throws IOException { 100 100 // ticket 17468 101 101 final List<TestError> errors = test(OsmUtils.createPrimitive("node wheelchair:Description=bla")); … … 113 113 */ 114 114 @Test 115 publicvoid testUpperCaseInKeyIgnoredTag() throws IOException {115 void testUpperCaseInKeyIgnoredTag() throws IOException { 116 116 // ticket 17468 117 117 final List<TestError> errors = test(OsmUtils.createPrimitive("node land_Area=administrative")); … … 128 128 */ 129 129 @Test 130 publicvoid testTranslatedNameKey() throws IOException {130 void testTranslatedNameKey() throws IOException { 131 131 final List<TestError> errors = test(OsmUtils.createPrimitive("node namez=Baz")); 132 132 assertEquals(1, errors.size()); … … 142 142 */ 143 143 @Test 144 publicvoid testMisspelledTag() throws IOException {144 void testMisspelledTag() throws IOException { 145 145 final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse=forrest")); 146 146 assertEquals(1, errors.size()); … … 156 156 */ 157 157 @Test 158 publicvoid testMisspelledTag2() throws IOException {158 void testMisspelledTag2() throws IOException { 159 159 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=servics")); 160 160 assertEquals(1, errors.size()); … … 172 172 */ 173 173 @Test 174 publicvoid testMisspelledTag3() throws IOException {174 void testMisspelledTag3() throws IOException { 175 175 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=residentail")); 176 176 assertEquals(1, errors.size()); … … 187 187 */ 188 188 @Test 189 publicvoid testShortValNotInPreset2() throws IOException {189 void testShortValNotInPreset2() throws IOException { 190 190 final List<TestError> errors = test(OsmUtils.createPrimitive("node shop=abs")); 191 191 assertEquals(1, errors.size()); … … 201 201 */ 202 202 @Test 203 publicvoid testIgnoredTagsNotInPresets() throws IOException {203 void testIgnoredTagsNotInPresets() throws IOException { 204 204 new TagChecker().initialize(); 205 205 List<String> errors = TagChecker.getIgnoredTags().stream() … … 207 207 .map(Tag::toString) 208 208 .collect(Collectors.toList()); 209 assertTrue(errors. toString(), errors.isEmpty());209 assertTrue(errors.isEmpty(), errors::toString); 210 210 } 211 211 … … 215 215 */ 216 216 @Test 217 publicvoid testTooShortToFix() throws IOException {217 void testTooShortToFix() throws IOException { 218 218 final List<TestError> errors = test(OsmUtils.createPrimitive("node surface=u")); 219 219 assertEquals(1, errors.size()); … … 229 229 */ 230 230 @Test 231 publicvoid testValueDifferentCase() throws IOException {231 void testValueDifferentCase() throws IOException { 232 232 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=Residential")); 233 233 assertEquals(1, errors.size()); … … 244 244 */ 245 245 @Test 246 publicvoid testRegression17246() throws IOException {246 void testRegression17246() throws IOException { 247 247 final List<TestError> errors = test(OsmUtils.createPrimitive("node access=privat")); 248 248 assertEquals(1, errors.size()); … … 274 274 */ 275 275 @Test 276 publicvoid testContainsRemoveUnwantedNonprintingControlCharacters() {276 void testContainsRemoveUnwantedNonprintingControlCharacters() { 277 277 // Check empty string is handled 278 278 doTestUnwantedNonprintingControlCharacters("", Assert::assertFalse, ""); … … 311 311 */ 312 312 @Test 313 publicvoid testTicket17667() {313 void testTicket17667() { 314 314 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Bus 118: Berlin, Rathaus Zehlendorf => Potsdam, Drewitz Stern-Center")); 315 315 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Καρδίτσα → Λάρισα")); … … 324 324 */ 325 325 @Test 326 publicvoid testTicket18322() {326 void testTicket18322() { 327 327 assertTrue(TagChecker.containsUnusualUnicodeCharacter("name", "D36ᴬ")); 328 328 assertFalse(TagChecker.containsUnusualUnicodeCharacter("ref", "D36ᴬ")); … … 337 337 */ 338 338 @Test 339 publicvoid testTicket18449() {339 void testTicket18449() { 340 340 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Hökumət Evi")); 341 341 } … … 345 345 */ 346 346 @Test 347 publicvoid testTicket18740() {347 void testTicket18740() { 348 348 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:ak", "Frɛnkyeman")); 349 349 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:bm", "Esipaɲi")); … … 356 356 */ 357 357 @Test 358 publicvoid testObjectTypeNotSupportedByPreset() throws IOException {358 void testObjectTypeNotSupportedByPreset() throws IOException { 359 359 List<TestError> errors = test(OsmUtils.createPrimitive("relation waterway=river")); 360 360 assertEquals(1, errors.size()); 361 361 assertEquals(TagChecker.INVALID_PRESETS_TYPE, errors.get(0).getCode()); 362 362 errors = test(OsmUtils.createPrimitive("relation type=waterway waterway=river")); 363 assertTrue(errors. toString(), errors.isEmpty());363 assertTrue(errors.isEmpty(), errors::toString); 364 364 } 365 365 366 366 /** 367 367 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19519">Bug #19519</a>. 368 */ 369 @Test 370 @Ignore("broken, see #19519") 371 public void testTicket19519() throws IOException { 368 * @throws IOException ignored 369 */ 370 @Test 371 @Disabled("broken, see #19519") 372 void testTicket19519() throws IOException { 372 373 List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=restaurant cuisine=bavarian;beef_bowl")); 373 374 assertEquals(0, errors.size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 * JUnit Test of turn restriction validation test. 12 12 */ 13 publicclass TurnRestrictionTestTest {13 class TurnRestrictionTestTest { 14 14 15 15 private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest(); … … 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().projection().mapStyles().presets().main(); … … 28 28 */ 29 29 @Test 30 publicvoid testTurnrestrictionFile() throws Exception {30 void testTurnrestrictionFile() throws Exception { 31 31 ValidatorTestUtils.testSampleFile("nodist/data/restriction.osm", 32 32 ds -> ds.getRelations(), -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
r16377 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.util.ArrayList; 9 9 import java.util.List; 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.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * JUnit Test of unclosed ways validation test. 27 27 */ 28 publicclass UnclosedWaysTest {28 class UnclosedWaysTest { 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 test = new JOSMTestRules().projection().mapStyles().presets(); … … 52 52 */ 53 53 @Test 54 publicvoid testTicket10469() throws Exception {54 void testTicket10469() throws Exception { 55 55 UnclosedWays uwTest = new UnclosedWays(); 56 56 uwTest.initialize(); … … 84 84 */ 85 85 @Test 86 publicvoid testWayInMultiPolygon() throws Exception {86 void testWayInMultiPolygon() throws Exception { 87 87 UnclosedWays uwTest = new UnclosedWays(); 88 88 uwTest.initialize(); … … 108 108 */ 109 109 @Test 110 publicvoid testWayInBoundary() throws Exception {110 void testWayInBoundary() throws Exception { 111 111 UnclosedWays uwTest = new UnclosedWays(); 112 112 uwTest.initialize(); … … 132 132 */ 133 133 @Test 134 publicvoid testAmenity() throws Exception {134 void testAmenity() throws Exception { 135 135 UnclosedWays uwTest = new UnclosedWays(); 136 136 uwTest.initialize(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
r16802 r17275 12 12 import java.nio.file.Paths; 13 13 14 import org.junit. Before;15 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.JOSMFixture; 17 17 import org.openstreetmap.josm.TestUtils; … … 26 26 * Unit tests of {@code UnconnectedWays} class. 27 27 */ 28 publicclass UnconnectedWaysTest {28 class UnconnectedWaysTest { 29 29 30 30 private UnconnectedWays bib; … … 34 34 * @throws Exception if the test cannot be initialized 35 35 */ 36 @Before 36 @BeforeEach 37 37 public void setUp() throws Exception { 38 38 bib = new UnconnectedWays.UnconnectedHighways(); … … 48 48 */ 49 49 @Test 50 publicvoid testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {50 void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException { 51 51 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/UnconnectedWaysTest.osm"))) { 52 52 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 67 67 */ 68 68 @Test 69 publicvoid testTicket18051() throws IOException, IllegalDataException, FileNotFoundException {69 void testTicket18051() throws IOException, IllegalDataException, FileNotFoundException { 70 70 try (InputStream fis = TestUtils.getRegressionDataStream(18051, "modified-ways.osm.bz2")) { 71 71 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 87 87 */ 88 88 @Test 89 publicvoid testTicket18106() throws IOException, IllegalDataException, FileNotFoundException {89 void testTicket18106() throws IOException, IllegalDataException, FileNotFoundException { 90 90 try (InputStream fis = TestUtils.getRegressionDataStream(18106, "uncon3.osm")) { 91 91 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 107 107 */ 108 108 @Test 109 publicvoid testTicket18137() throws IOException, IllegalDataException, FileNotFoundException {109 void testTicket18137() throws IOException, IllegalDataException, FileNotFoundException { 110 110 try (InputStream fis = TestUtils.getRegressionDataStream(18137, "18137_npe.osm")) { 111 111 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 127 127 */ 128 128 @Test 129 publicvoid testTicket19568() throws IOException, IllegalDataException, FileNotFoundException {129 void testTicket19568() throws IOException, IllegalDataException, FileNotFoundException { 130 130 try (InputStream fis = TestUtils.getRegressionDataStream(19568, "data.osm")) { 131 131 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UntaggedNodeTest.java
r16618 r17275 8 8 import java.io.InputStream; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.data.osm.DataSet; … … 21 21 * Unit tests of {@code UntaggedNode} class. 22 22 */ 23 publicclass UntaggedNodeTest {23 class UntaggedNodeTest { 24 24 25 25 private final UntaggedNode test = new UntaggedNode(); … … 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules rules = new JOSMTestRules(); … … 37 37 */ 38 38 @Test 39 publicvoid testTicket12436() throws Exception {39 void testTicket12436() throws Exception { 40 40 test.initialize(); 41 41 test.startTest(null); … … 53 53 */ 54 54 @Test 55 publicvoid testTicket12464() throws Exception {55 void testTicket12464() throws Exception { 56 56 test.initialize(); 57 57 test.startTest(null); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java
r16643 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.InputStream; … … 27 27 * Utilities for validator unit tests. 28 28 */ 29 publicfinal class ValidatorTestUtils {29 final class ValidatorTestUtils { 30 30 31 31 private ValidatorTestUtils() { … … 58 58 for (TestError error : errors) { 59 59 Integer code = error.getCode(); 60 assertTrue( name + " does not expect JOSM error code " + code + ": " + error.getDescription(),61 expectedCodes.contains(code));60 assertTrue(expectedCodes.contains(code), 61 name + " does not expect JOSM error code " + code + ": " + error.getDescription()); 62 62 actualCodes.add(code); 63 63 } 64 assertEquals( name + " " + expectedCodes + " => " + actualCodes,65 expectedCodes.size(), actualCodes.size());64 assertEquals(expectedCodes.size(), actualCodes.size(), 65 name + " " + expectedCodes + " => " + actualCodes); 66 66 } else if (t.hasKey("name") && namePredicate != null && namePredicate.test(t.getName())) { 67 67 fail(name + " lacks josm_error_codes tag"); -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/EntitiesTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 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 … … 12 12 * Unit tests for class {@link Entities}. 13 13 */ 14 publicclass EntitiesTest {14 class EntitiesTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(Entities.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/MultipleNameVisitorTest.java
r16951 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 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.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.data.osm.Way; … … 17 17 * Unit tests for class {@link MultipleNameVisitor}. 18 18 */ 19 publicclass MultipleNameVisitorTest {19 class MultipleNameVisitorTest { 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().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testTicket11967() {32 void testTicket11967() { 33 33 MultipleNameVisitor visitor = new MultipleNameVisitor(); 34 34 visitor.visit(Arrays.asList(new Way(), new Way())); … … 40 40 */ 41 41 @Test 42 publicvoid testTicket16652() {42 void testTicket16652() { 43 43 MultipleNameVisitor visitor = new MultipleNameVisitor(); 44 44 visitor.visit(Arrays.asList( -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 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 … … 12 12 * Unit tests for class {@link ValUtil}. 13 13 */ 14 publicclass ValUtilTest {14 class ValUtilTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(ValUtil.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui; 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 … … 12 12 * Unit tests of {@link ConditionalOptionPaneUtil} class. 13 13 */ 14 publicclass ConditionalOptionPaneUtilTest {14 class ConditionalOptionPaneUtilTest { 15 15 16 16 /** 17 17 * Setup rule 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(ConditionalOptionPaneUtil.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui; 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 … … 12 12 * Unit tests of {@link ExceptionDialogUtil} class. 13 13 */ 14 publicclass ExceptionDialogUtilTest {14 class ExceptionDialogUtilTest { 15 15 16 16 /** 17 17 * Setup rule 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(ExceptionDialogUtil.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
r16874 r17275 2 2 package org.openstreetmap.josm.gui; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 import static org.junit.Assume.assumeFalse; 10 10 … … 27 27 import javax.swing.UIManager; 28 28 29 import org.junit. Rule;30 import org.junit. Test;29 import org.junit.jupiter.api.Test; 30 import org.junit.jupiter.api.extension.RegisterExtension; 31 31 import org.openstreetmap.josm.TestUtils; 32 32 import org.openstreetmap.josm.actions.JosmAction; … … 58 58 * Setup test. 59 59 */ 60 @R ule60 @RegisterExtension 61 61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 62 public JOSMTestRules test = new JOSMTestRules().main().projection().https().devAPI().timeout(20000); … … 133 133 */ 134 134 @Test 135 publicvoid testShowVersion() throws Exception {135 void testShowVersion() throws Exception { 136 136 testShow("--version", Version.getInstance().getAgentString()); 137 137 } … … 142 142 */ 143 143 @Test 144 publicvoid testShowHelp() throws Exception {144 void testShowHelp() throws Exception { 145 145 testShow("--help", MainApplication.getHelp().trim()); 146 146 } … … 150 150 */ 151 151 @Test 152 publicvoid testParamType() {152 void testParamType() { 153 153 assertEquals(DownloadParamType.bounds, DownloadParamType.paramType("48.000,16.000,48.001,16.001")); 154 154 assertEquals(DownloadParamType.fileName, DownloadParamType.paramType("data.osm")); … … 164 164 */ 165 165 @Test 166 publicvoid testUpdateAndLoadPlugins() throws PluginListParseException {166 void testUpdateAndLoadPlugins() throws PluginListParseException { 167 167 final String old = System.getProperty("josm.plugins"); 168 168 try { … … 196 196 */ 197 197 @Test 198 publicvoid testSetupUIManager() {198 void testSetupUIManager() { 199 199 assumeFalse(PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR"))); 200 200 MainApplication.setupUIManager(); … … 212 212 */ 213 213 @Test 214 publicvoid testPostConstructorProcessCmdLineEmpty() {214 void testPostConstructorProcessCmdLineEmpty() { 215 215 // Check the method accepts no arguments 216 216 MainApplication.postConstructorProcessCmdLine(new ProgramArguments(new String[0])); … … 245 245 */ 246 246 @Test 247 publicvoid testPostConstructorProcessCmdLineBounds() {247 void testPostConstructorProcessCmdLineBounds() { 248 248 doTestPostConstructorProcessCmdLine( 249 249 "-47.20,-126.75,-47.10,-126.65", … … 256 256 */ 257 257 @Test 258 publicvoid testPostConstructorProcessCmdLineHttpUrl() {258 void testPostConstructorProcessCmdLineHttpUrl() { 259 259 doTestPostConstructorProcessCmdLine( 260 260 "https://api06.dev.openstreetmap.org/api/0.6/map?bbox=-126.75,-47.20,-126.65,-47.10", … … 267 267 */ 268 268 @Test 269 publicvoid testPostConstructorProcessCmdLineFileUrl() throws MalformedURLException {269 void testPostConstructorProcessCmdLineFileUrl() throws MalformedURLException { 270 270 doTestPostConstructorProcessCmdLine( 271 271 Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toUri().toURL().toExternalForm(), … … 278 278 */ 279 279 @Test 280 publicvoid testPostConstructorProcessCmdLineFilename() throws MalformedURLException {280 void testPostConstructorProcessCmdLineFilename() throws MalformedURLException { 281 281 doTestPostConstructorProcessCmdLine( 282 282 Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toFile().getAbsolutePath(), … … 288 288 */ 289 289 @Test 290 publicvoid testGetRegisteredActionShortcut() {290 void testGetRegisteredActionShortcut() { 291 291 Shortcut noKeystroke = Shortcut.registerShortcut("no", "keystroke", 0, 0); 292 292 assertNull(noKeystroke.getKeyStroke()); … … 303 303 */ 304 304 @Test 305 publicvoid testMapFrameListener() {305 void testMapFrameListener() { 306 306 MapFrameListener listener = (o, n) -> { }; 307 307 assertTrue(MainApplication.addMapFrameListener(listener)); … … 315 315 */ 316 316 @Test 317 publicvoid testEnumDownloadParamType() {317 void testEnumDownloadParamType() { 318 318 TestUtils.superficialEnumCodeCoverage(DownloadParamType.class); 319 319 } -
trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNull;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 7 8 8 import java.awt.Color; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.data.osm.DataSet; … … 21 21 * Unit tests of {@link MapScaler} class. 22 22 */ 23 publicclass MapScalerTest {23 class MapScalerTest { 24 24 25 25 /** 26 26 * Setup tests 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 testMapScaler() {36 void testMapScaler() { 37 37 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); 38 38 assertEquals(Color.WHITE, MapScaler.getColor()); -
trunk/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java
r14604 r17275 2 2 package org.openstreetmap.josm.gui; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Test {@link MapStatus} 14 14 */ 15 publicclass MapStatusTest {15 class MapStatusTest { 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 testEqualsContract() {28 void testEqualsContract() { 29 29 TestUtils.assumeWorkingEqualsVerifier(); 30 30 EqualsVerifier.forClass(MapStatus.StatusTextHistory.class) -
trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
r14120 r17275 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.awt.geom.AffineTransform; … … 9 9 import java.util.function.Function; 10 10 11 import org.junit. Before;12 import org.junit. BeforeClass;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; … … 23 23 * @author Michael Zangl 24 24 */ 25 publicclass MapViewStateTest {25 class MapViewStateTest { 26 26 27 27 private static final int WIDTH = 301; … … 32 32 * Setup test. 33 33 */ 34 @Before Class34 @BeforeAll 35 35 public static void setUpBeforeClass() { 36 36 JOSMFixture.createUnitTestFixture().init(); … … 40 40 * Create the default state. 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 state = MapViewState.createDefaultState(WIDTH, HEIGHT); … … 56 56 57 57 center = getter.apply(newState); 58 assertEquals( "east", 3, center.getEastNorth().east(), 0.01);59 assertEquals( "north", 4, center.getEastNorth().north(), 0.01);58 assertEquals(3, center.getEastNorth().east(), 0.01, "east"); 59 assertEquals(4, center.getEastNorth().north(), 0.01, "north"); 60 60 } 61 61 … … 64 64 */ 65 65 @Test 66 publicvoid testGetCenter() {66 void testGetCenter() { 67 67 doTestGetCenter(s -> s.getCenter(), t -> t / 2d); 68 68 } 69 69 70 70 private static void assertHasViewCoords(double x, double y, MapViewPoint center) { 71 assertEquals( "x", x, center.getInViewX(), 0.01);72 assertEquals( "y", y, center.getInViewY(), 0.01);73 assertEquals( "x", x, center.getInView().getX(), 0.01);74 assertEquals( "y", y, center.getInView().getY(), 0.01);71 assertEquals(x, center.getInViewX(), 0.01, "x"); 72 assertEquals(y, center.getInViewY(), 0.01, "y"); 73 assertEquals(x, center.getInView().getX(), 0.01, "x"); 74 assertEquals(y, center.getInView().getY(), 0.01, "y"); 75 75 } 76 76 … … 79 79 */ 80 80 @Test 81 publicvoid testGetForView() {81 void testGetForView() { 82 82 MapViewPoint corner = state.getForView(0, 0); 83 83 assertHasViewCoords(0, 0, corner); … … 97 97 */ 98 98 @Test 99 publicvoid testGetViewSize() {99 void testGetViewSize() { 100 100 assertEquals(WIDTH, state.getViewWidth(), 0.01); 101 101 assertEquals(HEIGHT, state.getViewHeight(), 0.01); … … 106 106 */ 107 107 @Test 108 publicvoid testPointConversions() {108 void testPointConversions() { 109 109 MapViewPoint p = state.getForView(WIDTH / 2d, HEIGHT / 2d); 110 110 assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, p); … … 113 113 LatLon shouldLatLon = ProjectionRegistry.getProjection().getWorldBoundsLatLon().getCenter(); 114 114 EastNorth shouldEastNorth = ProjectionRegistry.getProjection().latlon2eastNorth(shouldLatLon); 115 assertEquals( "east", shouldEastNorth.east(), eastnorth.east(), 0.01);116 assertEquals( "north", shouldEastNorth.north(), eastnorth.north(), 0.01);115 assertEquals(shouldEastNorth.east(), eastnorth.east(), 0.01, "east"); 116 assertEquals(shouldEastNorth.north(), eastnorth.north(), 0.01, "north"); 117 117 MapViewPoint reversed = state.getPointFor(shouldEastNorth); 118 118 assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, reversed); 119 119 120 120 LatLon latlon = p.getLatLon(); 121 assertEquals( "lat", shouldLatLon.lat(), latlon.lat(), 0.01);122 assertEquals( "lon", shouldLatLon.lon(), latlon.lon(), 0.01);121 assertEquals(shouldLatLon.lat(), latlon.lat(), 0.01, "lat"); 122 assertEquals(shouldLatLon.lon(), latlon.lon(), 0.01, "lon"); 123 123 124 124 MapViewPoint p2 = state.getPointFor(new EastNorth(2, 3)); 125 assertEquals( "east", 2, p2.getEastNorth().east(), 0.01);126 assertEquals( "north", 3, p2.getEastNorth().north(), 0.01);125 assertEquals(2, p2.getEastNorth().east(), 0.01, "east"); 126 assertEquals(3, p2.getEastNorth().north(), 0.01, "north"); 127 127 } 128 128 … … 131 131 */ 132 132 @Test 133 publicvoid testGetAffineTransform() {133 void testGetAffineTransform() { 134 134 for (EastNorth en : Arrays.asList(new EastNorth(100, 100), new EastNorth(0, 0), new EastNorth(300, 200), 135 135 new EastNorth(-1, -2.5))) { … … 138 138 Point2D result = transform.transform(new Point2D.Double(en.getX(), en.getY()), null); 139 139 140 assertEquals( "x", should.getInViewX(), result.getX(), 0.01);141 assertEquals( "y", should.getInViewY(), result.getY(), 0.01);140 assertEquals(should.getInViewX(), result.getX(), 0.01, "x"); 141 assertEquals(should.getInViewY(), result.getY(), 0.01, "y"); 142 142 } 143 143 } … … 147 147 */ 148 148 @Test 149 publicvoid testOutsideFlags() {149 void testOutsideFlags() { 150 150 assertEquals(1, Integer.bitCount(MapViewState.OUTSIDE_BOTTOM)); 151 151 assertEquals(1, Integer.bitCount(MapViewState.OUTSIDE_TOP)); … … 160 160 */ 161 161 @Test 162 publicvoid testPointGetOutsideRectangleFlags() {162 void testPointGetOutsideRectangleFlags() { 163 163 MapViewRectangle rect = state.getForView(0, 0).rectTo(state.getForView(10, 10)); 164 164 assertEquals(0, state.getForView(1, 1).getOutsideRectangleFlags(rect)); … … 190 190 */ 191 191 @Test 192 publicvoid testPointOneNormInView() {192 void testPointOneNormInView() { 193 193 MapViewPoint p = state.getForView(5, 15); 194 194 assertEquals(0, p.oneNormInView(p), 1e-10); … … 203 203 */ 204 204 @Test 205 publicvoid testToString() {205 void testToString() { 206 206 assertEquals("MapViewViewPoint [x=1.0, y=2.0]", 207 207 state.getForView(1, 2).toString()); -
trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
r16618 r17275 3 3 4 4 import static org.hamcrest.MatcherAssert.assertThat; 5 import static org.junit. Assert.assertEquals;5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.awt.Point; … … 15 15 import org.hamcrest.CustomTypeSafeMatcher; 16 16 import org.hamcrest.Matcher; 17 import org.junit. Before;18 import org.junit. Rule;19 import org.junit. Test;17 import org.junit.jupiter.api.BeforeEach; 18 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension; 20 20 import org.openstreetmap.josm.data.Bounds; 21 21 import org.openstreetmap.josm.data.ProjectionBounds; … … 33 33 * 34 34 */ 35 publicclass NavigatableComponentTest {35 class NavigatableComponentTest { 36 36 37 37 private static final class NavigatableComponentMock extends NavigatableComponent { … … 54 54 * We need the projection for coordinate conversions. 55 55 */ 56 @R ule56 @RegisterExtension 57 57 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 58 58 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 61 61 * Create a new, fresh {@link NavigatableComponent} 62 62 */ 63 @Before 63 @BeforeEach 64 64 public void setUp() { 65 65 component = new NavigatableComponentMock(); … … 81 81 */ 82 82 @Test 83 publicvoid testDefaultScale() {83 void testDefaultScale() { 84 84 assertEquals(ProjectionRegistry.getProjection().getDefaultZoomInPPD(), component.getScale(), 0.00001); 85 85 } … … 89 89 */ 90 90 @Test 91 publicvoid testPoint2DEastNorth() {91 void testPoint2DEastNorth() { 92 92 assertThat(component.getPoint2D((EastNorth) null), CustomMatchers.is(new Point2D.Double())); 93 93 Point2D shouldBeCenter = component.getPoint2D(component.getCenter()); … … 103 103 */ 104 104 @Test 105 publicvoid testPoint2DLatLon() {105 void testPoint2DLatLon() { 106 106 assertThat(component.getPoint2D((LatLon) null), CustomMatchers.is(new Point2D.Double())); 107 107 // TODO: Really test this. … … 112 112 */ 113 113 @Test 114 publicvoid testZoomToLatLon() {114 void testZoomToLatLon() { 115 115 component.zoomTo(new LatLon(10, 10)); 116 116 Point2D shouldBeCenter = component.getPoint2D(new LatLon(10, 10)); … … 124 124 */ 125 125 @Test 126 publicvoid testZoomToFactor() {126 void testZoomToFactor() { 127 127 EastNorth center = component.getCenter(); 128 128 double initialScale = component.getScale(); … … 150 150 */ 151 151 @Test 152 publicvoid testGetEastNorth() {152 void testGetEastNorth() { 153 153 EastNorth center = component.getCenter(); 154 154 assertThat(component.getEastNorth(WIDTH / 2, HEIGHT / 2), CustomMatchers.is(center)); … … 162 162 */ 163 163 @Test 164 publicvoid testZoomToFactorCenter() {164 void testZoomToFactorCenter() { 165 165 // zoomToFactor(double, double, double) 166 166 // assumes getEastNorth works as expected … … 189 189 */ 190 190 @Test 191 publicvoid testGetProjectionBounds() {191 void testGetProjectionBounds() { 192 192 ProjectionBounds bounds = component.getProjectionBounds(); 193 193 assertThat(bounds.getCenter(), CustomMatchers.is(component.getCenter())); … … 201 201 */ 202 202 @Test 203 publicvoid testGetRealBounds() {203 void testGetRealBounds() { 204 204 Bounds bounds = component.getRealBounds(); 205 205 assertThat(bounds.getCenter(), CustomMatchers.is(component.getLatLon(WIDTH / 2, HEIGHT / 2))); -
trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java
r8509 r17275 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.text.DecimalFormat; … … 8 8 import java.util.Locale; 9 9 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 import org.openstreetmap.josm.data.SystemOfMeasurement; … … 16 16 * Unit tests of {@link SystemOfMeasurement} class. 17 17 */ 18 publicclass SystemOfMeasurementTest {18 class SystemOfMeasurementTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @Before Class23 @BeforeAll 24 24 public static void setUp() { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 30 30 */ 31 31 @Test 32 publicvoid testGetDistText() {32 void testGetDistText() { 33 33 34 34 assertEquals("< 0.01 m", SystemOfMeasurement.METRIC.getDistText(-1)); … … 71 71 */ 72 72 @Test 73 publicvoid testGetDistTextLocalized() {73 void testGetDistTextLocalized() { 74 74 final DecimalFormat format = new DecimalFormat("0.000", DecimalFormatSymbols.getInstance(Locale.GERMAN)); 75 75 assertEquals("0,001 m", SystemOfMeasurement.METRIC.getDistText(0.001, format, 1e-6)); … … 84 84 */ 85 85 @Test 86 publicvoid testGetAreaText() {86 void testGetAreaText() { 87 87 assertEquals("< 0.01 m²", SystemOfMeasurement.METRIC.getAreaText(-1)); 88 88 assertEquals("< 0.01 m²", SystemOfMeasurement.METRIC.getAreaText(-0.99)); -
trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
r14977 r17275 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.lang.reflect.Constructor; … … 15 15 16 16 import org.junit.Assert; 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.testutils.JOSMTestRules; … … 40 40 * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a> 41 41 */ 42 publicclass TableCellRendererTest {42 class TableCellRendererTest { 43 43 44 44 // list of classes that cannot be easily tested and are verified either manually or another unit tests … … 51 51 * Setup test. 52 52 */ 53 @R ule53 @RegisterExtension 54 54 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 55 55 public JOSMTestRules test = new JOSMTestRules().main(); … … 62 62 */ 63 63 @Test 64 publicvoid testTableCellRenderer() throws ReflectiveOperationException {64 void testTableCellRenderer() throws ReflectiveOperationException { 65 65 Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class); 66 66 Assert.assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken -
trunk/test/unit/org/openstreetmap/josm/gui/autofilter/AutoFilterRuleTest.java
r15843 r17275 2 2 package org.openstreetmap.josm.gui.autofilter; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.util.NoSuchElementException; … … 9 9 import java.util.stream.IntStream; 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.data.osm.OsmPrimitive; 14 14 import org.openstreetmap.josm.data.osm.OsmUtils; … … 20 20 * Unit tests of {@link AutoFilterRule} class. 21 21 */ 22 publicclass AutoFilterRuleTest {22 class AutoFilterRuleTest { 23 23 24 24 /** 25 25 * Setup tests 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().i18n(); … … 33 33 */ 34 34 @Test 35 publicvoid testTagValuesForPrimitive() {35 void testTagValuesForPrimitive() { 36 36 // #17109, support values like 0.5 or 1.5 - level values are multiplied by 2 when parsing, values are divided by 2 for formatting 37 37 final AutoFilterRule level = AutoFilterRule.getDefaultRule("level").orElseThrow(NoSuchElementException::new); … … 52 52 */ 53 53 @Test 54 publicvoid testTagValuesForPrimitiveInclineUnit() {54 void testTagValuesForPrimitiveInclineUnit() { 55 55 final AutoFilterRule incline = AutoFilterRule.getDefaultRule("incline").orElseThrow(NoSuchElementException::new); 56 56 assertTagValuesForPrimitive(incline, "way incline=up"); … … 63 63 */ 64 64 @Test 65 publicvoid testTagValuesForPrimitivesDefaults() {65 void testTagValuesForPrimitivesDefaults() { 66 66 final AutoFilterRule layer = AutoFilterRule.getDefaultRule("layer").orElseThrow(NoSuchElementException::new); 67 67 assertTagValuesForPrimitive(layer, "way foo=bar"); … … 85 85 */ 86 86 @Test 87 publicvoid testValueFormatter() {87 void testValueFormatter() { 88 88 final AutoFilterRule voltage = AutoFilterRule.getDefaultRule("voltage").orElseThrow(NoSuchElementException::new); 89 89 assertEquals("230V", voltage.formatValue(230)); -
trunk/test/unit/org/openstreetmap/josm/gui/bbox/SizeButtonTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.bbox; 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 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.gui.bbox.SizeButton.AccessibleSizeButton; … … 17 17 * Unit tests of {@link SizeButton} class. 18 18 */ 19 publicclass SizeButtonTest {19 class SizeButtonTest { 20 20 21 21 /** 22 22 * Setup tests 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testSizeButton() {32 void testSizeButton() { 33 33 SizeButton sb = new SizeButton(new SlippyMapBBoxChooser()); 34 34 sb.paint(TestUtils.newGraphics()); -
trunk/test/unit/org/openstreetmap/josm/gui/bugreport/BugReportSettingsPanelTest.java
r12790 r17275 2 2 package org.openstreetmap.josm.gui.bugreport; 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 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 14 14 * Tests the {@link BugReportSettingsPanel} class. 15 15 */ 16 publicclass BugReportSettingsPanelTest {16 class BugReportSettingsPanelTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testBugReportSettingsPanel() {29 void testBugReportSettingsPanel() { 30 30 assertNotNull(new BugReportSettingsPanel(new BugReport(BugReport.intercept(new Exception())))); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/bugreport/DebugTextDisplayTest.java
r12790 r17275 2 2 package org.openstreetmap.josm.gui.bugreport; 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.gui.datatransfer.ClipboardUtils; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit test of {@link DebugTextDisplay} class. 15 15 */ 16 publicclass DebugTextDisplayTest {16 class DebugTextDisplayTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testGetCodeText() {28 void testGetCodeText() { 29 29 assertEquals("test", new DebugTextDisplay("test").getCodeText()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testCopyToClipboard() {36 void testCopyToClipboard() { 37 37 new DebugTextDisplay("copy").copyToClipboard(); 38 38 assertEquals(String.format("{{{%ncopy%n}}}"), ClipboardUtils.getClipboardStringContent()); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java
r12726 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 6 6 7 7 import java.util.NoSuchElementException; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.command.SequenceCommand; 12 12 import org.openstreetmap.josm.data.conflict.Conflict; … … 23 23 * Unit tests of {@link ConflictResolver} class. 24 24 */ 25 publicclass ConflictResolverTest {25 class ConflictResolverTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 35 35 * Unit test of {@link ConflictResolver#buildResolveCommand} - empty case. 36 36 */ 37 @Test (expected = NoSuchElementException.class)38 publicvoid testBuildResolveCommandEmpty() {39 assert NotNull(new ConflictResolver().buildResolveCommand());37 @Test 38 void testBuildResolveCommandEmpty() { 39 assertThrows(NoSuchElementException.class, () -> new ConflictResolver().buildResolveCommand()); 40 40 } 41 41 … … 44 44 */ 45 45 @Test 46 publicvoid testBuildResolveCommandNode() {46 void testBuildResolveCommandNode() { 47 47 ConflictResolver resolver = new ConflictResolver(); 48 48 Node n1 = new Node(LatLon.SOUTH_POLE); … … 60 60 */ 61 61 @Test 62 publicvoid testBuildResolveCommandWay() {62 void testBuildResolveCommandWay() { 63 63 ConflictResolver resolver = new ConflictResolver(); 64 64 Way w1 = new Way(); … … 76 76 */ 77 77 @Test 78 publicvoid testBuildResolveCommandRelation() {78 void testBuildResolveCommandRelation() { 79 79 ConflictResolver resolver = new ConflictResolver(); 80 80 Relation r1 = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.nodes; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;7 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 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 8 9 9 import java.beans.PropertyChangeEvent; … … 19 19 import javax.swing.DefaultListSelectionModel; 20 20 21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.Test; 22 import org.junit.jupiter.api.extension.RegisterExtension; 23 23 import org.openstreetmap.josm.TestUtils; 24 24 import org.openstreetmap.josm.data.osm.Node; … … 34 34 * Unit tests of {@link NodeListMergeModel}. 35 35 */ 36 publicclass NodeListMergeModelTest {36 class NodeListMergeModelTest { 37 37 38 38 private final DatasetFactory my = new DatasetFactory(); … … 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(); … … 79 79 if (idx[i] instanceof Integer) { 80 80 int j = (Integer) idx[i]; 81 assertTrue( "expected row " + j + " to be selected", model.isSelectedIndex(j));81 assertTrue(model.isSelectedIndex(j), "expected row " + j + " to be selected"); 82 82 break; 83 83 } … … 90 90 } 91 91 for (int j = rows[0]; j <= rows[1]; j++) { 92 assertTrue( "expected row " + j + " to be selected", model.isSelectedIndex(j));92 assertTrue(model.isSelectedIndex(j), "expected row " + j + " to be selected"); 93 93 } 94 94 } … … 96 96 97 97 @Test 98 publicvoid testCopyMyNodesToTop1() {98 void testCopyMyNodesToTop1() { 99 99 NodeListMergeModel model = new NodeListMergeModel(); 100 100 … … 118 118 119 119 @Test 120 publicvoid testCopyMyNodesToTop2() {120 void testCopyMyNodesToTop2() { 121 121 NodeListMergeModel model = new NodeListMergeModel(); 122 122 … … 144 144 145 145 @Test 146 publicvoid testCopyMyNodesToTop3() {146 void testCopyMyNodesToTop3() { 147 147 NodeListMergeModel model = new NodeListMergeModel(); 148 148 … … 170 170 171 171 @Test 172 publicvoid testCopyMyNodesToTop4() {172 void testCopyMyNodesToTop4() { 173 173 NodeListMergeModel model = new NodeListMergeModel(); 174 174 … … 197 197 198 198 @Test 199 publicvoid testCopyMyNodesToEnd1() {199 void testCopyMyNodesToEnd1() { 200 200 NodeListMergeModel model = new NodeListMergeModel(); 201 201 … … 218 218 219 219 @Test 220 publicvoid testCopyMyNodesToEnd2() {220 void testCopyMyNodesToEnd2() { 221 221 NodeListMergeModel model = new NodeListMergeModel(); 222 222 … … 243 243 244 244 @Test 245 publicvoid testCopyMyNodesToEnd3() {245 void testCopyMyNodesToEnd3() { 246 246 NodeListMergeModel model = new NodeListMergeModel(); 247 247 … … 270 270 271 271 @Test 272 publicvoid testCopyMyNodesToEnd4() {272 void testCopyMyNodesToEnd4() { 273 273 NodeListMergeModel model = new NodeListMergeModel(); 274 274 … … 303 303 304 304 @Test 305 publicvoid testCopyMyNodesBeforeCurrent1() {305 void testCopyMyNodesBeforeCurrent1() { 306 306 NodeListMergeModel model = new NodeListMergeModel(); 307 307 … … 330 330 331 331 @Test 332 publicvoid testCopyMyNodesBeforeCurrent2() {332 void testCopyMyNodesBeforeCurrent2() { 333 333 NodeListMergeModel model = new NodeListMergeModel(); 334 334 … … 358 358 359 359 @Test 360 publicvoid testCopyMyNodesBeforeCurrent3() {360 void testCopyMyNodesBeforeCurrent3() { 361 361 NodeListMergeModel model = new NodeListMergeModel(); 362 362 … … 393 393 /* ----------------------------------------------------------------------------- */ 394 394 @Test 395 publicvoid testCopyMyNodesAfterCurrent1() {395 void testCopyMyNodesAfterCurrent1() { 396 396 NodeListMergeModel model = new NodeListMergeModel(); 397 397 … … 420 420 421 421 @Test 422 publicvoid testCopyMyNodesAfterCurrent2() {422 void testCopyMyNodesAfterCurrent2() { 423 423 NodeListMergeModel model = new NodeListMergeModel(); 424 424 … … 449 449 450 450 @Test 451 publicvoid testCopyMyNodesAfterCurrent3() {451 void testCopyMyNodesAfterCurrent3() { 452 452 NodeListMergeModel model = new NodeListMergeModel(); 453 453 … … 482 482 /* ----------------------------------------------------------------------------- */ 483 483 @Test 484 publicvoid testMoveUpMergedNodes1() {484 void testMoveUpMergedNodes1() { 485 485 NodeListMergeModel model = new NodeListMergeModel(); 486 486 … … 508 508 509 509 @Test 510 publicvoid testMoveUpMergedNodes2() {510 void testMoveUpMergedNodes2() { 511 511 NodeListMergeModel model = new NodeListMergeModel(); 512 512 … … 538 538 539 539 @Test 540 publicvoid testMoveUpMergedNodes3() {540 void testMoveUpMergedNodes3() { 541 541 NodeListMergeModel model = new NodeListMergeModel(); 542 542 … … 571 571 /* ----------------------------------------------------------------------------- */ 572 572 @Test 573 publicvoid testMoveDownMergedNodes1() {573 void testMoveDownMergedNodes1() { 574 574 NodeListMergeModel model = new NodeListMergeModel(); 575 575 … … 597 597 598 598 @Test 599 publicvoid testMoveDownMergedNodes2() {599 void testMoveDownMergedNodes2() { 600 600 NodeListMergeModel model = new NodeListMergeModel(); 601 601 … … 627 627 628 628 @Test 629 publicvoid testMoveDownMergedNodes3() {629 void testMoveDownMergedNodes3() { 630 630 NodeListMergeModel model = new NodeListMergeModel(); 631 631 … … 660 660 /* ----------------------------------------------------------------------------- */ 661 661 @Test 662 publicvoid testAddPropertyChangeListener() throws ReflectiveOperationException {662 void testAddPropertyChangeListener() throws ReflectiveOperationException { 663 663 NodeListMergeModel model = new NodeListMergeModel(); 664 664 … … 675 675 676 676 @Test 677 publicvoid testRemovePropertyChangeListener() throws ReflectiveOperationException {677 void testRemovePropertyChangeListener() throws ReflectiveOperationException { 678 678 NodeListMergeModel model = new NodeListMergeModel(); 679 679 … … 693 693 /* ----------------------------------------------------------------------------- */ 694 694 @Test 695 publicvoid testSetFrozen() {695 void testSetFrozen() { 696 696 NodeListMergeModel model = new NodeListMergeModel(); 697 697 model.setFrozen(true); … … 703 703 704 704 @Test 705 publicvoid testSetFrozenWithPropertyChangeNotification() {705 void testSetFrozenWithPropertyChangeNotification() { 706 706 NodeListMergeModel model = new NodeListMergeModel(); 707 707 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergerTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.nodes; 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 of {@link NodeListMerger} class. 14 14 */ 15 publicclass NodeListMergerTest {15 class NodeListMergerTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testNodeListMerger() {28 void testNodeListMerger() { 29 29 assertNotNull(new NodeListMerger()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.properties; 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 javax.swing.event.ChangeEvent; 9 9 import javax.swing.event.ChangeListener; 10 10 11 import org.junit. Before;12 import org.junit. Rule;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.data.conflict.Conflict; 15 15 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * Unit tests of {@link PropertiesMergeModel}. 28 28 */ 29 publicclass PropertiesMergeModelTest {29 class PropertiesMergeModelTest { 30 30 31 31 private abstract static class TestChangeListener implements ChangeListener { … … 50 50 * Setup test. 51 51 */ 52 @R ule52 @RegisterExtension 53 53 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 54 54 public JOSMTestRules test = new JOSMTestRules(); … … 57 57 * Setup test. 58 58 */ 59 @Before 59 @BeforeEach 60 60 public void setUp() { 61 61 model = new PropertiesMergeModel(); … … 67 67 68 68 @Test 69 publicvoid testPopulate() {69 void testPopulate() { 70 70 DataSet d1 = new DataSet(); 71 71 DataSet d2 = new DataSet(); … … 90 90 91 91 @Test 92 publicvoid testDecidingAboutCoords() {92 void testDecidingAboutCoords() { 93 93 DataSet d1 = new DataSet(); 94 94 DataSet d2 = new DataSet(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergerTest.java
r12045 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.properties; 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; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link PropertiesMerger} class. 15 15 */ 16 publicclass PropertiesMergerTest {16 class PropertiesMergerTest { 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().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testPropertiesMerger() {29 void testPropertiesMerger() { 30 30 PropertiesMerger merger = new PropertiesMerger(); 31 31 assertNotNull(TestUtils.getComponentByName(merger, "button.keepmycoordinates")); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMergerTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.relation; 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 of {@link RelationMemberMerger} class. 14 14 */ 15 publicclass RelationMemberMergerTest {15 class RelationMemberMergerTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testRelationMemberMerger() {28 void testRelationMemberMerger() { 29 29 assertNotNull(new RelationMemberMerger()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellEditorTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.relation; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;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 7 8 8 import java.awt.Component; 9 9 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.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.RelationMember; … … 19 19 * Unit tests of {@link RelationMemberTableCellEditor} class. 20 20 */ 21 publicclass RelationMemberTableCellEditorTest {21 class RelationMemberTableCellEditorTest { 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().preferences(); … … 32 32 */ 33 33 @Test 34 publicvoid testRelationMemberTableCellEditor() {34 void testRelationMemberTableCellEditor() { 35 35 RelationMemberTableCellEditor editor = new RelationMemberTableCellEditor(); 36 36 assertNull(editor.getTableCellEditorComponent(null, null, false, 0, 0)); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTable; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.Node; 11 11 import org.openstreetmap.josm.data.osm.RelationMember; … … 19 19 * Unit tests of {@link RelationMemberTableCellRenderer} class. 20 20 */ 21 publicclass RelationMemberTableCellRendererTest {21 class RelationMemberTableCellRendererTest { 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().preferences(); … … 32 32 */ 33 33 @Test 34 publicvoid testRelationMemberTableCellRenderer() {34 void testRelationMemberTableCellRenderer() { 35 35 JTable table = new JTable(new NodeListMergeModel().new EntriesTableModel(ListRole.MY_ENTRIES)); 36 36 RelationMember member = new RelationMember("foo", new Node()); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItemTest.java
r12620 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.tags; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNull;6 import static org.junit. Assert.fail;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.fail; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.Node; 11 11 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 18 18 * Unit tests of {@link TagMergeItem} class. 19 19 */ 20 publicclass TagMergeItemTest {20 class TagMergeItemTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); 28 28 29 29 @Test 30 publicvoid testTagMergeItem() {30 void testTagMergeItem() { 31 31 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 32 32 assertEquals("key", item.getKey()); … … 37 37 38 38 @Test 39 publicvoid testTagMergeItem2() {39 void testTagMergeItem2() { 40 40 Node n1 = new Node(1); 41 41 Node n2 = new Node(1); … … 51 51 52 52 @Test 53 publicvoid testTagMergeItem3() {53 void testTagMergeItem3() { 54 54 Node n1 = new Node(1); 55 55 Node n2 = new Node(1); … … 65 65 66 66 @Test 67 publicvoid testTagMergeItem4() {67 void testTagMergeItem4() { 68 68 Node n1 = new Node(1); 69 69 Node n2 = new Node(1); … … 80 80 81 81 @Test 82 publicvoid testDecide() {82 void testDecide() { 83 83 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 84 84 item.decide(MergeDecisionType.KEEP_MINE); … … 87 87 88 88 @Test 89 publicvoid testDecide1() {89 void testDecide1() { 90 90 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 91 91 try { … … 99 99 100 100 @Test 101 publicvoid testApplyToMyPrimitive() {101 void testApplyToMyPrimitive() { 102 102 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 103 103 item.decide(MergeDecisionType.KEEP_MINE); … … 114 114 115 115 @Test 116 publicvoid testApplyToMyPrimitive2() {116 void testApplyToMyPrimitive2() { 117 117 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 118 118 item.decide(MergeDecisionType.KEEP_THEIR); … … 129 129 130 130 @Test 131 publicvoid testApplyToMyPrimitive3() {131 void testApplyToMyPrimitive3() { 132 132 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 133 133 // item is undecided … … 146 146 147 147 @Test 148 publicvoid testApplyToMyPrimitive4() {148 void testApplyToMyPrimitive4() { 149 149 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 150 150 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModelTest.java
r14092 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.tags; 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.beans.PropertyChangeListener; … … 9 9 import java.util.Set; 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.Node; … … 22 22 */ 23 23 @SuppressWarnings("unchecked") 24 publicclass TagMergeModelTest {24 class TagMergeModelTest { 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(); … … 40 40 41 41 @Test 42 publicvoid testAddPropertyChangeListener() throws ReflectiveOperationException {42 void testAddPropertyChangeListener() throws ReflectiveOperationException { 43 43 TagMergeModel model = new TagMergeModel(); 44 44 PropertyChangeListener listener = evt -> { … … 53 53 54 54 @Test 55 publicvoid testRemovePropertyChangeListener() throws ReflectiveOperationException {55 void testRemovePropertyChangeListener() throws ReflectiveOperationException { 56 56 TagMergeModel model = new TagMergeModel(); 57 57 PropertyChangeListener listener = evt -> { … … 66 66 67 67 @Test 68 publicvoid testPopulateNoConflichts() throws ReflectiveOperationException {68 void testPopulateNoConflichts() throws ReflectiveOperationException { 69 69 Node my = new Node(1); 70 70 Node their = new Node(1); … … 78 78 79 79 @Test 80 publicvoid testPopulateNoConflicts1() throws ReflectiveOperationException {80 void testPopulateNoConflicts1() throws ReflectiveOperationException { 81 81 Node my = new Node(1); 82 82 my.put("key", "value"); … … 92 92 93 93 @Test 94 publicvoid testPopulateMissingKeyMine() throws ReflectiveOperationException {94 void testPopulateMissingKeyMine() throws ReflectiveOperationException { 95 95 Node my = new Node(1); 96 96 Node their = new Node(1); … … 110 110 111 111 @Test 112 publicvoid testPopulateMissingKeyTheir() throws ReflectiveOperationException {112 void testPopulateMissingKeyTheir() throws ReflectiveOperationException { 113 113 Node my = new Node(1); 114 114 my.put("key", "value"); … … 128 128 129 129 @Test 130 publicvoid testPopulateConflictingValues() throws ReflectiveOperationException {130 void testPopulateConflictingValues() throws ReflectiveOperationException { 131 131 Node my = new Node(1); 132 132 my.put("key", "myvalue"); … … 147 147 148 148 @Test 149 publicvoid testAddItem() throws ReflectiveOperationException {149 void testAddItem() throws ReflectiveOperationException { 150 150 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 151 151 TagMergeModel model = new TagMergeModel(); … … 163 163 164 164 @Test 165 publicvoid testDecide() throws ReflectiveOperationException {165 void testDecide() throws ReflectiveOperationException { 166 166 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 167 167 TagMergeModel model = new TagMergeModel(); … … 187 187 188 188 @Test 189 publicvoid testDecideMultiple() throws ReflectiveOperationException {189 void testDecideMultiple() throws ReflectiveOperationException { 190 190 191 191 TagMergeModel model = new TagMergeModel(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.pair.tags; 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 of {@link TagMerger} class. 14 14 */ 15 publicclass TagMergerTest {15 class TagMergerTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testTagMerger() {28 void testTagMerger() { 29 29 assertNotNull(new TagMerger()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditorTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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 of {@link MultiValueCellEditor} class. 14 14 */ 15 publicclass MultiValueCellEditorTest {15 class MultiValueCellEditorTest { 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 testMultiValueCellEditor() {28 void testMultiValueCellEditor() { 29 29 assertNotNull(new MultiValueCellEditor().getTableCellEditorComponent(null, new MultiValueResolutionDecision(), false, 0, 0)); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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.util.Arrays; … … 10 10 import javax.swing.JTable; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.osm.Tag; 15 15 import org.openstreetmap.josm.data.osm.TagCollection; … … 21 21 * Unit tests of {@link MultiValueCellRenderer} class. 22 22 */ 23 publicclass MultiValueCellRendererTest {23 class MultiValueCellRendererTest { 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().preferences(); … … 34 34 */ 35 35 @Test 36 publicvoid testMultiValueCellRenderer() {36 void testMultiValueCellRenderer() { 37 37 TagConflictResolverModel model = new TagConflictResolverModel(); 38 38 TagCollection tags = new TagCollection(Arrays.asList(new Tag("oneway", "yes"), new Tag("oneway", "no"))); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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.assertNull;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.assertNull; 8 8 9 9 import java.awt.Insets; 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.data.osm.OsmPrimitiveType; 14 14 import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo; … … 22 22 * Unit tests of {@link PasteTagsConflictResolverDialog} class. 23 23 */ 24 publicclass PasteTagsConflictResolverDialogTest {24 class PasteTagsConflictResolverDialogTest { 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(); … … 35 35 */ 36 36 @Test 37 publicvoid testPaneTitles() {37 void testPaneTitles() { 38 38 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES); 39 39 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE)); … … 46 46 */ 47 47 @Test 48 publicvoid testStatisticsInfoTable() {48 void testStatisticsInfoTable() { 49 49 StatisticsInfo info = new StatisticsInfo(); 50 50 StatisticsTableModel model = new StatisticsTableModel(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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.util.Arrays; … … 10 10 import java.util.List; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.osm.DataSet; … … 25 25 * Unit tests of {@link RelationMemberConflictResolverModel} class. 26 26 */ 27 publicclass RelationMemberConflictResolverModelTest {27 class RelationMemberConflictResolverModelTest { 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(); … … 58 58 59 59 @Test 60 publicvoid testSameRoles() throws Exception {60 void testSameRoles() throws Exception { 61 61 final List<Way> ways = buildTestDataSet(); 62 62 final Relation r = new Relation(); … … 76 76 77 77 @Test 78 publicvoid testDifferentRoles() throws Exception {78 void testDifferentRoles() throws Exception { 79 79 final List<Way> ways = buildTestDataSet(); 80 80 final Relation r = new Relation(); … … 89 89 90 90 @Test 91 publicvoid testDifferentPresence() throws Exception {91 void testDifferentPresence() throws Exception { 92 92 final List<Way> ways = buildTestDataSet(); 93 93 final Relation r = new Relation(); … … 101 101 102 102 @Test 103 publicvoid testEveryMemberIsPresentTwice() throws Exception {103 void testEveryMemberIsPresentTwice() throws Exception { 104 104 final List<Way> ways = buildTestDataSet(); 105 105 final Relation r = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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 of {@link RelationMemberConflictResolver} class. 14 14 */ 15 publicclass RelationMemberConflictResolverTest {15 class RelationMemberConflictResolverTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testRelationMemberConflictResolver() {28 void testRelationMemberConflictResolver() { 29 29 assertNotNull(new RelationMemberConflictResolver(null)); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java
r16164 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.Arrays; … … 11 12 import java.util.HashSet; 12 13 import java.util.List; 14 import java.util.regex.PatternSyntaxException; 13 15 import java.util.stream.Collectors; 14 16 15 import org.junit. Rule;16 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 17 19 import org.openstreetmap.josm.data.osm.Tag; 18 20 import org.openstreetmap.josm.data.osm.TagCollection; … … 27 29 * Unit tests of {@link TagConflictResolutionUtil} class. 28 30 */ 29 publicclass TagConflictResolutionUtilTest {31 class TagConflictResolutionUtilTest { 30 32 31 33 /** 32 34 * Setup test. 33 35 */ 34 @R ule36 @RegisterExtension 35 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 38 public JOSMTestRules test = new JOSMTestRules(); … … 45 47 */ 46 48 @Test 47 publicvoid testApplyAutomaticTagConflictResolution() {49 void testApplyAutomaticTagConflictResolution() { 48 50 // Check that general tag conflict are not resolved 49 51 TagCollection tc = new TagCollection(); … … 106 108 * Unit tests of {@link AutomaticCombine} class. 107 109 */ 108 publicstatic class AutomaticCombineTest {110 static class AutomaticCombineTest { 109 111 110 112 /** … … 127 129 * Setup test. 128 130 */ 129 @R ule131 @RegisterExtension 130 132 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 131 133 public JOSMTestRules test = new JOSMTestRules(); … … 135 137 */ 136 138 @Test 137 publicvoid testMatchesKeyEmptyKey() {139 void testMatchesKeyEmptyKey() { 138 140 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("", "random description", true, ";", null))) { 139 141 assertFalse(resolver.matchesKey("a")); … … 146 148 */ 147 149 @Test 148 publicvoid testMatchesKeyNotRegex() {150 void testMatchesKeyNotRegex() { 149 151 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine( 150 152 "keyname", "random description", false, "|", null))) { … … 161 163 */ 162 164 @Test 163 publicvoid testMatchesKeyRegex() {165 void testMatchesKeyRegex() { 164 166 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("test[45].*", "", true, ";", "Integer"))) { 165 167 assertFalse(resolver.matchesKey("key")); … … 173 175 */ 174 176 @Test 175 publicvoid testInvalidRegex() {177 void testInvalidRegex() { 176 178 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("invalidregex.(]", "", false, ";", null))) { 177 179 // Should not raise exception if the resolver.isRexEx == false: … … 188 190 * Unit test of {@link AutomaticCombine} with invalid regex. 189 191 */ 190 @Test (expected = java.util.regex.PatternSyntaxException.class)191 publicvoid testInvalidRegexExceptionDefaultConstructed() {192 @Test 193 void testInvalidRegexExceptionDefaultConstructed() { 192 194 AutomaticCombine resolver = new AutomaticCombine("AB.(]", "", true, ";", null); 193 resolver.matchesKey("AB"); 194 } 195 195 assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB")); 196 } 196 197 197 198 /** 198 199 * Unit test of {@link AutomaticCombine} with invalid regex. 199 200 */ 200 @Test (expected = java.util.regex.PatternSyntaxException.class)201 publicvoid testInvalidRegexExceptionFullyConstructed() {201 @Test 202 void testInvalidRegexExceptionFullyConstructed() { 202 203 AutomaticCombine resolver = new AutomaticCombine(); 203 204 resolver.key = "AB.(]"; 204 205 resolver.isRegex = true; 205 resolver.matchesKey("AB");206 assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB")); 206 207 } 207 208 … … 210 211 */ 211 212 @Test 212 publicvoid testResolve() {213 void testResolve() { 213 214 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("random", "", true, "|", "String"))) { 214 215 assertEquals(resolver.resolve(newHashSet("value1", "value2")), "value1|value2"); … … 230 231 * Unit tests of {@link AutomaticChoice} class. 231 232 */ 232 publicstatic class AutomaticChoiceTest {233 static class AutomaticChoiceTest { 233 234 /** 234 235 * Setup test. 235 236 */ 236 @R ule237 @RegisterExtension 237 238 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 238 239 public JOSMTestRules test = new JOSMTestRules(); … … 260 261 */ 261 262 @Test 262 publicvoid testMatchesValue() {263 void testMatchesValue() { 263 264 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 264 265 "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) { … … 282 283 */ 283 284 @Test 284 publicvoid testComputeScoreFromValue() {285 void testComputeScoreFromValue() { 285 286 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 286 287 "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) { … … 298 299 */ 299 300 @Test 300 publicvoid testInvalidRegex() {301 void testInvalidRegex() { 301 302 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 302 303 "k", "g", "", false, "invalidregex.(]", "InvalidScore$0\\1$-4"))) { … … 316 317 * Unit test of {@link AutomaticChoice} when invalid regex is used. 317 318 */ 318 @Test (expected = java.util.regex.PatternSyntaxException.class)319 publicvoid testMatchesValueInvalidRegex() {319 @Test 320 void testMatchesValueInvalidRegex() { 320 321 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "InvalidScore$0\\1$-4"); 321 resolver.matchesValue("test");322 assertThrows(PatternSyntaxException.class, () -> resolver.matchesValue("test")); 322 323 } 323 324 … … 325 326 * Unit test of {@link AutomaticChoice} when invalid regex is used. 326 327 */ 327 @Test (expected = java.util.regex.PatternSyntaxException.class)328 publicvoid testComputeScoreFromValueInvalidRegex() {328 @Test 329 void testComputeScoreFromValueInvalidRegex() { 329 330 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "valid"); 330 resolver.computeScoreFromValue("valid"); 331 } 332 331 assertThrows(PatternSyntaxException.class, () -> resolver.computeScoreFromValue("valid")); 332 } 333 333 334 334 /** … … 336 336 */ 337 337 @Test 338 publicvoid testComputeScoreFromValueInvalidReplacement() {338 void testComputeScoreFromValueInvalidReplacement() { 339 339 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "valid", "InvalidScore$0\\1$-4"); 340 340 boolean exceptionThrown = false; … … 351 351 * Unit tests of {@link AutomaticChoiceGroup} class. 352 352 */ 353 publicstatic class AutomaticChoiceGroupTest {353 static class AutomaticChoiceGroupTest { 354 354 /** 355 355 * Setup test. 356 356 */ 357 @R ule357 @RegisterExtension 358 358 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 359 359 public JOSMTestRules test = new JOSMTestRules(); … … 373 373 */ 374 374 @Test 375 publicvoid testGroupChoices() {375 void testGroupChoices() { 376 376 Collection<AutomaticChoiceGroup> groups = AutomaticChoiceGroup.groupChoices(Arrays.asList(choiceKey1Group1, choiceKey1Group2)); 377 377 assertEquals(2, groups.size()); … … 405 405 */ 406 406 @Test 407 publicvoid testMatchesKey() {407 void testMatchesKey() { 408 408 AutomaticChoiceGroup group = new AutomaticChoiceGroup( 409 409 choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex, … … 427 427 */ 428 428 @Test 429 publicvoid testResolve() {429 void testResolve() { 430 430 AutomaticChoiceGroup group = new AutomaticChoiceGroup( 431 431 choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex, -
trunk/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.correction; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.Arrays; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.correction.RoleCorrection; 15 15 import org.openstreetmap.josm.data.osm.Node; … … 23 23 * Unit tests of {@link RoleCorrectionTable} class. 24 24 */ 25 publicclass RoleCorrectionTableTest {25 class RoleCorrectionTableTest { 26 26 27 27 /** 28 28 * Setup tests 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testRoleCorrectionTable() {38 void testRoleCorrectionTable() { 39 39 Relation r = new Relation(); 40 40 RelationMember member = new RelationMember("foo", new Node()); -
trunk/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.correction; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.Arrays; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.correction.TagCorrection; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 20 20 * Unit tests of {@link TagCorrectionTable} class. 21 21 */ 22 publicclass TagCorrectionTableTest {22 class TagCorrectionTableTest { 23 23 24 24 /** 25 25 * Setup tests 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 testTagCorrectionTable() {35 void testTagCorrectionTable() { 36 36 TagCorrection tc1 = new TagCorrection("foo", "bar", "foo", "baz"); 37 37 TagCorrection tc2 = new TagCorrection("bar", "foo", "baz", "foo"); -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/ClipboardUtilsTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 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.assertSame;8 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.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 import static org.junit.Assume.assumeTrue; 10 10 … … 17 17 import java.io.IOException; 18 18 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.extension.RegisterExtension; 20 import org.junit.jupiter.api.Test; 21 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 22 … … 28 28 * @author Michael Zangl 29 29 */ 30 publicclass ClipboardUtilsTest {30 class ClipboardUtilsTest { 31 31 private static final class ThrowIllegalStateClipboard extends Clipboard { 32 32 private int failingAccesses = 3; … … 70 70 * No dependencies 71 71 */ 72 @R ule72 @RegisterExtension 73 73 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 74 74 public JOSMTestRules test = new JOSMTestRules(); … … 78 78 */ 79 79 @Test 80 publicvoid testGetClipboard() {80 void testGetClipboard() { 81 81 Clipboard c = ClipboardUtils.getClipboard(); 82 82 assertNotNull(c); … … 88 88 */ 89 89 @Test 90 publicvoid testCopyPasteString() {90 void testCopyPasteString() { 91 91 ClipboardUtils.copyString(""); 92 92 assertEquals("", ClipboardUtils.getClipboardStringContent()); … … 102 102 */ 103 103 @Test 104 publicvoid testGetContentIllegalState() {104 void testGetContentIllegalState() { 105 105 ThrowIllegalStateClipboard throwingClipboard = new ThrowIllegalStateClipboard("test"); 106 106 … … 118 118 */ 119 119 @Test 120 publicvoid testSystemSelectionDoesNotFail() {120 void testSystemSelectionDoesNotFail() { 121 121 assumeTrue(GraphicsEnvironment.isHeadless()); 122 122 assertNull(ClipboardUtils.getSystemSelection()); … … 128 128 */ 129 129 @Test 130 publicvoid testUtilityClass() throws ReflectiveOperationException {130 void testUtilityClass() throws ReflectiveOperationException { 131 131 UtilityClassTestUtil.assertUtilityClassWellDefined(ClipboardUtils.class); 132 132 } -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/LayerTransferableTest.java
r10605 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertSame; 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.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.awt.datatransfer.DataFlavor; … … 11 12 import java.util.Arrays; 12 13 13 import org.junit. Before;14 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 15 16 import org.openstreetmap.josm.gui.datatransfer.LayerTransferable.Data; 16 17 import org.openstreetmap.josm.gui.layer.Layer; … … 24 25 * @since 10605 25 26 */ 26 publicclass LayerTransferableTest {27 class LayerTransferableTest { 27 28 private TestLayer layer1; 28 29 private TestLayer layer2; … … 32 33 * Set up test data 33 34 */ 34 @Before 35 @BeforeEach 35 36 public void createTestData() { 36 37 layer1 = new LayerManagerTest.TestLayer(); … … 45 46 */ 46 47 @Test 47 publicvoid testLayerData() {48 void testLayerData() { 48 49 Data data = new Data(manager, Arrays.<Layer>asList(layer1, layer2)); 49 50 … … 59 60 */ 60 61 @Test 61 publicvoid testSupportedDataFlavor() {62 void testSupportedDataFlavor() { 62 63 LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2)); 63 64 … … 75 76 */ 76 77 @Test 77 publicvoid testTransferData() throws Exception {78 void testTransferData() throws Exception { 78 79 LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2)); 79 80 … … 88 89 /** 89 90 * Test {@link LayerTransferable#getTransferData(DataFlavor)} for unsupported {@link DataFlavor} 90 * @throws Exception if any error occurs91 91 */ 92 @Test (expected = UnsupportedFlavorException.class)93 public void testTransferDataUnsupported() throws Exception{92 @Test 93 void testTransferDataUnsupported() { 94 94 LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2)); 95 95 96 transferable.getTransferData(DataFlavor.imageFlavor);96 assertThrows(UnsupportedFlavorException.class, () -> transferable.getTransferData(DataFlavor.imageFlavor)); 97 97 } 98 98 } -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 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 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.actions.CopyAction; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 23 23 * Unit tests of {@link OsmTransferHandler} class. 24 24 */ 25 publicclass OsmTransferHandlerTest {25 class OsmTransferHandlerTest { 26 26 /** 27 27 * Prefs to use OSM primitives 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules().preferences().projection().main(); … … 37 37 */ 38 38 @Test 39 publicvoid testPasteOn() {39 void testPasteOn() { 40 40 DataSet ds1 = new DataSet(); 41 41 Node n1 = new Node(new LatLon(43, 1)); … … 63 63 */ 64 64 @Test 65 publicvoid testPasteTags() {65 void testPasteTags() { 66 66 Node n = new Node(LatLon.ZERO); 67 67 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(n), "testPasteTags", null)); -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferableTest.java
r10604 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.awt.datatransfer.DataFlavor; … … 13 14 import java.util.List; 14 15 15 import org.junit. Rule;16 import org.junit. Test;16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 17 18 import org.openstreetmap.josm.data.osm.Node; 18 19 import org.openstreetmap.josm.data.osm.NodeData; … … 27 28 * Unit tests of {@link PrimitiveTransferable} class. 28 29 */ 29 publicclass PrimitiveTransferableTest {30 class PrimitiveTransferableTest { 30 31 /** 31 32 * Prefs to use OSM primitives 32 33 */ 33 @R ule34 @RegisterExtension 34 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 36 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 39 40 */ 40 41 @Test 41 publicvoid testGetTransferDataFlavors() {42 void testGetTransferDataFlavors() { 42 43 List<DataFlavor> flavors = Arrays.asList(new PrimitiveTransferable(null).getTransferDataFlavors()); 43 44 int ptd = flavors.indexOf(PrimitiveTransferData.DATA_FLAVOR); … … 57 58 */ 58 59 @Test 59 publicvoid testIsDataFlavorSupported() {60 void testIsDataFlavorSupported() { 60 61 assertTrue(new PrimitiveTransferable(null).isDataFlavorSupported(PrimitiveTransferData.DATA_FLAVOR)); 61 62 assertFalse(new PrimitiveTransferable(null).isDataFlavorSupported(DataFlavor.imageFlavor)); … … 67 68 */ 68 69 @Test 69 publicvoid testGetTransferDataNominal() throws UnsupportedFlavorException {70 void testGetTransferDataNominal() throws UnsupportedFlavorException { 70 71 PrimitiveTransferData data = PrimitiveTransferData.getData(Collections.singleton(new Node(1))); 71 72 PrimitiveTransferable pt = new PrimitiveTransferable(data); … … 83 84 /** 84 85 * Test of {@link PrimitiveTransferable#getTransferData} method - error case. 85 * @throws UnsupportedFlavorException always86 86 */ 87 @Test (expected = UnsupportedFlavorException.class)88 public void testGetTransferDataError() throws UnsupportedFlavorException{87 @Test 88 void testGetTransferDataError() { 89 89 PrimitiveTransferData data = PrimitiveTransferData.getData(Collections.singleton(new Node(1))); 90 new PrimitiveTransferable(data).getTransferData(DataFlavor.imageFlavor);90 assertThrows(UnsupportedFlavorException.class, () -> new PrimitiveTransferable(data).getTransferData(DataFlavor.imageFlavor)); 91 91 } 92 92 } -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 import static org.openstreetmap.josm.gui.datatransfer.RelationMemberTransferable.RELATION_MEMBER_DATA; 8 9 … … 12 13 import java.util.Collections; 13 14 14 import org.junit. Rule;15 import org.junit. Test;15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.PrimitiveData; … … 26 27 * Unit tests of {@link RelationMemberTransferable} class. 27 28 */ 28 publicclass RelationMemberTransferableTest {29 class RelationMemberTransferableTest { 29 30 30 31 /** 31 32 * Setup tests 32 33 */ 33 @R ule34 @RegisterExtension 34 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 36 public JOSMTestRules test = new JOSMTestRules(); … … 39 40 */ 40 41 @Test 41 publicvoid testGetTransferDataFlavors() {42 void testGetTransferDataFlavors() { 42 43 DataFlavor[] flavors = new RelationMemberTransferable(Collections.<RelationMember>emptyList()).getTransferDataFlavors(); 43 44 assertEquals(3, flavors.length); … … 51 52 */ 52 53 @Test 53 publicvoid testIsDataFlavorSupported() {54 void testIsDataFlavorSupported() { 54 55 RelationMemberTransferable transferable = new RelationMemberTransferable(Collections.<RelationMember>emptyList()); 55 56 assertTrue(transferable.isDataFlavorSupported(RELATION_MEMBER_DATA)); … … 63 64 */ 64 65 @Test 65 publicvoid testGetTransferDataNominal() throws UnsupportedFlavorException {66 void testGetTransferDataNominal() throws UnsupportedFlavorException { 66 67 RelationMemberTransferable rmt = new RelationMemberTransferable(Collections.singleton(new RelationMember("test", new Node(1)))); 67 68 assertEquals("node 1 test # incomplete\n", rmt.getTransferData(DataFlavor.stringFlavor)); … … 80 81 /** 81 82 * Test of {@link RelationMemberTransferable#getTransferData} method - error case. 82 * @throws UnsupportedFlavorException always83 83 */ 84 @Test(expected = UnsupportedFlavorException.class) 85 public void testGetTransferDataError() throws UnsupportedFlavorException { 86 new RelationMemberTransferable(Collections.singleton(new RelationMember(null, new Node(1)))).getTransferData(null); 84 @Test 85 void testGetTransferDataError() { 86 assertThrows(UnsupportedFlavorException.class, 87 () -> new RelationMemberTransferable(Collections.singleton(new RelationMember(null, new Node(1)))).getTransferData(null)); 87 88 } 88 89 } -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/TagTransferableTest.java
r11931 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.awt.datatransfer.DataFlavor; 9 10 import java.awt.datatransfer.UnsupportedFlavorException; 10 import java.io.IOException;11 11 import java.util.HashMap; 12 12 import java.util.Map; 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.gui.datatransfer.data.TagTransferData; 17 17 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 22 22 * Unit tests of {@link TagTransferable} class. 23 23 */ 24 publicclass TagTransferableTest {24 class TagTransferableTest { 25 25 26 26 /** 27 27 * Setup tests 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testIsDataFlavorSupported() {37 void testIsDataFlavorSupported() { 38 38 TagTransferable tt = new TagTransferable(null); 39 39 assertTrue(tt.isDataFlavorSupported(TagTransferData.FLAVOR)); … … 48 48 */ 49 49 @Test 50 publicvoid testGetTransferDataNominal() throws Exception {50 void testGetTransferDataNominal() throws Exception { 51 51 Map<String, String> tags = new HashMap<>(); 52 52 tags.put("foo", "bar"); … … 58 58 /** 59 59 * Test of {@link TagTransferable#getTransferData} method - error case. 60 * @throws UnsupportedFlavorException always61 * @throws IOException never62 60 */ 63 @Test (expected = UnsupportedFlavorException.class)64 public void testGetTransferDataError() throws UnsupportedFlavorException, IOException{65 new TagTransferable(null).getTransferData(null);61 @Test 62 void testGetTransferDataError() { 63 assertThrows(UnsupportedFlavorException.class, () -> new TagTransferable(null).getTransferData(null)); 66 64 } 67 65 } -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTagTransferDataTest.java
r10737 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer.data; 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.util.Arrays; 9 9 import java.util.Map; 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.data.osm.Node; 14 14 import org.openstreetmap.josm.data.osm.NodeData; … … 26 26 * @author Michael Zangl 27 27 */ 28 publicclass PrimitiveTagTransferDataTest {28 class PrimitiveTagTransferDataTest { 29 29 /** 30 30 * Prefs only required because of the dependencies of OSM primitives. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 42 42 */ 43 43 @Test 44 publicvoid testPrimitiveTagTransferDataPrimitiveTransferData() {44 void testPrimitiveTagTransferDataPrimitiveTransferData() { 45 45 PrimitiveTagTransferData data = new PrimitiveTagTransferData(PrimitiveTransferData.getData(Arrays.asList(new Node(), new Node()))); 46 46 assertEquals(2, data.getSourcePrimitiveCount(OsmPrimitiveType.NODE)); … … 53 53 */ 54 54 @Test 55 publicvoid testIsHeterogeneousSource() {55 void testIsHeterogeneousSource() { 56 56 // 0 item 57 57 assertFalse(isHeterogeneousSource()); … … 74 74 */ 75 75 @Test 76 publicvoid testGetForPrimitives() {76 void testGetForPrimitives() { 77 77 PrimitiveTagTransferData data = createTestData(); 78 78 TagCollection forNode = data.getForPrimitives(OsmPrimitiveType.NODE); … … 100 100 */ 101 101 @Test 102 publicvoid testGetSourcePrimitiveCount() {102 void testGetSourcePrimitiveCount() { 103 103 PrimitiveTagTransferData data = createTestData(); 104 104 assertEquals(2, data.getSourcePrimitiveCount(OsmPrimitiveType.NODE)); … … 111 111 */ 112 112 @Test 113 publicvoid testGetStatistics() {113 void testGetStatistics() { 114 114 PrimitiveTagTransferData data = createTestData(); 115 115 Map<OsmPrimitiveType, Integer> stats = data.getStatistics(); -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/importers/OsmLinkPasterTest.java
r11282 r17275 2 2 package org.openstreetmap.josm.gui.datatransfer.importers; 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 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.coor.LatLon; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * @author Michael Zangl 17 17 */ 18 publicclass OsmLinkPasterTest {18 class OsmLinkPasterTest { 19 19 /** 20 20 * No dependencies 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testParseLatLon() {30 void testParseLatLon() { 31 31 assertEquals(new LatLon(51.71873, 8.76164), 32 32 OsmLinkPaster.parseLatLon("https://www.openstreetmap.org/#map=17/51.71873/8.76164")); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui.dialogs; 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.gui.dialogs.ChangesetDialog.LaunchChangesetManager; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Unit tests of {@link ChangesetDialog} class. 14 14 */ 15 publicclass ChangesetDialogTest {15 class ChangesetDialogTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules(); … … 27 27 */ 28 28 @Test 29 publicvoid testUtilityClass() throws ReflectiveOperationException {29 void testUtilityClass() throws ReflectiveOperationException { 30 30 UtilityClassTestUtil.assertUtilityClassWellDefined(LaunchChangesetManager.class); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
r14562 r17275 2 2 package org.openstreetmap.josm.gui.dialogs; 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 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.command.Command; … … 21 21 * Unit tests of {@link CommandStackDialog} class. 22 22 */ 23 publicclass CommandStackDialogTest {23 class CommandStackDialogTest { 24 24 25 25 /** 26 26 * Setup tests 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 testCommandStackDialogEmpty() {36 void testCommandStackDialogEmpty() { 37 37 CommandStackDialog dlg = new CommandStackDialog(); 38 38 dlg.showDialog(); … … 46 46 */ 47 47 @Test 48 publicvoid testCommandStackDialogNotEmpty() {48 void testCommandStackDialogNotEmpty() { 49 49 DataSet ds = new DataSet(); 50 50 OsmDataLayer layer = new OsmDataLayer(ds, "", null); … … 79 79 */ 80 80 @Test 81 publicvoid testCommandStackDialogUndoAddCommand() {81 void testCommandStackDialogUndoAddCommand() { 82 82 DataSet ds = new DataSet(); 83 83 OsmDataLayer layer = new OsmDataLayer(ds, "", null); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.dialogs; 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.awt.Color; 8 8 import java.awt.image.BufferedImage; 9 9 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.coor.LatLon; 13 13 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * Unit tests of {@link ConflictDialog} class. 27 27 */ 28 publicclass ConflictDialogTest {28 class ConflictDialogTest { 29 29 30 30 /** 31 31 * Setup tests 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 39 39 */ 40 40 @Test 41 publicvoid testConflictDialog() {41 void testConflictDialog() { 42 42 assertNotNull(new ConflictDialog()); 43 43 } … … 47 47 */ 48 48 @Test 49 publicvoid testGetColor() {49 void testGetColor() { 50 50 assertEquals(Color.gray, ConflictDialog.getColor()); 51 51 } … … 55 55 */ 56 56 @Test 57 publicvoid testConflictPainter() {57 void testConflictPainter() { 58 58 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); 59 59 ConflictPainter cp = new ConflictPainter(MainApplication.getMap().mapView, -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java
r17149 r17275 2 2 package org.openstreetmap.josm.gui.dialogs; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 import static org.openstreetmap.josm.TestUtils.assertEqualsNewline; 6 6 … … 9 9 import javax.swing.JPanel; 10 10 11 import org.junit. After;12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;11 import org.junit.jupiter.api.AfterEach; 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.data.SystemOfMeasurement; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 28 28 * Unit tests of {@link InspectPrimitiveDialog} class. 29 29 */ 30 publicclass InspectPrimitiveDialogTest {30 class InspectPrimitiveDialogTest { 31 31 32 32 /** 33 33 * Setup tests 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles(); … … 40 40 * Setup test 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC"); … … 49 49 * Cleanup test 50 50 */ 51 @After 51 @AfterEach 52 52 public void tearDown() { 53 53 SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put(null); … … 58 58 */ 59 59 @Test 60 publicvoid testGenericMonospacePanel() {60 void testGenericMonospacePanel() { 61 61 assertNotNull(InspectPrimitiveDialog.genericMonospacePanel(new JPanel(), "")); 62 62 } … … 66 66 */ 67 67 @Test 68 publicvoid testBuildDataText() {68 void testBuildDataText() { 69 69 DataSet ds = new DataSet(); 70 70 assertEqualsNewline("", InspectPrimitiveDialog.buildDataText(ds, new ArrayList<>(ds.allPrimitives()))); … … 108 108 */ 109 109 @Test 110 publicvoid testBuildListOfEditorsText() {110 void testBuildListOfEditorsText() { 111 111 DataSet ds = new DataSet(); 112 112 assertEqualsNewline("0 users last edited the selection:\n\n", InspectPrimitiveDialog.buildListOfEditorsText(ds.allPrimitives())); … … 130 130 */ 131 131 @Test 132 publicvoid testBuildMapPaintText() {132 void testBuildMapPaintText() { 133 133 DataSet ds = new DataSet(); 134 134 OsmDataLayer layer = new OsmDataLayer(ds, "", null); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.dialogs; 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.data.osm.DataSet; 7 7 import org.openstreetmap.josm.gui.MainApplication; … … 14 14 * Unit tests of {@link MapPaintDialog} class. 15 15 */ 16 publicclass MapPaintDialogTest {16 class MapPaintDialogTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 27 27 */ 28 28 @Test 29 publicvoid testInfoAction() {29 void testInfoAction() { 30 30 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); 31 31 MainApplication.getMap().mapPaintDialog.new InfoAction().actionPerformed(null); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
r16160 r17275 3 3 4 4 import static java.util.concurrent.TimeUnit.MILLISECONDS; 5 import static org.junit. Assert.assertArrayEquals;6 import static org.junit. Assert.assertEquals;7 import static org.junit. Assert.assertFalse;8 import static org.junit. Assert.assertTrue;9 import static org.junit. Assert.fail;5 import static org.junit.jupiter.api.Assertions.fail; 6 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 7 import static org.junit.jupiter.api.Assertions.assertEquals; 8 import static org.junit.jupiter.api.Assertions.assertFalse; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 10 import static org.openstreetmap.josm.tools.I18n.tr; 11 11 … … 28 28 29 29 import org.awaitility.Awaitility; 30 import org.junit. Rule;31 import org.junit. Test;30 import org.junit.jupiter.api.Test; 31 import org.junit.jupiter.api.extension.RegisterExtension; 32 32 import org.openstreetmap.josm.TestUtils; 33 33 import org.openstreetmap.josm.data.Bounds; … … 55 55 * Unit tests of {@link MinimapDialog} class. 56 56 */ 57 publicclass MinimapDialogTest {57 class MinimapDialogTest { 58 58 59 59 /** 60 60 * Setup tests 61 61 */ 62 @R ule62 @RegisterExtension 63 63 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 64 64 public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().fakeImagery(); … … 68 68 */ 69 69 @Test 70 publicvoid testMinimapDialog() {70 void testMinimapDialog() { 71 71 MinimapDialog dlg = new MinimapDialog(); 72 72 dlg.showDialog(); … … 102 102 assertEquals(equalText, isSelected); 103 103 if (equalText) { 104 assertFalse( "Second selected source found", found);104 assertFalse(found, "Second selected source found"); 105 105 found = true; 106 106 } 107 107 } 108 108 } 109 assertTrue( "Selected source not found in menu", found);109 assertTrue(found, "Selected source not found in menu"); 110 110 } 111 111 … … 199 199 */ 200 200 @Test 201 publicvoid testSourceSwitching() throws Exception {201 void testSourceSwitching() throws Exception { 202 202 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 203 203 // (not that there's a data layer for it to use) … … 246 246 */ 247 247 @Test 248 publicvoid testRefreshSourcesRetainsSelection() throws Exception {248 void testRefreshSourcesRetainsSelection() throws Exception { 249 249 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 250 250 // (not that there's a data layer for it to use) … … 284 284 */ 285 285 @Test 286 publicvoid testRemovedSourceStillSelected() throws Exception {286 void testRemovedSourceStillSelected() throws Exception { 287 287 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 288 288 // (not that there's a data layer for it to use) … … 317 317 */ 318 318 @Test 319 publicvoid testTileSourcesFromCurrentLayers() throws Exception {319 void testTileSourcesFromCurrentLayers() throws Exception { 320 320 // relevant prefs starting out empty, should choose the first (ImageryLayerInfo) source and have shown download area enabled 321 321 // (not that there's a data layer for it to use) … … 451 451 */ 452 452 @Test 453 publicvoid testSourcePrefObeyed() throws Exception {453 void testSourcePrefObeyed() throws Exception { 454 454 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 455 455 … … 478 478 */ 479 479 @Test 480 publicvoid testSourcePrefInvalid() throws Exception {480 void testSourcePrefInvalid() throws Exception { 481 481 Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles"); 482 482 … … 500 500 */ 501 501 @Test 502 publicvoid testViewportAspectRatio() throws Exception {502 void testViewportAspectRatio() throws Exception { 503 503 // Add a test layer to the layer manager to get the MapFrame & MapView 504 504 MainApplication.getLayerManager().addLayer(new TestLayer()); … … 546 546 // should equal the number on the right 547 547 assertTrue( 548 "Viewport marker not horizontally centered",549 Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4548 Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4, 549 "Viewport marker not horizontally centered" 550 550 ); 551 551 … … 561 561 // should equal the number on the bottom 562 562 assertTrue( 563 "Viewport marker not vertically centered",564 Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4563 Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4, 564 "Viewport marker not vertically centered" 565 565 ); 566 566 567 567 // (within a tolerance for numerical error) the viewport marker should be square 568 568 assertTrue( 569 "Viewport marker not square",570 Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4569 Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4, 570 "Viewport marker not square" 571 571 ); 572 572 … … 591 591 ); 592 592 assertTrue( 593 "Viewport marker not horizontally centered",594 Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4593 Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4, 594 "Viewport marker not horizontally centered" 595 595 ); 596 596 … … 603 603 ); 604 604 assertTrue( 605 "Viewport marker not vertically centered",606 Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4605 Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4, 606 "Viewport marker not vertically centered" 607 607 ); 608 608 … … 614 614 615 615 assertTrue( 616 "Viewport marker not 2:1 aspect ratio",617 Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5616 Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5, 617 "Viewport marker not 2:1 aspect ratio" 618 618 ); 619 619 } … … 624 624 for (Component c: menu.getComponents()) { 625 625 if (JPopupMenu.Separator.class.isInstance(c)) { 626 assertFalse( "More than one separator before target item", afterSeparator);626 assertFalse(afterSeparator, "More than one separator before target item"); 627 627 afterSeparator = true; 628 628 } else if (((JMenuItem) c).getText().equals(tr("Show downloaded area"))) { 629 assertTrue( "Separator not found before target item", afterSeparator);630 assertTrue( "Target item doesn't appear to be a JCheckBoxMenuItem", JCheckBoxMenuItem.class.isInstance(c));629 assertTrue(afterSeparator, "Separator not found before target item"); 630 assertTrue(JCheckBoxMenuItem.class.isInstance(c), "Target item doesn't appear to be a JCheckBoxMenuItem"); 631 631 return (JCheckBoxMenuItem) c; 632 632 } … … 641 641 */ 642 642 @Test 643 publicvoid testShowDownloadedArea() throws Exception {643 void testShowDownloadedArea() throws Exception { 644 644 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 645 645 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false); … … 800 800 */ 801 801 @Test 802 publicvoid testShowDownloadedAreaLayerSwitching() throws Exception {802 void testShowDownloadedAreaLayerSwitching() throws Exception { 803 803 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 804 804 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java
r16159 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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.GraphicsEnvironment; … … 14 14 import java.util.List; 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.TestUtils; 19 19 import org.openstreetmap.josm.data.osm.Changeset; … … 41 41 * Unit tests of {@link ChangesetCacheManager} class. 42 42 */ 43 publicclass ChangesetCacheManagerTest {43 class ChangesetCacheManagerTest { 44 44 45 45 /** 46 46 * Setup tests 47 47 */ 48 @R ule48 @RegisterExtension 49 49 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 50 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 54 54 */ 55 55 @Test 56 publicvoid testDestroyInstance() {56 void testDestroyInstance() { 57 57 ChangesetCacheManager.destroyInstance(); 58 58 } … … 64 64 */ 65 65 @Test 66 publicvoid testBuild() {66 void testBuild() { 67 67 assertNotNull(ChangesetCacheManager.buildButtonPanel()); 68 68 assertNotNull(ChangesetCacheManager.buildToolbarPanel()); … … 74 74 */ 75 75 @Test 76 publicvoid testChangesetDetailViewSynchronizer() {76 void testChangesetDetailViewSynchronizer() { 77 77 new ChangesetDetailViewSynchronizer(new ChangesetCacheManagerModel(null) { 78 78 @Override … … 94 94 */ 95 95 @Test 96 publicvoid testCancelAction() {96 void testCancelAction() { 97 97 new CancelAction().actionPerformed(null); 98 98 } … … 102 102 */ 103 103 @Test 104 publicvoid testCloseSelectedChangesetsAction() {104 void testCloseSelectedChangesetsAction() { 105 105 CloseSelectedChangesetsAction action = new CloseSelectedChangesetsAction(new ChangesetCacheManagerModel(null) { 106 106 @Override … … 117 117 */ 118 118 @Test 119 publicvoid testDownloadMyChangesets() {119 void testDownloadMyChangesets() { 120 120 TestUtils.assumeWorkingJMockit(); 121 121 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker( … … 140 140 */ 141 141 @Test 142 publicvoid testDownloadSelectedChangesetContentAction() {142 void testDownloadSelectedChangesetContentAction() { 143 143 if (GraphicsEnvironment.isHeadless()) { 144 144 TestUtils.assumeWorkingJMockit(); … … 156 156 */ 157 157 @Test 158 publicvoid testDownloadSelectedChangesetsAction() {158 void testDownloadSelectedChangesetsAction() { 159 159 if (GraphicsEnvironment.isHeadless()) { 160 160 TestUtils.assumeWorkingJMockit(); … … 172 172 */ 173 173 @Test 174 publicvoid testQueryAction() {174 void testQueryAction() { 175 175 TestUtils.assumeWorkingJMockit(); 176 176 … … 217 217 */ 218 218 @Test 219 publicvoid testRemoveFromCacheAction() {219 void testRemoveFromCacheAction() { 220 220 RemoveFromCacheAction action = new RemoveFromCacheAction(ChangesetCacheManager.buildModel()); 221 221 action.valueChanged(null); … … 227 227 */ 228 228 @Test 229 publicvoid testShowDetailAction() {229 void testShowDetailAction() { 230 230 new ShowDetailAction(ChangesetCacheManager.buildModel()).actionPerformed(null); 231 231 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableColumnModelTest.java
r11020 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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 of {@link ChangesetCacheTableColumnModel} class. 14 14 */ 15 publicclass ChangesetCacheTableColumnModelTest {15 class ChangesetCacheTableColumnModelTest { 16 16 17 17 /** 18 18 * Setup tests 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 testChangesetCacheTableColumnModel() {28 void testChangesetCacheTableColumnModel() { 29 29 assertNotNull(new ChangesetCacheTableColumnModel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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 of {@link ChangesetContentPanel} class. 14 14 */ 15 publicclass ChangesetContentPanelTest {15 class ChangesetContentPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testChangesetContentPanel() {28 void testChangesetContentPanel() { 29 29 assertNotNull(new ChangesetContentPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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 of {@link ChangesetDetailPanel} class. 14 14 */ 15 publicclass ChangesetDetailPanelTest {15 class ChangesetDetailPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testChangesetDetailPanel() {28 void testChangesetDetailPanel() { 29 29 assertNotNull(new ChangesetDetailPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDiscussionPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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 of {@link ChangesetDiscussionPanel} class. 14 14 */ 15 publicclass ChangesetDiscussionPanelTest {15 class ChangesetDiscussionPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testChangesetDiscussionPanel() {28 void testChangesetDiscussionPanel() { 29 29 assertNotNull(new ChangesetDiscussionPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 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 of {@link ChangesetTagsPanel} class. 14 14 */ 15 publicclass ChangesetTagsPanelTest {15 class ChangesetTagsPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testChangesetTagsPanel() {28 void testChangesetTagsPanel() { 29 29 assertNotNull(new ChangesetTagsPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset.query; 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 of {@link AdvancedChangesetQueryPanel} class. 14 14 */ 15 publicclass AdvancedChangesetQueryPanelTest {15 class AdvancedChangesetQueryPanelTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testAdvancedChangesetQueryPanel() {28 void testAdvancedChangesetQueryPanel() { 29 29 assertNotNull(new AdvancedChangesetQueryPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset.query; 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 of {@link BasicChangesetQueryPanel} class. 14 14 */ 15 publicclass BasicChangesetQueryPanelTest {15 class BasicChangesetQueryPanelTest { 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().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testBasicChangesetQueryPanel() {28 void testBasicChangesetQueryPanel() { 29 29 assertNotNull(new BasicChangesetQueryPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanelTest.java
r13617 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.changeset.query; 3 3 4 import static org.junit. Assert.assertNotNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 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.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 10 … … 14 14 * Unit tests of {@link UrlBasedQueryPanel} class. 15 15 */ 16 publicclass UrlBasedQueryPanelTest {16 class UrlBasedQueryPanelTest { 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().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testUrlBasedQueryPanel() {29 void testUrlBasedQueryPanel() { 30 30 assertNotNull(new UrlBasedQueryPanel()); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testExamplesAreCorrect() {37 void testExamplesAreCorrect() { 38 38 for (String example : UrlBasedQueryPanel.getExamples()) { 39 assertTrue( example, UrlBasedQueryPanel.isValidChangesetQueryUrl(example));39 assertTrue(UrlBasedQueryPanel.isValidChangesetQueryUrl(example), example); 40 40 } 41 41 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerActionTest.java
r15923 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.layer; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 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.imagery.ImageryInfo; 11 11 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; … … 24 24 * @author Taylor Smock 25 25 */ 26 publicclass CycleLayerActionTest {26 class CycleLayerActionTest { 27 27 /** Layers need a projection */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().fakeImagery(); … … 37 37 * Set up common items (make layers, etc.) 38 38 */ 39 @Before 39 @BeforeEach 40 40 public void setUp() { 41 41 cycleDown = new CycleLayerDownAction(); … … 51 51 */ 52 52 @Test 53 publicvoid testDownBottom() {53 void testDownBottom() { 54 54 manager.setActiveLayer(manager.getLayers().get(0)); 55 55 cycleDown.actionPerformed(null); … … 61 61 */ 62 62 @Test 63 publicvoid testUpTop() {63 void testUpTop() { 64 64 manager.setActiveLayer(manager.getLayers().get(manager.getLayers().size() - 1)); 65 65 cycleUp.actionPerformed(null); … … 71 71 */ 72 72 @Test 73 publicvoid testDown() {73 void testDown() { 74 74 manager.setActiveLayer(manager.getLayers().get(3)); 75 75 cycleDown.actionPerformed(null); … … 81 81 */ 82 82 @Test 83 publicvoid testUp() {83 void testUp() { 84 84 manager.setActiveLayer(manager.getLayers().get(3)); 85 85 cycleUp.actionPerformed(null); … … 91 91 */ 92 92 @Test 93 publicvoid testNoLayers() {93 void testNoLayers() { 94 94 manager.getLayers().forEach(manager::removeLayer); 95 95 cycleUp.actionPerformed(null); … … 102 102 */ 103 103 @Test 104 publicvoid testWithAerialImagery() {104 void testWithAerialImagery() { 105 105 final ImageryInfo magentaTilesInfo = ImageryLayerInfo.instance.getLayers().stream() 106 106 .filter(i -> i.getName().equals("Magenta Tiles")).findAny().get(); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/DuplicateActionTest.java
r12636 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.layer; 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.assertNull;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.assertNull; 8 8 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.gui.MainApplication; … … 22 22 * Unit tests of {@link DuplicateAction} class. 23 23 */ 24 publicclass DuplicateActionTest {24 class DuplicateActionTest { 25 25 /** 26 26 * TMS layer needs prefs. Platform for LayerListDialog shortcuts. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 35 35 */ 36 36 @Test 37 publicvoid testTicket4539() throws Exception {37 void testTicket4539() throws Exception { 38 38 try (InputStream is = TestUtils.getRegressionDataStream(4539, "josm_error_#4539.osm.zip")) { 39 39 OsmDataLayer layer = new OsmDataLayer(OsmReader.parseDataSet(is, null), null, null); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java
r15650 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.layer; 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 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 20 20 * Unit tests of {@link LayerVisibilityAction} class. 21 21 */ 22 publicclass LayerVisibilityActionTest {22 class LayerVisibilityActionTest { 23 23 /** 24 24 * TMS layer needs prefs. Platform for LayerListDialog shortcuts. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().preferences().projection().main(); … … 32 32 */ 33 33 @Test 34 publicvoid testLayerVisibilityAction() {34 void testLayerVisibilityAction() { 35 35 TMSLayer layer = TMSLayerTest.createTmsLayer(); 36 36 LayerListModel model = new LayerListDialog(MainApplication.getLayerManager()) { -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java
r16319 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.function.IntFunction; … … 10 10 import javax.swing.table.DefaultTableModel; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 … … 19 19 * Unit tests of {@link PropertiesCellRenderer} class. 20 20 */ 21 publicclass PropertiesCellRendererTest {21 class PropertiesCellRendererTest { 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().preferences(); … … 32 32 */ 33 33 @Test 34 publicvoid testColorRendering() {34 void testColorRendering() { 35 35 PropertiesCellRenderer renderer = new PropertiesCellRenderer(); 36 36 DefaultTableModel tableModel = new DefaultTableModel(new Object[][]{ -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java
r15822 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.ArrayList; 7 7 import java.util.List; 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.LatLon; 12 12 import org.openstreetmap.josm.data.osm.Node; … … 20 20 * Unit tests of {@link PropertiesDialog} class. 21 21 */ 22 publicclass PropertiesDialogTest {22 class PropertiesDialogTest { 23 23 24 24 /** 25 25 * Setup tests 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 37 37 */ 38 38 @Test 39 publicvoid testTicket12504() {39 void testTicket12504() { 40 40 List<OsmPrimitive> sel = new ArrayList<>(); 41 41 // 160 objects with foo=bar, 400 objects without foo -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollectionTest.java
r12842 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 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.util.Arrays; 9 9 import java.util.Collections; 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.data.osm.Tag; 14 14 import org.openstreetmap.josm.data.osm.search.SearchParseError; … … 22 22 * Unit tests of {@link RecentTagCollection} class. 23 23 */ 24 publicclass RecentTagCollectionTest {24 class RecentTagCollectionTest { 25 25 26 26 /** 27 27 * Setup tests 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 37 37 */ 38 38 @Test 39 publicvoid testVarious() throws SearchParseError {39 void testVarious() throws SearchParseError { 40 40 final RecentTagCollection recentTags = new RecentTagCollection(2); 41 41 assertTrue(recentTags.isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java
r16321 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;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 7 8 8 import java.awt.GraphicsEnvironment; … … 21 21 import javax.swing.table.DefaultTableModel; 22 22 23 import org.junit. Rule;24 import org.junit. Test;23 import org.junit.jupiter.api.extension.RegisterExtension; 24 import org.junit.jupiter.api.Test; 25 25 import org.openstreetmap.josm.TestUtils; 26 26 import org.openstreetmap.josm.data.coor.LatLon; … … 44 44 * Unit tests of {@link TagEditHelper} class. 45 45 */ 46 publicclass TagEditHelperTest {46 class TagEditHelperTest { 47 47 48 48 /** 49 49 * Setup tests 50 50 */ 51 @R ule51 @RegisterExtension 52 52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 53 53 public JOSMTestRules test = new JOSMTestRules().territories().projection(); … … 64 64 */ 65 65 @Test 66 publicvoid testAcItemComparator() {66 void testAcItemComparator() { 67 67 List<AutoCompletionItem> list = new ArrayList<>(); 68 68 list.add(new AutoCompletionItem("Bing Sat")); … … 81 81 */ 82 82 @Test 83 publicvoid testContainsDataKey() {83 void testContainsDataKey() { 84 84 assertFalse(newTagEditHelper().containsDataKey("foo")); 85 85 // TODO: complete test … … 92 92 */ 93 93 @Test 94 publicvoid testTicket18764() throws Exception {94 void testTicket18764() throws Exception { 95 95 testIcon("*[building] ⧉ *[highway] { text: tr(\"Building crossing highway\"); }", ds -> { 96 96 Way way = TestUtils.newWay("", new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE)); … … 106 106 */ 107 107 @Test 108 publicvoid testTicket18798() throws Exception {108 void testTicket18798() throws Exception { 109 109 testIcon("node:righthandtraffic[junction=roundabout] { text: tr(\"Roundabout node\"); }", ds -> { 110 110 Node node = new Node(LatLon.NORTH_POLE); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java
r16606 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 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 javax.swing.Action; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.osm.Tag; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 15 16 publicclass TaginfoActionTest {16 class TaginfoActionTest { 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testTaginfoUrls() {29 void testTaginfoUrls() { 30 30 TaginfoAction action = new TaginfoAction(() -> null, () -> null); 31 31 assertEquals("https://taginfo.openstreetmap.org/keys/railway", action.getTaginfoUrlForTag(new Tag("railway"))); … … 40 40 */ 41 41 @Test 42 publicvoid testCustomInstance() {42 void testCustomInstance() { 43 43 TaginfoAction action = new TaginfoAction(() -> null, () -> null).withTaginfoUrl("example.com", "https://taginfo.example.com////"); 44 44 assertEquals("example.com", action.getValue(Action.NAME)); … … 50 50 */ 51 51 @Test 52 public void testTagHistoryUrls() throws Exception{52 void testTagHistoryUrls() { 53 53 TaginfoAction action = new TaginfoAction(() -> null, () -> null).toTagHistoryAction(); 54 54 assertEquals("https://taghistory.raifer.tech/#***/railway/", action.getTaginfoUrlForTag(new Tag("railway"))); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowserTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 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.data.osm.DataSet; 9 9 import org.openstreetmap.josm.data.osm.Relation; … … 16 16 * Unit tests of {@link ChildRelationBrowser} class. 17 17 */ 18 publicclass ChildRelationBrowserTest {18 class ChildRelationBrowserTest { 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().preferences(); … … 29 29 */ 30 30 @Test 31 publicvoid testChildRelationBrowser() {31 void testChildRelationBrowser() { 32 32 DataSet ds = new DataSet(); 33 33 Relation r = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java
r16652 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;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 7 8 8 import java.util.Collections; … … 11 11 import javax.swing.JPanel; 12 12 13 import org.junit. Rule;14 import org.junit. Test;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; … … 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules().preferences().main(); … … 85 85 */ 86 86 @Test 87 publicvoid testAddPrimitivesToRelation() {87 void testAddPrimitivesToRelation() { 88 88 TestUtils.assumeWorkingJMockit(); 89 89 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(); … … 117 117 */ 118 118 @Test 119 publicvoid testBuild() {119 void testBuild() { 120 120 DataSet ds = new DataSet(); 121 121 Relation relation = new Relation(1); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTable; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType; … … 17 17 * Unit tests of {@link MemberTableLinkedCellRenderer} class. 18 18 */ 19 publicclass MemberTableLinkedCellRendererTest {19 class MemberTableLinkedCellRendererTest { 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().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testMemberTableLinkedCellRenderer() {32 void testMemberTableLinkedCellRenderer() { 33 33 MemberTableLinkedCellRenderer r = new MemberTableLinkedCellRenderer(); 34 34 assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0)); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableMemberCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTable; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.data.osm.Node; … … 18 18 * Unit tests of {@link MemberTableMemberCellRenderer} class. 19 19 */ 20 publicclass MemberTableMemberCellRendererTest {20 class MemberTableMemberCellRendererTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 31 31 */ 32 32 @Test 33 publicvoid testMemberTableMemberCellRenderer() {33 void testMemberTableMemberCellRenderer() { 34 34 MemberTableMemberCellRenderer r = new MemberTableMemberCellRenderer(); 35 35 assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0)); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.util.Collection; … … 8 8 import java.util.List; 9 9 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.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 21 21 * Unit tests of {@link MemberTableModel} class. 22 22 */ 23 publicclass MemberTableModelTest {23 class MemberTableModelTest { 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(); … … 34 34 */ 35 35 @Test 36 publicvoid testTicket12443() {36 void testTicket12443() { 37 37 final Node n = new Node(1); 38 38 assertNotNull(new MemberTableModel(null, null, new TaggingPresetHandler() { -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableRoleCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTable; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 17 17 * Unit tests of {@link MemberTableRoleCellRenderer} class. 18 18 */ 19 publicclass MemberTableRoleCellRendererTest {19 class MemberTableRoleCellRendererTest { 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 testMemberTableRoleCellRenderer() {32 void testMemberTableRoleCellRenderer() { 33 33 MemberTableRoleCellRenderer r = new MemberTableRoleCellRenderer(); 34 34 assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0)); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 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.data.osm.DataSet; 7 7 import org.openstreetmap.josm.data.osm.Relation; … … 14 14 * Unit tests of {@link ReferringRelationsBrowser} class. 15 15 */ 16 publicclass ReferringRelationsBrowserTest {16 class ReferringRelationsBrowserTest { 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().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testReferringRelationsBrowser() {29 void testReferringRelationsBrowser() { 30 30 DataSet ds = new DataSet(); 31 31 Relation r = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTree; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.Relation; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link RelationTreeCellRenderer} class. 17 17 */ 18 publicclass RelationTreeCellRendererTest {18 class RelationTreeCellRendererTest { 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().preferences(); … … 29 29 */ 30 30 @Test 31 publicvoid testRelationTreeCellRenderer() {31 void testRelationTreeCellRenderer() { 32 32 RelationTreeCellRenderer r = new RelationTreeCellRenderer(); 33 33 assertEquals(r, r.getTreeCellRendererComponent(new JTree(), new Relation(), false, false, false, 0, false)); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JTable; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.Node; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link SelectionTableCellRenderer} class. 17 17 */ 18 publicclass SelectionTableCellRendererTest {18 class SelectionTableCellRendererTest { 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().preferences(); … … 29 29 */ 30 30 @Test 31 publicvoid testSelectionTableCellRenderer() {31 void testSelectionTableCellRenderer() { 32 32 MemberTableModel model = new MemberTableModel(null, null, null); 33 33 SelectionTableCellRenderer r = new SelectionTableCellRenderer(model); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java
r12636 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 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.awt.event.MouseEvent; 8 8 import java.awt.event.MouseListener; 9 9 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.coor.LatLon; 13 13 import org.openstreetmap.josm.data.osm.DataSet; … … 25 25 * Unit tests of {@link SelectionTable} class. 26 26 */ 27 publicclass SelectionTableTest {27 class SelectionTableTest { 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(); … … 38 38 */ 39 39 @Test 40 publicvoid testSelectionTable() {40 void testSelectionTable() { 41 41 // Constructs a relation with a member 42 42 DataSet ds = new DataSet(); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java
r14138 r17275 6 6 import java.util.List; 7 7 8 import org.junit. Before;9 import org.junit. Ignore;10 import org.junit. Rule;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Disabled; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.osm.DataSet; 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 31 31 * @author Michael Zangl 32 32 */ 33 @ Ignore33 @Disabled 34 34 public abstract class AbstractRelationEditorActionTest { 35 35 /** 36 36 * Platform for tooltips. 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules().preferences().main(); … … 91 91 * Set up the test data required for common tests using one relation. 92 92 */ 93 @Before 93 @BeforeEach 94 94 public void setupTestData() { 95 95 DataSet ds = new DataSet(); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersActionTest.java
r14028 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation.actions; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertSame;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.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.Collections; 10 10 import java.util.Set; 11 11 12 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.data.osm.Node; 14 14 import org.openstreetmap.josm.data.osm.Relation; … … 24 24 * @author Michael Zangl 25 25 */ 26 publicclass PasteMembersActionTest extends AbstractRelationEditorActionTest {26 class PasteMembersActionTest extends AbstractRelationEditorActionTest { 27 27 /** 28 28 * Test {@link PasteMembersAction#isEnabled()} 29 29 */ 30 30 @Test 31 publicvoid testEnabledState() {31 void testEnabledState() { 32 32 copyString(); 33 33 … … 65 65 */ 66 66 @Test 67 publicvoid testActionWrongClipboard() {67 void testActionWrongClipboard() { 68 68 copyString(); 69 69 PasteMembersAction action = new PasteMembersAction(relationEditorAccess); … … 79 79 */ 80 80 @Test 81 publicvoid testActionForMembers() {81 void testActionForMembers() { 82 82 Node testNode = new Node(10); 83 83 layer.data.addPrimitive(testNode); … … 97 97 */ 98 98 @Test 99 publicvoid testActionForPrimitives() {99 void testActionForPrimitives() { 100 100 Node testNode = new Node(10); 101 101 layer.data.addPrimitive(testNode); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java
r16160 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.relation.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.awt.Component; 8 8 import java.awt.Container; 9 9 10 import javax.swing.Icon; 10 11 import javax.swing.JOptionPane; 11 12 import javax.swing.text.JTextComponent; 12 13 14 import org.junit.jupiter.api.Test; 13 15 import org.openstreetmap.josm.TestUtils; 14 16 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; … … 18 20 import mockit.MockUp; 19 21 20 import org.junit.Test;21 22 22 /** 23 23 * Unit tests for relation editor actions. 24 24 */ 25 publicclass RelationEditorActionsTest extends AbstractRelationEditorActionTest {25 class RelationEditorActionsTest extends AbstractRelationEditorActionTest { 26 26 27 27 /** … … 29 29 */ 30 30 @Test 31 publicvoid testNoDialogActions() {31 void testNoDialogActions() { 32 32 new AddSelectedAfterSelection(relationEditorAccess).actionPerformed(null); 33 33 new AddSelectedBeforeSelection(relationEditorAccess).actionPerformed(null); … … 69 69 */ 70 70 @Test 71 publicvoid testDeleteCurrentRelationAction() {71 void testDeleteCurrentRelationAction() { 72 72 TestUtils.assumeWorkingJMockit(); 73 73 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker() { 74 @Override 74 75 public String getStringFromOriginalMessage(Object originalMessage) { 75 76 return ((JTextComponent) ((Container) originalMessage).getComponent(0)).getText(); … … 105 106 */ 106 107 @Test 107 publicvoid testSetRoleAction() {108 void testSetRoleAction() { 108 109 TestUtils.assumeWorkingJMockit(); 109 110 final JOptionPaneSimpleMocker.MessagePanelMocker mpMocker = new JOptionPaneSimpleMocker.MessagePanelMocker(); … … 111 112 // complexity, but this is quite a simple use of showOptionDialog which we can mock from scratch. 112 113 final boolean[] jopMockerCalled = new boolean[] {false}; 113 final MockUp<JOptionPane> jopMocker =new MockUp<JOptionPane>() {114 new MockUp<JOptionPane>() { 114 115 @Mock 115 116 public int showOptionDialog( -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java
r16886 r17275 9 9 10 10 import org.junit.Assert; 11 import org.junit. Before;12 import org.junit. Rule;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.data.osm.DataSet; 15 15 import org.openstreetmap.josm.data.osm.Relation; … … 25 25 * Unit tests of {@link RelationSorter} class. 26 26 */ 27 publicclass RelationSorterTest {27 class RelationSorterTest { 28 28 29 29 private final RelationSorter sorter = new RelationSorter(); … … 33 33 * Use Mercator projection 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 42 42 * @throws IOException in case of I/O error 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void loadData() throws IllegalDataException, IOException { 46 46 if (testDataset == null) { … … 64 64 65 65 @Test 66 publicvoid testGeneric() {66 void testGeneric() { 67 67 String[] actual = getNames(sorter.sortMembers(getRelation("generic").getMembers())); 68 68 final String[] expected = {"t1w4", "t1w3", "t1w2", "t1w1", "t1w7", "t1w6", "t1w5", "t1n1", "t1n2"}; … … 73 73 74 74 @Test 75 publicvoid testAssociatedStreet() {75 void testAssociatedStreet() { 76 76 String[] actual = getNames(sorter.sortMembers(getRelation("associatedStreet").getMembers())); 77 77 Assert.assertArrayEquals(new String[] {"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4"}, actual); … … 79 79 80 80 @Test 81 publicvoid testStreet() {81 void testStreet() { 82 82 String[] actual = getNames(sorter.sortMembers(getRelation("street").getMembers())); 83 83 Assert.assertArrayEquals(new String[]{"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4", "playground", "tree"}, actual); … … 90 90 91 91 @Test 92 publicvoid testThreeLoopsEndsLoop() {92 void testThreeLoopsEndsLoop() { 93 93 Relation relation = getRelation("three-loops-ends-loop"); 94 94 // Check the first way before sorting, otherwise the sorter … … 106 106 107 107 @Test 108 publicvoid testThreeLoopsEndsWay() {108 void testThreeLoopsEndsWay() { 109 109 Relation relation = getRelation("three-loops-ends-way"); 110 110 // Check the first way before sorting, otherwise the sorter … … 122 122 123 123 @Test 124 publicvoid testThreeLoopsEndsNode() {124 void testThreeLoopsEndsNode() { 125 125 Relation relation = getRelation("three-loops-ends-node"); 126 126 String[] actual = getNames(sorter.sortMembers(relation.getMembers())); … … 133 133 134 134 @Test 135 publicvoid testOneLoopEndsSplit() {135 void testOneLoopEndsSplit() { 136 136 Relation relation = getRelation("one-loop-ends-split"); 137 137 String[] actual = getNames(sorter.sortMembers(relation.getMembers())); … … 144 144 145 145 @Test 146 publicvoid testNoLoopEndsSplit() {146 void testNoLoopEndsSplit() { 147 147 Relation relation = getRelation("no-loop-ends-split"); 148 148 // TODO: This is not yet sorted properly, so this route is … … 157 157 158 158 @Test 159 publicvoid testIncompleteLoops() {159 void testIncompleteLoops() { 160 160 Relation relation = getRelation("incomplete-loops"); 161 161 // TODO: This is not yet sorted perfectly (might not be possible) … … 169 169 170 170 @Test 171 publicvoid testParallelOneWay() {171 void testParallelOneWay() { 172 172 Relation relation = getRelation("parallel-oneway"); 173 173 // TODO: This is not always sorted properly, only when the right -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java
r16913 r17275 13 13 14 14 import org.junit.Assert; 15 import org.junit. Before;16 import org.junit. Rule;17 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; 18 18 import org.openstreetmap.josm.data.osm.DataSet; 19 19 import org.openstreetmap.josm.data.osm.Node; … … 31 31 * Unit tests of {@link WayConnectionTypeCalculator} class. 32 32 */ 33 publicclass WayConnectionTypeCalculatorTest {33 class WayConnectionTypeCalculatorTest { 34 34 35 35 private final RelationSorter sorter = new RelationSorter(); … … 40 40 * Use Mercator projection 41 41 */ 42 @R ule42 @RegisterExtension 43 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 44 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 49 49 * @throws IOException in case of I/O error 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void loadData() throws IllegalDataException, IOException { 53 53 if (testDataset == null) { … … 100 100 101 101 @Test 102 publicvoid testEmpty() {102 void testEmpty() { 103 103 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(new ArrayList<>())); 104 104 Assert.assertEquals("[]", actual); … … 110 110 111 111 @Test 112 publicvoid testGeneric() {112 void testGeneric() { 113 113 Relation relation = getRelation("generic"); 114 114 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers())); … … 119 119 120 120 @Test 121 publicvoid testAssociatedStreet() {121 void testAssociatedStreet() { 122 122 Relation relation = getRelation("associatedStreet"); 123 123 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers())); … … 128 128 129 129 @Test 130 publicvoid testLoop() {130 void testLoop() { 131 131 Relation relation = getRelation("loop"); 132 132 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers())); … … 143 143 144 144 @Test 145 publicvoid testThreeLoopsEndsLoop() {145 void testThreeLoopsEndsLoop() { 146 146 Relation relation = getRelation("three-loops-ends-loop"); 147 147 // Check the first way before sorting, otherwise the sorter … … 159 159 160 160 @Test 161 publicvoid testThreeLoopsEndsWay() {161 void testThreeLoopsEndsWay() { 162 162 Relation relation = getRelation("three-loops-ends-way"); 163 163 // Check the first way before sorting, otherwise the sorter … … 175 175 176 176 @Test 177 publicvoid testThreeLoopsEndsNode() {177 void testThreeLoopsEndsNode() { 178 178 Relation relation = getRelation("three-loops-ends-node"); 179 179 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers()))); … … 187 187 188 188 @Test 189 publicvoid testOneLoopEndsSplit() {189 void testOneLoopEndsSplit() { 190 190 Relation relation = getRelation("one-loop-ends-split"); 191 191 String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers()))); … … 199 199 200 200 @Test 201 publicvoid testNoLoopEndsSplit() {201 void testNoLoopEndsSplit() { 202 202 Relation relation = getRelation("no-loop-ends-split"); 203 203 // TODO: This is not yet sorted properly, so this route is … … 212 212 213 213 @Test 214 publicvoid testIncompleteLoops() {214 void testIncompleteLoops() { 215 215 Relation relation = getRelation("incomplete-loops"); 216 216 // TODO: This is not yet sorted perfectly (might not be possible) … … 225 225 226 226 @Test 227 publicvoid testParallelOneWay() {227 void testParallelOneWay() { 228 228 Relation relation = getRelation("parallel-oneway"); 229 229 // TODO: This is not always sorted properly, only when the right … … 250 250 */ 251 251 @Test 252 publicvoid testDirectionsOnewaysOnly() {252 void testDirectionsOnewaysOnly() { 253 253 Relation relation = getRelation("direction"); 254 254 … … 318 318 */ 319 319 @Test 320 publicvoid testDirectionsOnewayMix() {320 void testDirectionsOnewayMix() { 321 321 Relation relation = getRelation("direction"); 322 322 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanelTest.java
r11182 r17275 2 2 package org.openstreetmap.josm.gui.dialogs.validator; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;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 7 8 8 import java.util.ArrayList; … … 13 13 import java.util.Set; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.data.osm.Node; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 26 26 * Unit tests of {@link ValidatorTreePanel} class. 27 27 */ 28 publicclass ValidatorTreePanelTest {28 class ValidatorTreePanelTest { 29 29 30 30 /** 31 31 * Setup tests 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 39 39 */ 40 40 @Test 41 publicvoid testValidatorTreePanel() {41 void testValidatorTreePanel() { 42 42 assertNotNull(new ValidatorTreePanel()); 43 43 -
trunk/test/unit/org/openstreetmap/josm/gui/download/BookmarkSelectionTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.download; 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.data.Bounds; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests of {@link BookmarkSelection} class. 13 13 */ 14 publicclass BookmarkSelectionTest {14 class BookmarkSelectionTest { 15 15 16 16 /** 17 17 * Setup tests 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testBookmarkSelection() {27 void testBookmarkSelection() { 28 28 BookmarkSelection sel = new BookmarkSelection(); 29 29 sel.addGui(null); -
trunk/test/unit/org/openstreetmap/josm/gui/download/BoundingBoxSelectionTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.download; 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.data.Bounds; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests of {@link BoundingBoxSelection} class. 13 13 */ 14 publicclass BoundingBoxSelectionTest {14 class BoundingBoxSelectionTest { 15 15 16 16 /** 17 17 * Setup tests 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testBoundingBoxSelection() {27 void testBoundingBoxSelection() { 28 28 BoundingBoxSelection sel = new BoundingBoxSelection(); 29 29 sel.addGui(null); -
trunk/test/unit/org/openstreetmap/josm/gui/download/PlaceSelectionTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.download; 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.data.Bounds; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests of {@link PlaceSelection} class. 13 13 */ 14 publicclass PlaceSelectionTest {14 class PlaceSelectionTest { 15 15 16 16 /** 17 17 * Setup tests 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testBookmarkSelection() {27 void testBookmarkSelection() { 28 28 PlaceSelection sel = new PlaceSelection(); 29 29 sel.addGui(null); -
trunk/test/unit/org/openstreetmap/josm/gui/download/TileSelectionTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.download; 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.data.Bounds; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests of {@link TileSelection} class. 13 13 */ 14 publicclass TileSelectionTest {14 class TileSelectionTest { 15 15 16 16 /** 17 17 * Setup tests 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testTileSelection() {27 void testTileSelection() { 28 28 TileSelection sel = new TileSelection(); 29 29 sel.addGui(null); -
trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java
r13920 r17275 2 2 package org.openstreetmap.josm.gui.help; 3 3 4 import static org.junit.Assert.assertFalse; 4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 10 … … 13 14 * Unit tests of {@link HelpContentReader} class. 14 15 */ 15 publicclass HelpContentReaderTest {16 class HelpContentReaderTest { 16 17 17 18 /** 18 19 * Setup tests 19 20 */ 20 @R ule21 @RegisterExtension 21 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 23 public JOSMTestRules test = new JOSMTestRules().timeout(30000); … … 24 25 /** 25 26 * Unit test of {@link HelpContentReader#fetchHelpTopicContent} - null case. 26 * @throws HelpContentReaderException always27 27 */ 28 @Test (expected = HelpContentReaderException.class)29 public void testFetchHelpTopicContentNull() throws HelpContentReaderException{30 new HelpContentReader(null).fetchHelpTopicContent(null, false);28 @Test 29 void testFetchHelpTopicContentNull() { 30 assertThrows(HelpContentReaderException.class, () -> new HelpContentReader(null).fetchHelpTopicContent(null, false)); 31 31 } 32 32 … … 36 36 */ 37 37 @Test 38 publicvoid testFetchHelpTopicContentNominal() throws HelpContentReaderException {38 void testFetchHelpTopicContentNominal() throws HelpContentReaderException { 39 39 String res = new HelpContentReader(HelpUtil.getWikiBaseUrl()).fetchHelpTopicContent(HelpBrowserTest.URL_1, false); 40 40 assertFalse(res.trim().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/gui/help/HyperlinkHandlerTest.java
r14807 r17275 2 2 package org.openstreetmap.josm.gui.help; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.StringReader; … … 11 11 import javax.swing.text.html.HTMLEditorKit; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.gui.widgets.JosmEditorPane; 16 16 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 21 21 * Unit tests of {@link HyperlinkHandler} class. 22 22 */ 23 publicclass HyperlinkHandlerTest {23 class HyperlinkHandlerTest { 24 24 25 25 /** 26 26 * Setup tests 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 35 35 */ 36 36 @Test 37 publicvoid testTicket17338() throws Exception {37 void testTicket17338() throws Exception { 38 38 JosmEditorPane help = new JosmEditorPane(); 39 39 HTMLEditorKit htmlKit = new HTMLEditorKit(); -
trunk/test/unit/org/openstreetmap/josm/gui/history/CoordinateInfoViewerTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.history; 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 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 10 … … 13 14 * Unit tests of {@link CoordinateInfoViewer} class. 14 15 */ 15 publicclass CoordinateInfoViewerTest {16 class CoordinateInfoViewerTest { 16 17 17 18 /** 18 19 * Setup test. 19 20 */ 20 @R ule21 @RegisterExtension 21 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 26 * Test for {@link CoordinateInfoViewer#CoordinateInfoViewer} - {@code null} handling. 26 27 */ 27 @Test (expected = IllegalArgumentException.class)28 publicvoid testCoordinateInfoViewerNull() {29 new CoordinateInfoViewer(null);28 @Test 29 void testCoordinateInfoViewerNull() { 30 assertThrows(IllegalArgumentException.class, () -> new CoordinateInfoViewer(null)); 30 31 } 31 32 … … 34 35 */ 35 36 @Test 36 publicvoid testCoordinateInfoViewerNominal() {37 void testCoordinateInfoViewerNominal() { 37 38 assertNotNull(new CoordinateInfoViewer(new HistoryBrowserModel())); 38 39 } -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Date; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 11 11 import org.openstreetmap.josm.data.osm.User; … … 22 22 * Unit tests of {@link HistoryBrowserDialog} class. 23 23 */ 24 publicclass HistoryBrowserDialogTest {24 class HistoryBrowserDialogTest { 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(); … … 35 35 */ 36 36 @Test 37 publicvoid testBuildTitle() {37 void testBuildTitle() { 38 38 HistoryDataSet hds = new HistoryDataSet(); 39 39 User user = User.createOsmUser(1, ""); -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java
r13509 r17275 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotEquals;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 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.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 24 24 * Unit tests of {@link HistoryBrowserModel} class. 25 25 */ 26 publicclass HistoryBrowserModelTest {26 class HistoryBrowserModelTest { 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().preferences().devAPI().timeout(30000); … … 37 37 */ 38 38 @Test 39 publicvoid testHistoryBrowserModel() {39 void testHistoryBrowserModel() { 40 40 HistoryBrowserModel model = new HistoryBrowserModel(); 41 41 assertNotNull(model.getVersionTableModel()); … … 57 57 */ 58 58 @Test 59 publicvoid testGetTagTableModel() {59 void testGetTagTableModel() { 60 60 HistoryBrowserModel model = new HistoryBrowserModel(); 61 61 TagTableModel t1 = model.getTagTableModel(PointInTimeType.CURRENT_POINT_IN_TIME); … … 70 70 */ 71 71 @Test 72 publicvoid testGetNodeListTableModel() {72 void testGetNodeListTableModel() { 73 73 HistoryBrowserModel model = new HistoryBrowserModel(); 74 74 DiffTableModel t1 = model.getNodeListTableModel(PointInTimeType.CURRENT_POINT_IN_TIME); … … 83 83 */ 84 84 @Test 85 publicvoid testGetRelationMemberTableModel() {85 void testGetRelationMemberTableModel() { 86 86 HistoryBrowserModel model = new HistoryBrowserModel(); 87 87 DiffTableModel t1 = model.getRelationMemberTableModel(PointInTimeType.CURRENT_POINT_IN_TIME); … … 96 96 */ 97 97 @Test 98 publicvoid testSetPointsInTimeNullHistory() {98 void testSetPointsInTimeNullHistory() { 99 99 HistoryBrowserModel model = new HistoryBrowserModel(); 100 100 VersionTableModel tableModel = model.getVersionTableModel(); … … 109 109 */ 110 110 @Test 111 publicvoid testSetPointsInTimeNodeHistory() {111 void testSetPointsInTimeNodeHistory() { 112 112 SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.NODE); 113 113 new HistoryLoadTask().add(id).run(); … … 132 132 */ 133 133 @Test 134 publicvoid testSetPointsInTimeWayHistory() {134 void testSetPointsInTimeWayHistory() { 135 135 SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.WAY); 136 136 new HistoryLoadTask().add(id).run(); … … 155 155 */ 156 156 @Test 157 publicvoid testSetPointsInTimeRelationHistory() {157 void testSetPointsInTimeRelationHistory() { 158 158 SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.RELATION); 159 159 new HistoryLoadTask().add(id).run(); -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java
r13435 r17275 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; 7 7 import java.io.InputStream; 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.osm.Node; … … 30 30 * Unit tests of {@link HistoryLoadTask} class. 31 31 */ 32 publicclass HistoryLoadTaskTest {32 class HistoryLoadTaskTest { 33 33 34 34 /** 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000); … … 43 43 */ 44 44 @Test 45 publicvoid testGetLoadingMessage() {45 void testGetLoadingMessage() { 46 46 assertEquals("Loading history for node {0}", HistoryLoadTask.getLoadingMessage(new Node().getPrimitiveId())); 47 47 assertEquals("Loading history for way {0}", HistoryLoadTask.getLoadingMessage(new Way().getPrimitiveId())); … … 57 57 */ 58 58 @Test 59 publicvoid testLoadHistory() throws OsmTransferException {59 void testLoadHistory() throws OsmTransferException { 60 60 HistoryDataSet ds = HistoryLoadTask.loadHistory(new OsmServerHistoryReader(OsmPrimitiveType.NODE, 0) { 61 61 @Override -
trunk/test/unit/org/openstreetmap/josm/gui/history/NodeListViewerTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.history; 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 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 10 … … 13 14 * Unit tests of {@link NodeListViewer} class. 14 15 */ 15 publicclass NodeListViewerTest {16 class NodeListViewerTest { 16 17 17 18 /** 18 19 * Setup test. 19 20 */ 20 @R ule21 @RegisterExtension 21 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 26 * Test for {@link NodeListViewer#NodeListViewer} - {@code null} handling. 26 27 */ 27 @Test (expected = IllegalArgumentException.class)28 publicvoid testNodeListViewerNull() {29 new NodeListViewer(null);28 @Test 29 void testNodeListViewerNull() { 30 assertThrows(IllegalArgumentException.class, () -> new NodeListViewer(null)); 30 31 } 31 32 … … 34 35 */ 35 36 @Test 36 publicvoid testNodeListViewerNominal() {37 void testNodeListViewerNominal() { 37 38 assertNotNull(new NodeListViewer(new HistoryBrowserModel())); 38 39 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.io.File; … … 10 10 import javax.swing.JTable; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.osm.DataSet; 15 15 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; … … 22 22 * Unit tests of {@link ActionFlagsTableCell} class. 23 23 */ 24 publicclass ActionFlagsTableCellTest {24 class ActionFlagsTableCellTest { 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(); … … 34 34 */ 35 35 @Test 36 publicvoid testActionFlagsTableCell() {36 void testActionFlagsTableCell() { 37 37 JTable table = new JTable(); 38 38 File file = new File("test"); -
trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java
r16159 r17275 7 7 import javax.swing.JOptionPane; 8 8 9 import org.junit.After;10 9 import org.junit.Assert; 11 import org.junit.Before; 12 import org.junit.Rule; 13 import org.junit.Test; 10 import org.junit.jupiter.api.AfterEach; 11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.data.APIDataSet; … … 29 29 * Unit tests of {@link AsynchronousUploadPrimitivesTask}. 30 30 */ 31 publicclass AsynchronousUploadPrimitivesTaskTest {31 class AsynchronousUploadPrimitivesTaskTest { 32 32 33 33 private UploadStrategySpecification strategy; … … 40 40 * Setup tests 41 41 */ 42 @R ule42 @RegisterExtension 43 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 44 public JOSMTestRules test = new JOSMTestRules().assertionsInEDT(); … … 47 47 * Bootstrap. 48 48 */ 49 @Before 49 @BeforeEach 50 50 public void bootStrap() { 51 51 DataSet dataSet = new DataSet(); … … 71 71 * Tear down. 72 72 */ 73 @After 73 @AfterEach 74 74 public void tearDown() { 75 75 toUpload = null; … … 87 87 */ 88 88 @Test 89 publicvoid testSingleUploadInstance() {89 void testSingleUploadInstance() { 90 90 TestUtils.assumeWorkingJMockit(); 91 91 new JOptionPaneSimpleMocker(Collections.singletonMap( -
trunk/test/unit/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanelTest.java
r12719 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 of {@link BasicUploadSettingsPanel} class. 14 14 */ 15 publicclass BasicUploadSettingsPanelTest {15 class BasicUploadSettingsPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testBasicUploadSettingsPanel() {28 void testBasicUploadSettingsPanel() { 29 29 assertNotNull(new BasicUploadSettingsPanel(new ChangesetCommentModel(), new ChangesetCommentModel(), new ChangesetReviewModel())); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JList; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.Changeset; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link ChangesetCellRenderer} class. 17 17 */ 18 publicclass ChangesetCellRendererTest {18 class ChangesetCellRendererTest { 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 test = new JOSMTestRules().preferences(); … … 28 28 */ 29 29 @Test 30 publicvoid testChangesetCellRenderer() {30 void testChangesetCellRenderer() { 31 31 JList<Changeset> list = new JList<>(); 32 32 Changeset cs = new Changeset(); -
trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCommentModelTest.java
r13994 r17275 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 import java.util.Collections; 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.JOSMTestRules; 12 12 … … 16 16 * Unit tests of {@link ChangesetCommentModel} class. 17 17 */ 18 publicclass ChangesetCommentModelTest {18 class ChangesetCommentModelTest { 19 19 20 20 /** 21 21 * Setup tests 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 testFindHashTags() {31 void testFindHashTags() { 32 32 ChangesetCommentModel model = new ChangesetCommentModel(); 33 33 assertEquals(Collections.emptyList(), model.findHashTags()); -
trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetManagementPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 of {@link ChangesetManagementPanel} class. 14 14 */ 15 publicclass ChangesetManagementPanelTest {15 class ChangesetManagementPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testChangesetManagementPanel() {28 void testChangesetManagementPanel() { 29 29 assertNotNull(new ChangesetManagementPanel(new ChangesetCommentModel())); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/CredentialDialogTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 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.gui.io.CredentialDialog.CredentialPanel; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 17 17 * Unit tests of {@link CredentialDialog} class. 18 18 */ 19 publicclass CredentialDialogTest {19 class CredentialDialogTest { 20 20 21 21 /** 22 22 * Setup tests 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testCredentialPanel() {32 void testCredentialPanel() { 33 33 CredentialPanel cp = new CredentialPanel(null); 34 34 cp.build(); -
trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java
r16329 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.io.File; … … 13 13 import java.util.Collections; 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.TestUtils; 18 18 import org.openstreetmap.josm.data.Preferences; … … 27 27 * Unit tests for class {@link CustomConfigurator}. 28 28 */ 29 publicclass CustomConfiguratorTest {29 class CustomConfiguratorTest { 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().preferences(); … … 41 41 */ 42 42 @Test 43 publicvoid testExportPreferencesKeysToFile() throws IOException {43 void testExportPreferencesKeysToFile() throws IOException { 44 44 File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml"); 45 45 … … 58 58 assertTrue(xml.contains("<preferences operation=\"replace\">")); 59 59 for (String entry : Config.getPref().getList("lorem_ipsum")) { 60 assertTrue( entry + "\nnot found in:\n" + xml, xml.contains(entry));60 assertTrue(xml.contains(entry), entry + "\nnot found in:\n" + xml); 61 61 } 62 62 … … 66 66 assertTrue(xml.contains("<preferences operation=\"append\">")); 67 67 for (String entry : Config.getPref().getList("test")) { 68 assertTrue( entry + "\nnot found in:\n" + xml, xml.contains(entry));68 assertTrue(xml.contains(entry), entry + "\nnot found in:\n" + xml); 69 69 } 70 70 … … 77 77 */ 78 78 @Test 79 publicvoid testReadXML() throws IOException {79 void testReadXML() throws IOException { 80 80 // Test 1 - read(dir, file) + append 81 81 Config.getPref().putList("test", Collections.<String>emptyList()); … … 83 83 CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml"); 84 84 String log = PreferencesUtils.getLog(); 85 assertFalse(log , log.contains("Error"));85 assertFalse(log.contains("Error"), log); 86 86 assertEquals(Arrays.asList("11111111", "2222222", "JOSM"), Config.getPref().getList("test")); 87 87 … … 94 94 CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref); 95 95 log = PreferencesUtils.getLog(); 96 assertFalse(log , log.contains("Error"));96 assertFalse(log.contains("Error"), log); 97 97 assertEquals(9, pref.getList("lorem_ipsum").size()); 98 98 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java
r16159 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 9 import java.awt.GraphicsEnvironment; … … 14 14 import javax.swing.JPanel; 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.TestUtils; 19 19 import org.openstreetmap.josm.data.UserIdentityManager; … … 32 32 * Unit tests of {@link DownloadOpenChangesetsTask} class. 33 33 */ 34 publicclass DownloadOpenChangesetsTaskTest {34 class DownloadOpenChangesetsTaskTest { 35 35 36 36 /** 37 37 * Setup tests 38 38 */ 39 @R ule39 @RegisterExtension 40 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 41 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI(); … … 72 72 */ 73 73 @Test 74 publicvoid testAnonymous() {74 void testAnonymous() { 75 75 TestUtils.assumeWorkingJMockit(); 76 76 if (GraphicsEnvironment.isHeadless()) { … … 105 105 */ 106 106 @Test 107 publicvoid testPartiallyIdentified() {107 void testPartiallyIdentified() { 108 108 TestUtils.assumeWorkingJMockit(); 109 109 if (GraphicsEnvironment.isHeadless()) { -
trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java
r13435 r17275 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.Arrays; 9 9 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.osm.DataSet; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 21 21 * Unit tests of {@link DownloadPrimitivesTask} class. 22 22 */ 23 publicclass DownloadPrimitivesTaskTest {23 class DownloadPrimitivesTaskTest { 24 24 25 25 /** 26 26 * Setup tests 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000); … … 34 34 */ 35 35 @Test 36 publicvoid testDownloadPrimitivesTask() {36 void testDownloadPrimitivesTask() { 37 37 DataSet ds = new DataSet(); 38 38 assertTrue(ds.allPrimitives().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCellTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNull;6 import static org.junit. Assert.assertTrue;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.assertTrue; 7 7 8 8 import java.io.File; … … 10 10 import javax.swing.JTable; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.osm.DataSet; 15 15 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; … … 22 22 * Unit tests of {@link LayerNameAndFilePathTableCell} class. 23 23 */ 24 publicclass LayerNameAndFilePathTableCellTest {24 class LayerNameAndFilePathTableCellTest { 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().preferences(); … … 34 34 */ 35 35 @Test 36 publicvoid testLayerNameAndFilePathTableCell() {36 void testLayerNameAndFilePathTableCell() { 37 37 JTable table = new JTable(); 38 38 File file = new File("test"); -
trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.io.File; 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.DataSet; 12 13 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; … … 19 20 * Unit tests of {@link SaveLayerInfo} class. 20 21 */ 21 publicclass SaveLayerInfoTest {22 class SaveLayerInfoTest { 22 23 /** 23 24 * Setup test. 24 25 */ 25 @R ule26 @RegisterExtension 26 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 28 public JOSMTestRules test = new JOSMTestRules(); … … 30 31 * Test of {@link SaveLayerInfo} class - null case. 31 32 */ 32 @Test (expected = IllegalArgumentException.class)33 @Test 33 34 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL") 34 publicvoid testSaveLayerInfoNull() {35 new SaveLayerInfo(null);35 void testSaveLayerInfoNull() { 36 assertThrows(IllegalArgumentException.class, () -> new SaveLayerInfo(null)); 36 37 } 37 38 … … 40 41 */ 41 42 @Test 42 publicvoid testSaveLayerInfoNominal() {43 void testSaveLayerInfoNominal() { 43 44 File file = new File("test"); 44 45 String name = "layername"; -
trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.data.osm.DataSet; 9 10 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 15 16 * Unit tests of {@link SaveLayerTask} class. 16 17 */ 17 publicclass SaveLayerTaskTest {18 class SaveLayerTaskTest { 18 19 /** 19 20 * Setup test. 20 21 */ 21 @R ule22 @RegisterExtension 22 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 24 public JOSMTestRules test = new JOSMTestRules(); … … 26 27 * Test of {@link SaveLayerTask} class - null case. 27 28 */ 28 @Test (expected = IllegalArgumentException.class)29 @Test 29 30 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL") 30 publicvoid testSaveLayerTaskNull() {31 new SaveLayerTask(null, null);31 void testSaveLayerTaskNull() { 32 assertThrows(IllegalArgumentException.class, () -> new SaveLayerTask(null, null)); 32 33 } 33 34 … … 36 37 */ 37 38 @Test 38 publicvoid testSaveLayerTaskNominal() {39 void testSaveLayerTaskNominal() { 39 40 assertNotNull(new SaveLayerTask(new SaveLayerInfo(new OsmDataLayer(new DataSet(), "", null)), null)); 40 41 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java
r14358 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.util.Collections; … … 13 13 import javax.swing.JOptionPane; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.data.osm.DataSet; 18 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 25 25 * Unit tests of {@link SaveLayersDialog} class. 26 26 */ 27 publicclass SaveLayersDialogTest {27 class SaveLayersDialogTest { 28 28 29 29 /** 30 30 * Setup tests 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 38 38 */ 39 39 @Test 40 publicvoid testConfirmSaveLayerInfosOK() {40 void testConfirmSaveLayerInfosOK() { 41 41 final List<SaveLayerInfo> list = Collections.singletonList(new SaveLayerInfo(new OsmDataLayer(new DataSet(), null, null))); 42 42 -
trunk/test/unit/org/openstreetmap/josm/gui/io/TagSettingsPanelTest.java
r12719 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 of {@link TagSettingsPanel} class. 14 14 */ 15 publicclass TagSettingsPanelTest {15 class TagSettingsPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testTagSettingsPanel() {28 void testTagSettingsPanel() { 29 29 assertNotNull(new TagSettingsPanel(new ChangesetCommentModel(), new ChangesetCommentModel(), new ChangesetReviewModel())); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.beans.PropertyChangeEvent; … … 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.gui.io.SaveLayersModel.Mode; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 19 19 * Unit tests of {@link UploadAndSaveProgressRenderer} class. 20 20 */ 21 publicclass UploadAndSaveProgressRendererTest {21 class UploadAndSaveProgressRendererTest { 22 22 23 23 /** 24 24 * Setup tests 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 testUploadAndSaveProgressRenderer() {34 void testUploadAndSaveProgressRenderer() { 35 35 JPanel parent = new JPanel(); 36 36 UploadAndSaveProgressRenderer r = new UploadAndSaveProgressRenderer(); -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadDialogTest.java
r16672 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.awt.GraphicsEnvironment; … … 17 17 import javax.swing.JOptionPane; 18 18 19 import org.junit. Rule;20 import org.junit. Test;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.gui.io.UploadDialog.UploadAction; … … 31 31 * Unit tests of {@link UploadDialog} class. 32 32 */ 33 publicclass UploadDialogTest {33 class UploadDialogTest { 34 34 35 35 /** 36 36 * Setup tests 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 43 43 private final String source; 44 44 private final String comment; 45 46 public int handleMissingCommentCalls;47 public int handleMissingSourceCalls;48 45 49 46 MockUploadDialog(final String comment, final String source) { … … 64 61 @Override 65 62 public void handleMissingSource() { 66 this.handleMissingSourceCalls += 1;67 63 } 68 64 69 65 @Override 70 66 public void handleMissingComment() { 71 this.handleMissingCommentCalls += 1;72 67 } 73 68 … … 107 102 */ 108 103 @Test 109 publicvoid testCancelAction() {104 void testCancelAction() { 110 105 if (GraphicsEnvironment.isHeadless()) { 111 106 TestUtils.assumeWorkingJMockit(); … … 120 115 */ 121 116 @Test 122 publicvoid testIsUploadCommentTooShort() {117 void testIsUploadCommentTooShort() { 123 118 assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort("")); 124 119 assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort("test")); … … 147 142 */ 148 143 @Test 149 publicvoid testGetLastChangesetCommentFromHistory() {144 void testGetLastChangesetCommentFromHistory() { 150 145 doTestGetLastChangesetTagFromHistory( 151 146 BasicUploadSettingsPanel.HISTORY_KEY, … … 158 153 */ 159 154 @Test 160 publicvoid testGetLastChangesetSourceFromHistory() {155 void testGetLastChangesetSourceFromHistory() { 161 156 doTestGetLastChangesetTagFromHistory( 162 157 BasicUploadSettingsPanel.SOURCE_HISTORY_KEY, … … 196 191 */ 197 192 @Test 198 publicvoid testValidateUploadTag() {193 void testValidateUploadTag() { 199 194 doTestValidateUploadTag("upload.comment"); 200 195 doTestValidateUploadTag("upload.source"); -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 of {@link UploadParameterSummaryPanel} class. 14 14 */ 15 publicclass UploadParameterSummaryPanelTest {15 class UploadParameterSummaryPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testUploadParameterSummaryPanel() {28 void testUploadParameterSummaryPanel() { 29 29 assertNotNull(new UploadParameterSummaryPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java
r12687 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.data.osm.Changeset; 9 9 import org.openstreetmap.josm.data.osm.DataSet; … … 17 17 * Unit tests of {@link UploadPrimitivesTask} class. 18 18 */ 19 publicclass UploadPrimitivesTaskTest {19 class UploadPrimitivesTaskTest { 20 20 21 21 /** 22 22 * Setup tests 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 testUploadPrimitivesTask() {32 void testUploadPrimitivesTask() { 33 33 assertNotNull(new UploadPrimitivesTask( 34 34 new UploadStrategySpecification(), -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java
r12687 r17275 2 2 package org.openstreetmap.josm.gui.io; 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.io.UploadStrategy; 9 9 import org.openstreetmap.josm.io.UploadStrategySpecification; … … 15 15 * Unit tests of {@link UploadStrategySelectionPanel} class. 16 16 */ 17 publicclass UploadStrategySelectionPanelTest {17 class UploadStrategySelectionPanelTest { 18 18 19 19 /** 20 20 * Setup tests 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI(); … … 28 28 */ 29 29 @Test 30 publicvoid testUploadStrategySelectionPanel() {30 void testUploadStrategySelectionPanel() { 31 31 UploadStrategySelectionPanel p = new UploadStrategySelectionPanel(); 32 32 p.setNumUploadedObjects(Integer.MAX_VALUE); … … 41 41 */ 42 42 @Test 43 publicvoid testUploadStrategySpecification() {43 void testUploadStrategySpecification() { 44 44 UploadStrategySelectionPanel p = new UploadStrategySelectionPanel(); 45 45 -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadTextComponentValidatorTest.java
r16672 r17275 8 8 import javax.swing.JTextField; 9 9 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.testutils.JOSMTestRules; 13 13 14 14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 15 16 publicclass UploadTextComponentValidatorTest {16 class UploadTextComponentValidatorTest { 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().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testUploadCommentValidator() {29 void testUploadCommentValidator() { 30 30 JTextField textField = new JTextField(); 31 31 JLabel feedback = new JLabel(); … … 42 42 */ 43 43 @Test 44 publicvoid testUploadSourceValidator() {44 void testUploadSourceValidator() { 45 45 JTextField textField = new JTextField(); 46 46 JLabel feedback = new JLabel(); -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.io; 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 of {@link UploadedObjectsSummaryPanel} class. 14 14 */ 15 publicclass UploadedObjectsSummaryPanelTest {15 class UploadedObjectsSummaryPanelTest { 16 16 17 17 /** 18 18 * Setup tests 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 testUploadedObjectsSummaryPanel() {28 void testUploadedObjectsSummaryPanel() { 29 29 assertNotNull(new UploadedObjectsSummaryPanel()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/importexport/JpgImporterTest.java
r12671 r17275 2 2 package org.openstreetmap.josm.gui.io.importexport; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.File; … … 11 11 import java.util.List; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 16 16 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 21 21 * Unit tests of {@link JpgImporter} class. 22 22 */ 23 publicclass JpgImporterTest {23 class JpgImporterTest { 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(); … … 35 35 */ 36 36 @Test 37 publicvoid testTicket14868() throws IOException {37 void testTicket14868() throws IOException { 38 38 List<File> files = new ArrayList<>(); 39 39 JpgImporter.addRecursiveFiles(files, new HashSet<>(), Arrays.asList( -
trunk/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java
r12671 r17275 2 2 package org.openstreetmap.josm.gui.io.importexport; 3 3 4 import static org.junit. Assert.assertNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.File; 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.gui.MainApplication; … … 16 16 * Unit tests of {@link NoteImporter} class. 17 17 */ 18 publicclass NoteImporterTest {18 class NoteImporterTest { 19 19 20 20 /** 21 21 * Use the test rules to remove any layers and reset state. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 public final JOSMTestRules rules = new JOSMTestRules(); 25 25 … … 28 28 */ 29 29 @Test 30 publicvoid testTicket12531() {30 void testTicket12531() { 31 31 MainApplication.getLayerManager().resetState(); 32 32 assertNull(MainApplication.getMap()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java
r10883 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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; 8 8 9 import org.junit. Before;10 import org.junit. Rule;11 import org.junit. Test;9 import org.junit.jupiter.api.BeforeEach; 10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 12 12 import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationListener; 13 13 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 19 19 * @author Michael Zangl 20 20 */ 21 publicclass AbstractMapViewPaintableTest {21 class AbstractMapViewPaintableTest { 22 22 /** 23 23 * No special test rules 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 32 32 * Create test layer 33 33 */ 34 @Before 34 @BeforeEach 35 35 public void setUp() { 36 36 testLayer = new LayerManagerTest.TestLayer(); … … 41 41 */ 42 42 @Test 43 publicvoid testInvalidate() {43 void testInvalidate() { 44 44 AtomicBoolean fired = new AtomicBoolean(); 45 45 PaintableInvalidationListener listener = l -> fired.set(true); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.awt.Point; … … 12 12 import java.util.concurrent.atomic.AtomicBoolean; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 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; 17 17 import org.openstreetmap.gui.jmapviewer.Coordinate; 18 18 import org.openstreetmap.gui.jmapviewer.Projected; … … 39 39 * Test of the base {@link AbstractTileSourceLayer} class 40 40 */ 41 publicclass AbstractTileSourceLayerTest {41 class AbstractTileSourceLayerTest { 42 42 43 43 /** 44 44 * Setup test 45 45 */ 46 @R ule46 @RegisterExtension 47 47 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 48 48 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 148 148 * Create test layer 149 149 */ 150 @Before 150 @BeforeEach 151 151 public void setUp() { 152 152 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); … … 159 159 */ 160 160 @Test 161 publicvoid testFilterChanged() {161 void testFilterChanged() { 162 162 try { 163 163 ImageryFilterSettings filterSettings = new ImageryFilterSettings(); … … 175 175 */ 176 176 @Test 177 publicvoid testClearTileCache() {177 void testClearTileCache() { 178 178 testLayer.loadAllTiles(true); 179 179 assertTrue(testLayer.getTileCache().getTileCount() > 0); … … 186 186 */ 187 187 @Test 188 publicvoid testGetAdjustAction() {188 void testGetAdjustAction() { 189 189 assertNotNull(testLayer.getAdjustAction()); 190 190 } … … 194 194 */ 195 195 @Test 196 publicvoid testGetInfoComponent() {196 void testGetInfoComponent() { 197 197 assertNotNull(testLayer.getInfoComponent()); 198 198 } … … 202 202 */ 203 203 @Test 204 publicvoid testTileSourceLayerPopup() {204 void testTileSourceLayerPopup() { 205 205 assertNotNull(testLayer.new TileSourceLayerPopup(100, 100)); 206 206 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java
r16977 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.io.BufferedWriter; … … 21 21 import java.util.List; 22 22 23 import org.junit. Before;24 import org.junit. Rule;25 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Test; 25 import org.junit.jupiter.api.extension.RegisterExtension; 26 26 import org.openstreetmap.josm.data.coor.LatLon; 27 27 import org.openstreetmap.josm.data.osm.DataSet; … … 36 36 * Unit tests for class {@link AutosaveTask}. 37 37 */ 38 publicclass AutosaveTaskTest {38 class AutosaveTaskTest { 39 39 /** 40 40 * We need preferences and a home directory for this. 41 41 */ 42 @R ule42 @RegisterExtension 43 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 44 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 50 50 * @throws IOException if autosave directory cannot be created 51 51 */ 52 @Before 52 @BeforeEach 53 53 public void setUp() throws IOException { 54 54 task = new AutosaveTask(); … … 59 59 */ 60 60 @Test 61 publicvoid testGetUnsavedLayersFilesEmpty() {61 void testGetUnsavedLayersFilesEmpty() { 62 62 assertTrue(task.getUnsavedLayersFiles().isEmpty()); 63 63 } … … 68 68 */ 69 69 @Test 70 publicvoid testGetUnsavedLayersFilesNotEmpty() throws IOException {70 void testGetUnsavedLayersFilesNotEmpty() throws IOException { 71 71 Files.createDirectories(task.getAutosaveDir()); 72 72 String autodir = task.getAutosaveDir().toString(); … … 90 90 */ 91 91 @Test 92 publicvoid testGetNewLayerFile() throws IOException {92 void testGetNewLayerFile() throws IOException { 93 93 Files.createDirectories(task.getAutosaveDir()); 94 94 AutosaveLayerInfo<?> info = new AutosaveLayerInfo<>(new OsmDataLayer(new DataSet(), "layer", null)); … … 127 127 */ 128 128 @Test 129 publicvoid testScheduleCreatesDirectories() {129 void testScheduleCreatesDirectories() { 130 130 try { 131 131 task.schedule(); … … 140 140 */ 141 141 @Test 142 publicvoid testAutosaveIgnoresUnmodifiedLayer() {142 void testAutosaveIgnoresUnmodifiedLayer() { 143 143 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "OsmData", null); 144 144 MainApplication.getLayerManager().addLayer(layer); … … 162 162 */ 163 163 @Test 164 publicvoid testAutosaveSavesLayer() {164 void testAutosaveSavesLayer() { 165 165 runAutosaveTaskSeveralTimes(1); 166 166 } … … 170 170 */ 171 171 @Test 172 publicvoid testAutosaveSavesLayerMultipleTimes() {172 void testAutosaveSavesLayerMultipleTimes() { 173 173 AutosaveTask.PROP_FILES_PER_LAYER.put(3); 174 174 runAutosaveTaskSeveralTimes(5); … … 199 199 */ 200 200 @Test 201 publicvoid testDiscardUnsavedLayersIgnoresCurrentInstance() throws IOException {201 void testDiscardUnsavedLayersIgnoresCurrentInstance() throws IOException { 202 202 runAutosaveTaskSeveralTimes(1); 203 203 try (BufferedWriter file = Files.newBufferedWriter( … … 215 215 */ 216 216 @Test 217 publicvoid testAutosaveHandlesDuplicateNames() {217 void testAutosaveHandlesDuplicateNames() { 218 218 DataSet data1 = new DataSet(); 219 219 OsmDataLayer layer1 = new OsmDataLayer(data1, "OsmData", null); … … 243 243 */ 244 244 @Test 245 publicvoid testRecoverLayers() throws Exception {245 void testRecoverLayers() throws Exception { 246 246 runAutosaveTaskSeveralTimes(1); 247 247 try (BufferedWriter file = Files.newBufferedWriter( -
trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java
r15924 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.awt.Color; … … 16 17 import javax.swing.JScrollPane; 17 18 18 import org.junit. Rule;19 import org.junit. Test;19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 20 21 import org.openstreetmap.josm.TestUtils; 21 22 import org.openstreetmap.josm.data.gpx.GpxData; … … 41 42 * Setup tests 42 43 */ 43 @R ule44 @RegisterExtension 44 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 46 public JOSMTestRules test = new JOSMTestRules().main().projection().i18n().metricSystem(); … … 74 75 */ 75 76 @Test 76 publicvoid testGpxLayer() throws Exception {77 void testGpxLayer() throws Exception { 77 78 GpxLayer layer = new GpxLayer(new GpxData(), "foo", false); 78 79 GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>()); … … 105 106 */ 106 107 @Test 107 publicvoid testGetInfoComponent() throws Exception {108 void testGetInfoComponent() throws Exception { 108 109 assertEquals("<html>\n"+ 109 110 " <head>\n" + … … 192 193 */ 193 194 @Test 194 publicvoid testGetTimespanForTrack() throws Exception {195 void testGetTimespanForTrack() throws Exception { 195 196 assertEquals("", GpxLayer.getTimespanForTrack( 196 197 new GpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<String, Object>()))); … … 207 208 */ 208 209 @Test 209 publicvoid testMergeFrom() throws Exception {210 void testMergeFrom() throws Exception { 210 211 GpxLayer layer = new GpxLayer(new GpxData()); 211 212 assertTrue(layer.data.isEmpty()); … … 219 220 * Test that {@link GpxLayer#mergeFrom} throws IAE for invalid arguments 220 221 */ 221 @Test (expected = IllegalArgumentException.class)222 publicvoid testMergeFromIAE() {223 new GpxLayer(new GpxData()).mergeFrom(new OsmDataLayer(new DataSet(), "", null));222 @Test 223 void testMergeFromIAE() { 224 assertThrows(IllegalArgumentException.class, () -> new GpxLayer(new GpxData()).mergeFrom(new OsmDataLayer(new DataSet(), "", null))); 224 225 } 225 226 … … 229 230 */ 230 231 @Test 231 publicvoid testPaint() throws Exception {232 void testPaint() throws Exception { 232 233 GpxLayer layer = getMinimalGpxLayer(); 233 234 try { … … 244 245 */ 245 246 @Test 246 publicvoid testGetChangesetSourceTag() {247 void testGetChangesetSourceTag() { 247 248 assertEquals("survey", new GpxLayer(new GpxData(), "", true).getChangesetSourceTag()); 248 249 assertNull(new GpxLayer(new GpxData(), "", false).getChangesetSourceTag()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/ImageryLayerTest.java
r10547 r17275 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.junit. Assert.assertNotNull;5 import static org.junit. Assert.assertSame;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertSame; 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.gui.layer.imagery.ImageryFilterSettings; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 15 15 * Unit tests of {@link ImageryLayer} class. 16 16 */ 17 publicclass ImageryLayerTest {17 class ImageryLayerTest { 18 18 19 19 /** 20 20 * For creating layers 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 28 28 */ 29 29 @Test 30 publicvoid testHasSettings() {30 void testHasSettings() { 31 31 ImageryLayer layer = TMSLayerTest.createTmsLayer(); 32 32 ImageryFilterSettings settings = layer.getFilterSettings(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerManagerTest.java
r16977 r17275 4 4 import static org.hamcrest.CoreMatchers.is; 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 import static org.junit. Assert.assertEquals;7 import static org.junit. Assert.assertFalse;8 import static org.junit. Assert.assertNotNull;9 import static org.junit. Assert.assertNull;10 import static org.junit. Assert.assertSame;11 import static org.junit. Assert.assertTrue;12 import static org.junit. Assert.fail;6 import static org.junit.jupiter.api.Assertions.assertEquals; 7 import static org.junit.jupiter.api.Assertions.assertFalse; 8 import static org.junit.jupiter.api.Assertions.assertNotNull; 9 import static org.junit.jupiter.api.Assertions.assertNull; 10 import static org.junit.jupiter.api.Assertions.assertSame; 11 import static org.junit.jupiter.api.Assertions.assertTrue; 12 import static org.junit.jupiter.api.Assertions.fail; 13 13 import static org.junit.jupiter.api.Assertions.assertThrows; 14 14 import static org.openstreetmap.josm.testutils.ThrowableRootCauseMatcher.hasRootCause; … … 25 25 import javax.swing.Icon; 26 26 27 import org.junit. Before;28 import org.junit. Test;27 import org.junit.jupiter.api.BeforeEach; 28 import org.junit.jupiter.api.Test; 29 29 import org.openstreetmap.josm.data.Bounds; 30 30 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; … … 166 166 * Set up test layer manager. 167 167 */ 168 @Before 168 @BeforeEach 169 169 public void setUp() { 170 170 layerManager = new LayerManager(); … … 175 175 */ 176 176 @Test 177 publicvoid testAddLayer() {177 void testAddLayer() { 178 178 Layer layer1 = new TestLayer() { 179 179 @Override … … 222 222 */ 223 223 @Test 224 publicvoid testAddLayerFails() {224 void testAddLayerFails() { 225 225 Exception e = assertThrows(ReportedException.class, () -> { 226 226 TestLayer layer1 = new TestLayer(); … … 236 236 */ 237 237 @Test 238 publicvoid testAddLayerIllegalPosition() {238 void testAddLayerIllegalPosition() { 239 239 Exception e = assertThrows(ReportedException.class, () -> { 240 240 TestLayer layer1 = new TestLayer() { … … 254 254 */ 255 255 @Test 256 publicvoid testRemoveLayer() {256 void testRemoveLayer() { 257 257 TestLayer layer1 = new TestLayer(); 258 258 TestLayer layer2 = new TestLayer(); … … 275 275 */ 276 276 @Test 277 publicvoid testMoveLayer() {277 void testMoveLayer() { 278 278 TestLayer layer1 = new TestLayer(); 279 279 TestLayer layer2 = new TestLayer(); … … 303 303 */ 304 304 @Test 305 publicvoid testMoveLayerFailsRange() {305 void testMoveLayerFailsRange() { 306 306 Exception e = assertThrows(ReportedException.class, () -> { 307 307 TestLayer layer1 = new TestLayer(); … … 319 319 */ 320 320 @Test 321 publicvoid testMoveLayerFailsNotInList() {321 void testMoveLayerFailsNotInList() { 322 322 Exception e = assertThrows(ReportedException.class, () -> { 323 323 TestLayer layer1 = new TestLayer(); … … 333 333 * {@link LayerManager#getLayers()} unmodifiable 334 334 */ 335 @Test (expected = UnsupportedOperationException.class)336 publicvoid testGetLayers() {335 @Test 336 void testGetLayers() { 337 337 // list should be immutable 338 338 TestLayer layer1 = new TestLayer(); … … 340 340 layerManager.addLayer(layer1); 341 341 layerManager.addLayer(layer2); 342 layerManager.getLayers().remove(0);342 assertThrows(UnsupportedOperationException.class, () -> layerManager.getLayers().remove(0)); 343 343 } 344 344 … … 347 347 */ 348 348 @Test 349 publicvoid testGetLayersOfType() {349 void testGetLayersOfType() { 350 350 TestLayer2 layer1 = new TestLayer2(); 351 351 TestLayer2 layer2 = new TestLayer2(); … … 361 361 */ 362 362 @Test 363 publicvoid testContainsLayer() {363 void testContainsLayer() { 364 364 TestLayer layer = new TestLayer(); 365 365 layerManager.addLayer(layer); … … 374 374 */ 375 375 @Test 376 publicvoid testAddLayerChangeListener() {376 void testAddLayerChangeListener() { 377 377 CapturingLayerChangeListener l = new CapturingLayerChangeListener(); 378 378 layerManager.addLayerChangeListener(l); … … 385 385 * {@link LayerManager#addLayerChangeListener(LayerChangeListener)} twice 386 386 */ 387 @Test (expected = IllegalArgumentException.class)388 publicvoid testAddLayerChangeListenerDuplicates() {387 @Test 388 void testAddLayerChangeListenerDuplicates() { 389 389 CapturingLayerChangeListener l = new CapturingLayerChangeListener(); 390 390 layerManager.addLayerChangeListener(l); 391 layerManager.addLayerChangeListener(l);391 assertThrows(IllegalArgumentException.class, () -> layerManager.addLayerChangeListener(l)); 392 392 } 393 393 … … 396 396 */ 397 397 @Test 398 publicvoid testAddLayerChangeListenerFire() {398 void testAddLayerChangeListenerFire() { 399 399 final ArrayList<Layer> fired = new ArrayList<>(); 400 400 TestLayer layer1 = new TestLayer(); … … 426 426 */ 427 427 @Test 428 publicvoid testRemoveLayerChangeListener() {428 void testRemoveLayerChangeListener() { 429 429 CapturingLayerChangeListener l = new CapturingLayerChangeListener(); 430 430 layerManager.addLayerChangeListener(l); … … 441 441 * {@link LayerManager#removeLayerChangeListener(LayerChangeListener)} listener not in list 442 442 */ 443 @Test (expected = IllegalArgumentException.class)444 publicvoid testRemoveLayerChangeListenerNotAdded() {445 CapturingLayerChangeListener l = new CapturingLayerChangeListener(); 446 layerManager.removeLayerChangeListener(l);443 @Test 444 void testRemoveLayerChangeListenerNotAdded() { 445 CapturingLayerChangeListener l = new CapturingLayerChangeListener(); 446 assertThrows(IllegalArgumentException.class, () -> layerManager.removeLayerChangeListener(l)); 447 447 } 448 448 … … 451 451 */ 452 452 @Test 453 publicvoid testRemoveLayerChangeListenerFire() {453 void testRemoveLayerChangeListenerFire() { 454 454 final ArrayList<Layer> fired = new ArrayList<>(); 455 455 TestLayer layer1 = new TestLayer(); … … 483 483 */ 484 484 @Test 485 publicvoid testLayerRemoveScheduleRemoval() {485 void testLayerRemoveScheduleRemoval() { 486 486 TestLayer layer1 = new TestLayer(); 487 487 TestLayer layer2 = new TestLayer(); … … 516 516 */ 517 517 @Test 518 publicvoid testResetState() {518 void testResetState() { 519 519 ResetStateChangeListener changeListener = new ResetStateChangeListener(); 520 520 layerManager.addLayer(new TestLayer()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerPositionStrategyTest.java
r11008 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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 8 8 /** 9 9 * Test the {@link LayerPositionStrategy} class. 10 10 */ 11 publicclass LayerPositionStrategyTest {11 class LayerPositionStrategyTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testNullManager() {17 void testNullManager() { 18 18 assertEquals(0, LayerPositionStrategy.inFrontOfFirst(l -> true).getPosition(null)); 19 19 assertEquals(0, LayerPositionStrategy.afterLast(l -> true).getPosition(null)); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.io.File; 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.data.projection.ProjectionRegistry; 16 16 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 22 22 * @author Michael Zangl 23 23 */ 24 publicclass LayerTest {24 class LayerTest { 25 25 /** 26 26 * We need projection 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 35 35 * Create test layer 36 36 */ 37 @Before 37 @BeforeEach 38 38 public void setUp() { 39 39 testLayer = new LayerManagerTest.TestLayer(); … … 44 44 */ 45 45 @Test 46 publicvoid testIsInfoResizable() {46 void testIsInfoResizable() { 47 47 assertFalse(testLayer.isInfoResizable()); 48 48 } … … 52 52 */ 53 53 @Test 54 publicvoid testAssociatedFile() {54 void testAssociatedFile() { 55 55 assertNull(testLayer.getAssociatedFile()); 56 56 … … 64 64 */ 65 65 @Test 66 publicvoid testGetName() {66 void testGetName() { 67 67 assertEquals("Test Layer", testLayer.getName()); 68 68 } … … 72 72 */ 73 73 @Test 74 publicvoid testSetName() {74 void testSetName() { 75 75 testLayer.setName("Test Layer2"); 76 76 assertEquals("Test Layer2", testLayer.getName()); … … 89 89 */ 90 90 @Test 91 publicvoid testRename() {91 void testRename() { 92 92 assertFalse(testLayer.isRenamed()); 93 93 testLayer.rename("Test Layer2"); … … 100 100 */ 101 101 @Test 102 publicvoid testBackgroundLayer() {102 void testBackgroundLayer() { 103 103 assertFalse(testLayer.isBackgroundLayer()); 104 104 testLayer.setBackgroundLayer(true); … … 110 110 */ 111 111 @Test 112 publicvoid testVisible() {112 void testVisible() { 113 113 assertTrue(testLayer.isVisible()); 114 114 testLayer.setVisible(false); … … 122 122 */ 123 123 @Test 124 publicvoid testToggleVisible() {124 void testToggleVisible() { 125 125 assertTrue(testLayer.isVisible()); 126 126 testLayer.toggleVisible(); … … 134 134 */ 135 135 @Test 136 publicvoid testOpacity() {136 void testOpacity() { 137 137 assertEquals(1, testLayer.getOpacity(), 1e-3); 138 138 … … 152 152 */ 153 153 @Test 154 publicvoid testIsProjectionSupported() {154 void testIsProjectionSupported() { 155 155 assertFalse(testLayer.isProjectionSupported(null)); 156 156 assertTrue(testLayer.isProjectionSupported(ProjectionRegistry.getProjection())); … … 161 161 */ 162 162 @Test 163 publicvoid testNameSupportedProjections() {163 void testNameSupportedProjections() { 164 164 assertNotNull(testLayer.nameSupportedProjections()); 165 165 } … … 169 169 */ 170 170 @Test 171 publicvoid testIsSavable() {171 void testIsSavable() { 172 172 assertFalse(testLayer.isSavable()); 173 173 } … … 177 177 */ 178 178 @Test 179 publicvoid testCheckSaveConditions() {179 void testCheckSaveConditions() { 180 180 assertTrue(testLayer.checkSaveConditions()); 181 181 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/MainLayerManagerTest.java
r14273 r17275 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 6 import static org.junit.Assert.assertSame; 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.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.Arrays; 9 10 10 import org.junit. Before;11 import org.junit. BeforeClass;12 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 13 14 import org.openstreetmap.josm.JOSMFixture; 14 15 import org.openstreetmap.josm.data.osm.DataSet; … … 21 22 * @author Michael Zangl 22 23 */ 23 publicclass MainLayerManagerTest extends LayerManagerTest {24 class MainLayerManagerTest extends LayerManagerTest { 24 25 25 26 private MainLayerManager layerManagerWithActive; … … 54 55 } 55 56 56 @Before Class57 @BeforeAll 57 58 public static void setUpClass() { 58 59 JOSMFixture.createUnitTestFixture().init(); … … 60 61 61 62 @Override 62 @Before 63 @BeforeEach 63 64 public void setUp() { 64 65 layerManager = layerManagerWithActive = new MainLayerManager(); … … 66 67 67 68 @Test 68 publicvoid testAddLayerSetsActiveLayer() {69 void testAddLayerSetsActiveLayer() { 69 70 TestLayer layer1 = new TestLayer(); 70 71 AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer(); … … 84 85 85 86 @Test 86 publicvoid testRemoveLayerUnsetsActiveLayer() {87 void testRemoveLayerUnsetsActiveLayer() { 87 88 TestLayer layer1 = new TestLayer(); 88 89 AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer(); … … 114 115 */ 115 116 @Test 116 publicvoid testAddActiveLayerChangeListener() {117 void testAddActiveLayerChangeListener() { 117 118 TestLayer layer1 = new TestLayer(); 118 119 AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer(); … … 141 142 * Test if {@link MainLayerManager#addActiveLayerChangeListener(ActiveLayerChangeListener)} prevents listener from being added twice. 142 143 */ 143 @Test (expected = IllegalArgumentException.class)144 publicvoid testAddActiveLayerChangeListenerTwice() {144 @Test 145 void testAddActiveLayerChangeListenerTwice() { 145 146 CapturingActiveLayerChangeListener listener = new CapturingActiveLayerChangeListener(); 146 147 layerManagerWithActive.addActiveLayerChangeListener(listener); 147 layerManagerWithActive.addActiveLayerChangeListener(listener);148 assertThrows(IllegalArgumentException.class, () -> layerManagerWithActive.addActiveLayerChangeListener(listener)); 148 149 } 149 150 … … 152 153 */ 153 154 @Test 154 publicvoid testRemoveActiveLayerChangeListener() {155 void testRemoveActiveLayerChangeListener() { 155 156 TestLayer layer1 = new TestLayer(); 156 157 AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer(); … … 169 170 * Test if {@link MainLayerManager#removeActiveLayerChangeListener(ActiveLayerChangeListener)} checks if listener is in list. 170 171 */ 171 @Test(expected = IllegalArgumentException.class) 172 public void testRemoveActiveLayerChangeListenerNotInList() { 173 layerManagerWithActive.removeActiveLayerChangeListener(new CapturingActiveLayerChangeListener()); 172 @Test 173 void testRemoveActiveLayerChangeListenerNotInList() { 174 assertThrows(IllegalArgumentException.class, 175 () -> layerManagerWithActive.removeActiveLayerChangeListener(new CapturingActiveLayerChangeListener())); 174 176 } 175 177 … … 180 182 */ 181 183 @Test 182 publicvoid testSetGetActiveLayer() {184 void testSetGetActiveLayer() { 183 185 TestLayer layer1 = new TestLayer(); 184 186 TestLayer layer2 = new TestLayer(); … … 197 199 */ 198 200 @Test 199 publicvoid testGetEditDataSet() {201 void testGetEditDataSet() { 200 202 assertNull(layerManagerWithActive.getEditDataSet()); 201 203 TestLayer layer0 = new TestLayer(); … … 219 221 */ 220 222 @Test 221 publicvoid testGetVisibleLayersInZOrder() {223 void testGetVisibleLayersInZOrder() { 222 224 AbstractTestOsmLayer layer1 = new AbstractTestOsmLayer(); 223 225 AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java
r10300 r17275 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent; … … 12 12 * Unit tests of {@link MapViewPaintable} class. 13 13 */ 14 publicclass MapViewPaintableTest {14 class MapViewPaintableTest { 15 15 16 16 /** 17 17 * Setup tests 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testToString() {28 void testToString() { 29 29 assertEquals("LayerInvalidationEvent [layer=null]", new PaintableInvalidationEvent(null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java
r10306 r17275 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 5 6 6 import java.util.Collections; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.JOSMFixture; 11 11 … … 13 13 * Unit tests of {@link NativeScaleLayer} class. 14 14 */ 15 publicclass NativeScaleLayerTest {15 class NativeScaleLayerTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @Before Class20 @BeforeAll 21 21 public static void setUpBeforeClass() { 22 22 JOSMFixture.createUnitTestFixture().init(); … … 27 27 */ 28 28 @Test 29 publicvoid testTicket12255() {29 void testTicket12255() { 30 30 assertNull(new NativeScaleLayer.ScaleList(Collections.<Double>emptyList()).getSnapScale(10, 2, false)); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java
r13165 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link NoteLayer} class. 14 14 */ 15 publicclass NoteLayerTest {15 class NoteLayerTest { 16 16 17 17 /** 18 18 * Setup tests 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 testTicket13208() {28 void testTicket13208() { 29 29 assertEquals("0 notes", new NoteLayer().getToolTipText()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testInsertLineBreaks() {36 void testInsertLineBreaks() { 37 37 // empty string 38 38 assertEquals("", NoteLayer.insertLineBreaks("")); … … 61 61 */ 62 62 @Test 63 publicvoid testReplaceLinks() {63 void testReplaceLinks() { 64 64 // empty string 65 65 assertEquals("", NoteLayer.replaceLinks("")); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java
r16969 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.io.ByteArrayInputStream; … … 15 15 import java.util.Iterator; 16 16 17 import org.junit. Before;18 import org.junit. Rule;19 import org.junit. Test;17 import org.junit.jupiter.api.BeforeEach; 18 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension; 20 20 import org.openstreetmap.josm.TestUtils; 21 21 import org.openstreetmap.josm.actions.ExpertToggleAction; … … 46 46 * Unit tests of {@link OsmDataLayer} class. 47 47 */ 48 publicclass OsmDataLayerTest {48 class OsmDataLayerTest { 49 49 50 50 /** 51 51 * Setup tests 52 52 */ 53 @R ule53 @RegisterExtension 54 54 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 55 55 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 61 61 * Setup tests 62 62 */ 63 @Before 63 @BeforeEach 64 64 public void setUp() { 65 65 ds = new DataSet(); … … 72 72 */ 73 73 @Test 74 publicvoid testRecentRelation() {74 void testRecentRelation() { 75 75 int n = OsmDataLayer.PROPERTY_RECENT_RELATIONS_NUMBER.get(); 76 76 assertTrue(n > 0); … … 93 93 */ 94 94 @Test 95 publicvoid testGetInfoComponent() {95 void testGetInfoComponent() { 96 96 assertNotNull(layer.getInfoComponent()); 97 97 … … 130 130 */ 131 131 @Test 132 publicvoid testLayerStateChangeListenerNull() {132 void testLayerStateChangeListenerNull() { 133 133 layer.addLayerStateChangeListener(null); 134 134 } … … 138 138 */ 139 139 @Test 140 publicvoid testGetIcon() {140 void testGetIcon() { 141 141 assertNotNull(layer.getIcon()); 142 142 layer.setUploadDiscouraged(true); … … 148 148 */ 149 149 @Test 150 publicvoid testPaint() {150 void testPaint() { 151 151 fillDataSet(ds); 152 152 assertNotNull(MainApplication.getMap()); … … 158 158 */ 159 159 @Test 160 publicvoid testGetToolTipText() {160 void testGetToolTipText() { 161 161 assertEquals("<html>0 nodes<br>0 ways<br>0 relations</html>", new OsmDataLayer(ds, "", null).getToolTipText()); 162 162 fillDataSet(ds); … … 169 169 */ 170 170 @Test 171 publicvoid testMergeFrom() {171 void testMergeFrom() { 172 172 fillDataSet(ds); 173 173 OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "", null); … … 186 186 */ 187 187 @Test 188 publicvoid testCleanupAfterUpload() {188 void testCleanupAfterUpload() { 189 189 fillDataSet(ds); 190 190 assertEquals(6, layer.data.allPrimitives().size()); … … 197 197 */ 198 198 @Test 199 publicvoid testGetMenuEntries() {199 void testGetMenuEntries() { 200 200 ExpertToggleAction.getInstance().setExpert(true); 201 201 assertEquals(17, layer.getMenuEntries().length); … … 210 210 */ 211 211 @Test 212 publicvoid testToGpxData() throws IllegalDataException {212 void testToGpxData() throws IllegalDataException { 213 213 ds.mergeFrom(OsmReader.parseDataSet(new ByteArrayInputStream(( 214 214 "<?xml version='1.0' encoding='UTF-8'?>\n" + … … 264 264 */ 265 265 @Test 266 publicvoid testContainsPoint() {266 void testContainsPoint() { 267 267 fillDataSet(ds); 268 268 assertTrue(layer.containsPoint(LatLon.ZERO)); … … 273 273 */ 274 274 @Test 275 publicvoid testIsModified() {275 void testIsModified() { 276 276 assertFalse(layer.isModified()); 277 277 fillDataSet(ds); … … 283 283 */ 284 284 @Test 285 publicvoid testProjectionChanged() {285 void testProjectionChanged() { 286 286 layer.projectionChanged(null, null); 287 287 } … … 291 291 */ 292 292 @Test 293 publicvoid testCheckSaveConditions() {293 void testCheckSaveConditions() { 294 294 TestUtils.assumeWorkingJMockit(); 295 295 final ExtendedDialogMocker edMocker = new ExtendedDialogMocker( … … 311 311 */ 312 312 @Test 313 publicvoid testLayerNameIncreases() {313 void testLayerNameIncreases() { 314 314 final OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), OsmDataLayer.createLayerName(147), null); 315 315 final OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null); … … 322 322 */ 323 323 @Test 324 publicvoid testLayerUnnumberedName() {324 void testLayerUnnumberedName() { 325 325 final OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Data Layer ", null); 326 326 assertEquals("Data Layer ", layer.getName()); … … 331 331 */ 332 332 @Test 333 publicvoid testLayerNameDoesFinish() {333 void testLayerNameDoesFinish() { 334 334 final OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Data Layer from GeoJSON: foo.geojson", null); 335 335 assertEquals("Data Layer from GeoJSON: foo.geojson", layer.getName()); … … 340 340 */ 341 341 @Test 342 publicvoid testTicket17065() {342 void testTicket17065() { 343 343 ClipboardUtils.clear(); 344 344 Logging.clearLastErrorAndWarnings(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension; 8 8 import org.openstreetmap.josm.data.imagery.ImageryInfo; 9 9 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; … … 21 21 * Setup tests 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(); … … 63 63 */ 64 64 @Test 65 publicvoid testTMSLayer() {65 void testTMSLayer() { 66 66 test(ImageryType.TMS, createTmsLayer()); 67 67 test(ImageryType.BING, createBingLayer()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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 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.osm.DataSet; 12 12 import org.openstreetmap.josm.gui.MainApplication; … … 18 18 * Unit tests of {@link ValidatorLayer} class. 19 19 */ 20 publicclass ValidatorLayerTest {20 class ValidatorLayerTest { 21 21 22 22 /** 23 23 * Setup tests 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 31 31 */ 32 32 @Test 33 publicvoid testValidatorLayer() {33 void testValidatorLayer() { 34 34 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); 35 35 ValidatorLayer layer = new ValidatorLayer(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.data.imagery.ImageryInfo; 9 10 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; … … 16 17 * Unit tests of {@link WMSLayer} class. 17 18 */ 18 publicclass WMSLayerTest {19 class WMSLayerTest { 19 20 20 21 /** 21 22 * Setup tests 22 23 */ 23 @R ule24 @RegisterExtension 24 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 26 public JOSMTestRules test = new JOSMTestRules().main().projection(); … … 29 30 */ 30 31 @Test 31 publicvoid testWMSLayer() {32 void testWMSLayer() { 32 33 WMSLayer wms = new WMSLayer(new ImageryInfo("test wms", "http://localhost")); 33 34 MainApplication.getLayerManager().addLayer(wms); … … 43 44 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13828">Bug #13828</a>. 44 45 */ 45 @Test (expected = IllegalArgumentException.class)46 publicvoid testTicket13828() {47 new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"));46 @Test 47 void testTicket13828() { 48 assertThrows(IllegalArgumentException.class, () -> new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"))); 48 49 } 49 50 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java
r13733 r17275 2 2 package org.openstreetmap.josm.gui.layer; 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.imagery.ImageryInfo; 9 9 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; … … 15 15 * Unit tests of {@link WMTSLayer} class. 16 16 */ 17 publicclass WMTSLayerTest {17 class WMTSLayerTest { 18 18 19 19 /** 20 20 * Setup tests 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000); … … 28 28 */ 29 29 @Test 30 publicvoid testWMTSLayer() {30 void testWMTSLayer() { 31 31 WMTSLayer wmts = new WMTSLayer(new ImageryInfo("test wmts", "http://localhost", "wmts", null, null)); 32 32 assertEquals(ImageryType.WMTS, wmts.getInfo().getImageryType()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.gui.layer.geoimage; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Collections; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.gpx.GpxData; 12 12 import org.openstreetmap.josm.data.gpx.GpxTimeOffset; … … 23 23 * Unit tests of {@link CorrelateGpxWithImages} class. 24 24 */ 25 publicclass CorrelateGpxWithImagesTest {25 class CorrelateGpxWithImagesTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 * Setup test. 36 36 */ 37 @Before Class37 @BeforeAll 38 38 public static void setUp() { 39 39 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 45 45 */ 46 46 @Test 47 publicvoid testAutoGuess() throws Exception {47 void testAutoGuess() throws Exception { 48 48 final GpxData gpx = GpxReaderTest.parseGpxData("nodist/data/2094047.gpx"); 49 49 final ImageEntry i0 = new ImageEntry(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
r12636 r17275 2 2 package org.openstreetmap.josm.gui.layer.geoimage; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 6 7 7 8 import java.io.File; … … 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.data.osm.DataSet; … … 26 27 * Unit tests of {@link GeoImageLayer} class. 27 28 */ 28 publicclass GeoImageLayerTest {29 class GeoImageLayerTest { 29 30 /** 30 31 * We need prefs for this. 31 32 */ 32 @R ule33 @RegisterExtension 33 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 35 public JOSMTestRules test = new JOSMTestRules().preferences(); 35 36 36 37 37 /** … … 40 40 */ 41 41 @Test 42 publicvoid testLoader() throws Exception {42 void testLoader() throws Exception { 43 43 try (InputStream in = TestUtils.getRegressionDataStream(12255, "bobrava2.gpx")) { 44 44 GpxReader reader = new GpxReader(in); … … 63 63 * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments 64 64 */ 65 @Test (expected = IllegalArgumentException.class)66 publicvoid testMergeFromIAE() {67 new GeoImageLayer(null, null).mergeFrom(new OsmDataLayer(new DataSet(), "", null));65 @Test 66 void testMergeFromIAE() { 67 assertThrows(IllegalArgumentException.class, () -> new GeoImageLayer(null, null).mergeFrom(new OsmDataLayer(new DataSet(), "", null))); 68 68 } 69 69 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplayTest.java
r13127 r17275 2 2 package org.openstreetmap.josm.gui.layer.geoimage; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.awt.Dimension; 7 7 import java.awt.Rectangle; 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.gui.layer.geoimage.ImageDisplay.VisRect; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 17 17 * Unit tests of {@link ImageDisplay} class. 18 18 */ 19 publicclass ImageDisplayTest {19 class ImageDisplayTest { 20 20 /** 21 21 * We need prefs for this. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 29 29 */ 30 30 @Test 31 publicvoid testCalculateDrawImageRectangle() {31 void testCalculateDrawImageRectangle() { 32 32 assertEquals(new Rectangle(), 33 33 ImageDisplay.calculateDrawImageRectangle(new VisRect(), new Dimension())); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageEntryTest.java
r14212 r17275 2 2 package org.openstreetmap.josm.gui.layer.geoimage; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.File; 7 7 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.TestUtils; 10 10 import org.openstreetmap.josm.data.gpx.GpxImageEntry; … … 16 16 * Unit tests of {@link ImageEntry} class. 17 17 */ 18 publicclass ImageEntryTest {18 class ImageEntryTest { 19 19 20 20 /** … … 22 22 */ 23 23 @Test 24 publicvoid testTicket12255() {24 void testTicket12255() { 25 25 ImageEntry e = new ImageEntry(new File(TestUtils.getRegressionDataFile(12255, "G0016941.JPG"))); 26 26 e.extractExif(); … … 32 32 */ 33 33 @Test 34 publicvoid testEqualsContract() {34 void testEqualsContract() { 35 35 TestUtils.assumeWorkingEqualsVerifier(); 36 36 EqualsVerifier.forClass(ImageEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java
r15516 r17275 2 2 package org.openstreetmap.josm.gui.layer.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.JLabel; 7 7 import javax.swing.JPanel; 8 8 9 import org.junit. Ignore;10 import org.junit. Rule;11 import org.junit. Test;9 import org.junit.jupiter.api.Disabled; 10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 12 12 import org.openstreetmap.josm.TestUtils; 13 13 import org.openstreetmap.josm.gui.ExtendedDialog; … … 21 21 * Unit tests of {@link ChooseTrackVisibilityAction} class. 22 22 */ 23 publicclass ChooseTrackVisibilityActionTest {23 class ChooseTrackVisibilityActionTest { 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(); … … 35 35 */ 36 36 @Test 37 @ Ignore("broken, see #16796")38 publicvoid testAction() throws Exception {37 @Disabled("broken, see #16796") 38 void testAction() throws Exception { 39 39 TestUtils.assumeWorkingJMockit(); 40 40 final ExtendedDialogMocker edMocker = new ExtendedDialogMocker() { -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java
r16953 r17275 2 2 package org.openstreetmap.josm.gui.layer.gpx; 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; … … 15 15 import java.util.stream.Collectors; 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.data.coor.LatLon; … … 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(); … … 51 51 */ 52 52 @Test 53 publicvoid testFromMarkerLayer() throws Exception {53 void testFromMarkerLayer() throws Exception { 54 54 final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "minimal.gpx"); 55 55 final MarkerLayer markers = new MarkerLayer(data, "Markers", data.storageFile, null); … … 65 65 */ 66 66 @Test 67 publicvoid testFromTrack() throws Exception {67 void testFromTrack() throws Exception { 68 68 Config.getPref().put("gpx.convert-tags", "no"); 69 69 testFromTrack("tracks.gpx", "tracks.osm"); … … 138 138 .collect(Collectors.toList()); 139 139 140 assertEquals( "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", nodesExpected, nodes);140 assertEquals(nodesExpected, nodes, "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!"); 141 141 142 142 List<String> ways = osm.getWays().stream() … … 152 152 .collect(Collectors.toList()); 153 153 154 assertEquals( "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", waysExpected, ways);154 assertEquals(waysExpected, ways, "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!"); 155 155 156 assertEquals( "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", osmExpected.allPrimitives().size(),157 osm.allPrimitives().size());156 assertEquals(osmExpected.allPrimitives().size(), osm.allPrimitives().size(), 157 "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!"); 158 158 } 159 159 … … 164 164 */ 165 165 @Test 166 publicvoid testTicket14275() throws IOException, SAXException {166 void testTicket14275() throws IOException, SAXException { 167 167 assertNotNull(GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(14275, "1485101437.8189685.gpx"))); 168 168 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java
r16850 r17275 2 2 package org.openstreetmap.josm.gui.layer.gpx; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;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 7 8 8 import java.util.Collections; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.data.gpx.GpxData; … … 25 25 * Unit tests of {@link DownloadAlongTrackAction} class. 26 26 */ 27 publicclass DownloadAlongTrackActionTest {27 class DownloadAlongTrackActionTest { 28 28 29 29 /** 30 30 * The test rules for this test 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 72 72 */ 73 73 @Test 74 publicvoid testDownload() throws Exception {74 void testDownload() throws Exception { 75 75 assertNotNull(createTask("minimal.gpx")); 76 76 } … … 81 81 */ 82 82 @Test 83 publicvoid testDownloadEmpty() throws Exception {83 void testDownloadEmpty() throws Exception { 84 84 assertNull(createTask("empty.gpx")); 85 85 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java
r16160 r17275 2 2 package org.openstreetmap.josm.gui.layer.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.FileNotFoundException; … … 12 12 import java.util.stream.Collectors; 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.gpx.GpxData; … … 28 28 * Unit tests of {@link GpxDrawHelper} class. 29 29 */ 30 publicclass GpxDrawHelperTest {30 class GpxDrawHelperTest { 31 31 32 32 /** 33 33 * Setup test. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules(); … … 44 44 */ 45 45 @Test 46 publicvoid testTicket12312() throws FileNotFoundException, IOException, SAXException {46 void testTicket12312() throws FileNotFoundException, IOException, SAXException { 47 47 final Map<String, String> prefs = new HashMap<String, String>() {{ 48 48 put("colormode.dynamic-range", "true"); … … 60 60 */ 61 61 @Test 62 publicvoid testNone() throws IOException, SAXException {62 void testNone() throws IOException, SAXException { 63 63 final List<String> colors = calculateColors("nodist/data/2094047.gpx", Collections.emptyMap(), 10); 64 64 assertEquals("[#000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000]", colors.toString()); … … 72 72 */ 73 73 @Test 74 publicvoid testVelocity() throws IOException, SAXException {74 void testVelocity() throws IOException, SAXException { 75 75 final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.VELOCITY.toIndex())); 76 76 final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10); … … 85 85 */ 86 86 @Test 87 publicvoid testVelocityDynamic() throws IOException, SAXException {87 void testVelocityDynamic() throws IOException, SAXException { 88 88 final Map<String, String> prefs = new HashMap<String, String>() {{ 89 89 put("colormode.dynamic-range", "true"); … … 101 101 */ 102 102 @Test 103 publicvoid testDirection() throws IOException, SAXException {103 void testDirection() throws IOException, SAXException { 104 104 final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.DIRECTION.toIndex())); 105 105 final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10); … … 114 114 */ 115 115 @Test 116 publicvoid testTime() throws IOException, SAXException {116 void testTime() throws IOException, SAXException { 117 117 final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.TIME.toIndex())); 118 118 final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java
r13397 r17275 2 2 package org.openstreetmap.josm.gui.layer.imagery; 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.awt.Color; … … 11 11 import java.awt.image.IndexColorModel; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; 16 16 … … 21 21 * @author Michael Zangl 22 22 */ 23 publicclass ColorfulImageProcessorTest {23 class ColorfulImageProcessorTest { 24 24 25 25 private static final int TEST_IMAGE_SIZE = 5; … … 44 44 * No special rules 45 45 */ 46 @R ule46 @RegisterExtension 47 47 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 48 48 public JOSMTestRules test = new JOSMTestRules(); … … 52 52 */ 53 53 @Test 54 publicvoid testSetGet() {54 void testSetGet() { 55 55 ColorfulImageProcessor processor = new ColorfulImageProcessor(); 56 56 … … 80 80 */ 81 81 @Test 82 publicvoid testProcessing() {82 void testProcessing() { 83 83 for (ConversionData data : new ConversionData[] { 84 84 new ConversionData(Color.BLACK, 1.5, Color.BLACK), … … 114 114 for (int y = 0; y < TEST_IMAGE_SIZE; y++) { 115 115 Color color = new Color(image.getRGB(x, y)); 116 assertEquals(data + ":" + type + ": red", data.getExpectedColor().getRed(), color.getRed(), 1.05);117 assertEquals(data + ":" + type + ": green", data.getExpectedColor().getGreen(), color.getGreen(), 1.05);118 assertEquals(data + ":" + type + ": blue", data.getExpectedColor().getBlue(), color.getBlue(), 1.05);116 assertEquals(data.getExpectedColor().getRed(), color.getRed(), 1.05, data + ":" + type + ": red"); 117 assertEquals(data.getExpectedColor().getGreen(), color.getGreen(), 1.05, data + ":" + type + ": green"); 118 assertEquals(data.getExpectedColor().getBlue(), color.getBlue(), 1.05, data + ":" + type + ": blue"); 119 119 } 120 120 } … … 171 171 */ 172 172 @Test 173 publicvoid testToString() {173 void testToString() { 174 174 ColorfulImageProcessor processor = new ColorfulImageProcessor(); 175 175 assertEquals("ColorfulImageProcessor [colorfulness=1.0]", processor.toString()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java
r10547 r17275 2 2 package org.openstreetmap.josm.gui.layer.imagery; 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.testutils.JOSMTestRules; 9 9 … … 14 14 * @author Michael Zangl 15 15 */ 16 publicclass GammaImageProcessorTest {16 class GammaImageProcessorTest { 17 17 18 18 /** 19 19 * No special rules 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules(); … … 27 27 */ 28 28 @Test 29 publicvoid testSetGet() {29 void testSetGet() { 30 30 GammaImageProcessor processor = new GammaImageProcessor(); 31 31 … … 55 55 */ 56 56 @Test 57 publicvoid testToString() {57 void testToString() { 58 58 GammaImageProcessor processor = new GammaImageProcessor(); 59 59 assertEquals("GammaImageProcessor [gamma=1.0]", processor.toString()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java
r10556 r17275 2 2 package org.openstreetmap.josm.gui.layer.imagery; 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.testutils.JOSMTestRules; 9 9 … … 14 14 * @author Michael Zangl 15 15 */ 16 publicclass SharpenImageProcessorTest {16 class SharpenImageProcessorTest { 17 17 18 18 /** 19 19 * No special rules 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules(); … … 27 27 */ 28 28 @Test 29 publicvoid testSetGet() {29 void testSetGet() { 30 30 SharpenImageProcessor processor = new SharpenImageProcessor(); 31 31 … … 55 55 */ 56 56 @Test 57 publicvoid testToString() {57 void testToString() { 58 58 SharpenImageProcessor processor = new SharpenImageProcessor(); 59 59 assertEquals("SharpenImageProcessor [sharpenLevel=1.0]", processor.toString()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.gui.layer.markerlayer; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.net.MalformedURLException; 7 7 import java.net.URL; 8 8 9 import org.junit. BeforeClass;10 import org.junit. Test;9 import org.junit.jupiter.api.BeforeAll; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 17 17 * Unit tests of {@link AudioMarker} class. 18 18 */ 19 publicclass AudioMarkerTest {19 class AudioMarkerTest { 20 20 21 21 /** 22 22 * Setup tests 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUpBeforeClass() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAudioMarker() throws MalformedURLException {34 void testAudioMarker() throws MalformedURLException { 35 35 URL url = new URL("file://something.wav"); 36 36 AudioMarker marker = new AudioMarker( -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
r9779 r17275 2 2 package org.openstreetmap.josm.gui.layer.markerlayer; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.net.MalformedURLException; 7 7 import java.net.URL; 8 8 9 import org.junit. BeforeClass;10 import org.junit. Test;9 import org.junit.jupiter.api.BeforeAll; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 17 17 * Unit tests of {@link ImageMarker} class. 18 18 */ 19 publicclass ImageMarkerTest {19 class ImageMarkerTest { 20 20 21 21 /** 22 22 * Setup tests 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUpBeforeClass() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testImageMarker() throws MalformedURLException {34 void testImageMarker() throws MalformedURLException { 35 35 ImageMarker marker = new ImageMarker( 36 36 LatLon.ZERO, -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.gui.layer.markerlayer; 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 9 import java.util.Arrays; 10 10 11 import org.junit. Before;12 import org.junit. Rule;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 29 29 * Unit tests of {@link MarkerLayer} class. 30 30 */ 31 publicclass MarkerLayerTest {31 class MarkerLayerTest { 32 32 33 33 /** 34 34 * For creating layers 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().main().preferences().projection(); … … 41 41 * Setup tests 42 42 */ 43 @Before 43 @BeforeEach 44 44 public void setUp() { 45 45 Config.getPref().putBoolean("marker.traceaudio", true); … … 50 50 */ 51 51 @Test 52 publicvoid testMarkerLayer() {52 void testMarkerLayer() { 53 53 MarkerLayer layer = new MarkerLayer(new GpxData(), "foo", null, null); 54 54 MainApplication.getLayerManager().addLayer(layer); … … 83 83 */ 84 84 @Test 85 publicvoid testPlayHeadMarker() {85 void testPlayHeadMarker() { 86 86 try { 87 87 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null)); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java
r9814 r17275 2 2 package org.openstreetmap.josm.gui.layer.markerlayer; 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 import org.junit. BeforeClass;8 import org.junit. Test;7 import org.junit.jupiter.api.BeforeAll; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 import org.openstreetmap.josm.data.coor.LatLon; … … 14 14 * Unit tests of {@link PlayHeadMarker} class. 15 15 */ 16 publicclass PlayHeadMarkerTest {16 class PlayHeadMarkerTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @Before Class21 @BeforeAll 22 22 public static void setUpBeforeClass() { 23 23 JOSMFixture.createUnitTestFixture().init(); … … 28 28 */ 29 29 @Test 30 publicvoid testPlayHeadMarker() {30 void testPlayHeadMarker() { 31 31 PlayHeadMarker marker = PlayHeadMarker.create(); 32 32 assertNotNull(marker); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/WebMarkerTest.java
r17125 r17275 25 25 * Unit tests of {@link WebMarker} class. 26 26 */ 27 publicclass WebMarkerTest {27 class WebMarkerTest { 28 28 29 29 /** … … 41 41 */ 42 42 @Test 43 publicvoid testWebMarker(@Injectable final PlatformHook mockPlatformHook,43 void testWebMarker(@Injectable final PlatformHook mockPlatformHook, 44 44 @Mocked final PlatformManager platformManager) throws Exception { 45 45 TestUtils.assumeWorkingJMockit(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/AllMappaintTests.java
r14068 r17275 15 15 AllMapCSSTests.class 16 16 }) 17 publicclass AllMappaintTests {17 class AllMappaintTests { 18 18 19 19 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java
r14048 r17275 2 2 package org.openstreetmap.josm.gui.mappaint; 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.Arrays; 8 8 import java.util.Collections; 9 9 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.osm.Node; 13 13 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy; … … 22 22 * Unit tests of {@link LabelCompositionStrategy}. 23 23 */ 24 publicclass LabelCompositionStrategyTest {24 class LabelCompositionStrategyTest { 25 25 26 26 /** 27 27 * Setup rule 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testCreateStaticLabelCompositionStrategy() {37 void testCreateStaticLabelCompositionStrategy() { 38 38 Node n = new Node(); 39 39 … … 49 49 */ 50 50 @Test 51 publicvoid testCreateTagLookupCompositionStrategy() {51 void testCreateTagLookupCompositionStrategy() { 52 52 Node n = new Node(); 53 53 n.put("my-tag", "my-value"); … … 67 67 */ 68 68 @Test 69 publicvoid testCreateDeriveLabelFromNameTagsCompositionStrategy() {69 void testCreateDeriveLabelFromNameTagsCompositionStrategy() { 70 70 DeriveLabelFromNameTagsCompositionStrategy strat = new DeriveLabelFromNameTagsCompositionStrategy(); 71 71 strat.setNameTags(null); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java
r14048 r17275 2 2 package org.openstreetmap.josm.gui.mappaint; 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 9 import java.awt.Color; 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.data.osm.Node; 14 14 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference; … … 23 23 * Extended text directives tests. 24 24 */ 25 publicclass MapCSSWithExtendedTextDirectivesTest {25 class MapCSSWithExtendedTextDirectivesTest { 26 26 27 27 /** 28 28 * Setup rule 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testCreateAutoTextElement() {38 void testCreateAutoTextElement() { 39 39 MultiCascade mc = new MultiCascade(); 40 40 Cascade c = mc.getOrCreateCascade("default"); … … 53 53 */ 54 54 @Test 55 publicvoid testCreateTextElementComposingTextFromTag() {55 void testCreateTextElementComposingTextFromTag() { 56 56 MultiCascade mc = new MultiCascade(); 57 57 Cascade c = mc.getOrCreateCascade("default"); … … 71 71 */ 72 72 @Test 73 publicvoid testCreateNullStrategy() {73 void testCreateNullStrategy() { 74 74 MultiCascade mc = new MultiCascade(); 75 75 Node osm = new Node(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/RenderingCLIAreaTest.java
r16643 r17275 12 12 import org.hamcrest.CoreMatchers; 13 13 import org.hamcrest.Matcher; 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.junit.runner.RunWith; 17 17 import org.junit.runners.Parameterized; … … 26 26 */ 27 27 @RunWith(Parameterized.class) 28 publicclass RenderingCLIAreaTest {28 class RenderingCLIAreaTest { 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().projection().territories(); … … 153 153 private final Matcher<Bounds> boundsMatcher; 154 154 155 publicRenderingCLIAreaTest(String args, Matcher<Double> scaleMatcher, Matcher<Bounds> boundsMatcher) {155 RenderingCLIAreaTest(String args, Matcher<Double> scaleMatcher, Matcher<Bounds> boundsMatcher) { 156 156 this.args = args.split("\\s+", -1); 157 157 this.scaleMatcher = scaleMatcher; … … 160 160 161 161 @Test 162 publicvoid testDetermineRenderingArea() {162 void testDetermineRenderingArea() { 163 163 RenderingCLI cli = new RenderingCLI(); 164 164 cli.parseArguments(args); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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; … … 10 10 import java.util.Arrays; 11 11 12 import org.junit. Before;13 import org.junit. Ignore;14 import org.junit. Rule;15 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Disabled; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.data.coor.LatLon; 17 17 import org.openstreetmap.josm.data.osm.DataSet; … … 32 32 * Unit tests of {@link ChildOrParentSelector}. 33 33 */ 34 publicclass ChildOrParentSelectorTest {34 class ChildOrParentSelectorTest { 35 35 36 36 private DataSet ds; … … 39 39 * Setup rule 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().projection(); … … 46 46 * Setup test 47 47 */ 48 @Before 48 @BeforeEach 49 49 public void setUp() { 50 50 ds = new DataSet(); … … 78 78 79 79 @Test 80 @ Ignore80 @Disabled 81 81 public void matches_1() { 82 82 String css = "relation >[role=\"my_role\"] node {}"; … … 92 92 93 93 @Test 94 @ Ignore94 @Disabled 95 95 public void matches_2() { 96 96 String css = "relation >[\"my_role\"] node {}"; … … 106 106 107 107 @Test 108 @ Ignore108 @Disabled 109 109 public void matches_3() { 110 110 String css = "relation >[!\"my_role\"] node {}"; … … 120 120 121 121 @Test 122 @ Ignore122 @Disabled 123 123 public void matches_4() { 124 124 String css = "way < relation {}"; … … 189 189 /** 190 190 * Test inside/contains selectors (spatial test) 191 * @throws Exception in case of any error 191 192 */ 192 193 @Test 193 publicvoid testContains() throws Exception {194 void testContains() throws Exception { 194 195 ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get("nodist/data/amenity-in-amenity.osm")), null); 195 196 ChildOrParentSelector css = parse("node[tag(\"amenity\") = parent_tag(\"amenity\")] ∈ *[amenity] {}"); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactoryTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import org.junit.Rule; 5 import org.junit.Test; 4 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension; 6 8 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context; 7 9 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; … … 15 17 * Unit tests of {@link ConditionFactory}. 16 18 */ 17 publicclass ConditionFactoryTest {19 class ConditionFactoryTest { 18 20 19 21 /** 20 22 * Setup rule 21 23 */ 22 @R ule24 @RegisterExtension 23 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 28 /** 27 29 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14368">#14368</a>. 28 * @throws Exception if an error occurs29 30 */ 30 @Test(expected = MapCSSException.class) 31 public void testTicket14368() throws Exception { 32 ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false); 31 @Test 32 void testTicket14368() { 33 assertThrows(MapCSSException.class, 34 () -> ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false)); 33 35 } 34 36 … … 38 40 */ 39 41 @Test 40 publicvoid testUtilityClass() throws ReflectiveOperationException {42 void testUtilityClass() throws ReflectiveOperationException { 41 43 UtilityClassTestUtil.assertUtilityClassWellDefined(PseudoClasses.class); 42 44 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionTest.java
r10837 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;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.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 12 import org.openstreetmap.josm.data.osm.OsmUtils; … … 24 24 * @author Michael Zangl 25 25 */ 26 publicclass ConditionTest {26 class ConditionTest { 27 27 /** 28 28 * We need prefs for nodes. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 40 40 * Set up some useful test data. 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 node0 = OsmUtils.createPrimitive("n"); … … 53 53 */ 54 54 @Test 55 publicvoid testKeyValueEq() {55 void testKeyValueEq() { 56 56 Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.EQ, Context.PRIMITIVE, false); 57 57 assertFalse(op.applies(genEnv(node0))); … … 71 71 */ 72 72 @Test 73 publicvoid testKeyValueEqAsKey() {73 void testKeyValueEqAsKey() { 74 74 Condition op = ConditionFactory.createKeyValueCondition("k1", "k2", Op.EQ, Context.PRIMITIVE, true); 75 75 assertFalse(op.applies(genEnv(node0))); … … 87 87 */ 88 88 @Test 89 publicvoid testKeyValueNeq() {89 void testKeyValueNeq() { 90 90 Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.NEQ, Context.PRIMITIVE, false); 91 91 assertTrue(op.applies(genEnv(node0))); … … 100 100 */ 101 101 @Test 102 publicvoid testKeyValueGreatherEq() {102 void testKeyValueGreatherEq() { 103 103 Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER_OR_EQUAL, Context.PRIMITIVE, false); 104 104 assertFalse(op.applies(genEnv(node0))); … … 113 113 */ 114 114 @Test 115 publicvoid testKeyValueGreather() {115 void testKeyValueGreather() { 116 116 Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER, Context.PRIMITIVE, false); 117 117 assertFalse(op.applies(genEnv(node0))); … … 126 126 */ 127 127 @Test 128 publicvoid testKeyValueLessEq() {128 void testKeyValueLessEq() { 129 129 Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS_OR_EQUAL, Context.PRIMITIVE, false); 130 130 assertFalse(op.applies(genEnv(node0))); … … 139 139 */ 140 140 @Test 141 publicvoid testKeyValueLess() {141 void testKeyValueLess() { 142 142 Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS, Context.PRIMITIVE, false); 143 143 assertFalse(op.applies(genEnv(node0))); … … 152 152 */ 153 153 @Test 154 publicvoid testKeyValueRegex() {154 void testKeyValueRegex() { 155 155 Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.REGEX, Context.PRIMITIVE, false); 156 156 assertFalse(op.applies(genEnv(node0))); … … 165 165 */ 166 166 @Test 167 publicvoid testKeyValueNregex() {167 void testKeyValueNregex() { 168 168 Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.NREGEX, Context.PRIMITIVE, false); 169 169 assertTrue(op.applies(genEnv(node0))); … … 178 178 */ 179 179 @Test 180 publicvoid testKeyValueOneOf() {180 void testKeyValueOneOf() { 181 181 Condition op = ConditionFactory.createKeyValueCondition("one", "a", Op.ONE_OF, Context.PRIMITIVE, false); 182 182 assertFalse(op.applies(genEnv(node0))); … … 191 191 */ 192 192 @Test 193 publicvoid testKeyValueBeginsWith() {193 void testKeyValueBeginsWith() { 194 194 Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.BEGINS_WITH, Context.PRIMITIVE, false); 195 195 assertFalse(op.applies(genEnv(node0))); … … 204 204 */ 205 205 @Test 206 publicvoid testKeyValueEndsWith() {206 void testKeyValueEndsWith() { 207 207 Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.ENDS_WITH, Context.PRIMITIVE, false); 208 208 assertFalse(op.applies(genEnv(node0))); … … 217 217 */ 218 218 @Test 219 publicvoid testKeyValueContains() {219 void testKeyValueContains() { 220 220 Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.CONTAINS, Context.PRIMITIVE, false); 221 221 assertFalse(op.applies(genEnv(node0))); … … 230 230 */ 231 231 @Test 232 publicvoid testRegexpKeyValueRegexpCondition() {232 void testRegexpKeyValueRegexpCondition() { 233 233 Condition op = ConditionFactory.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.REGEX); 234 234 assertFalse(op.applies(genEnv(node0))); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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 … … 12 12 * Unit tests of {@link ExpressionFactory}. 13 13 */ 14 publicclass ExpressionFactoryTest {14 class ExpressionFactoryTest { 15 15 16 16 /** 17 17 * Setup rule 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(Functions.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java
r16590 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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 import static org.openstreetmap.josm.data.osm.OsmPrimitiveType.NODE; 7 7 8 8 import java.util.Collections; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 25 25 * Unit tests of {@link Functions}. 26 26 */ 27 publicclass FunctionsTest {27 class FunctionsTest { 28 28 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 60 60 */ 61 61 @Test 62 publicvoid testOsmUserName() {62 void testOsmUserName() { 63 63 assertEquals("<anonymous>", Functions.osm_user_name(new EnvBuilder(NODE).setUser(User.getAnonymous()).build())); 64 64 } … … 68 68 */ 69 69 @Test 70 publicvoid testOsmUserId() {70 void testOsmUserId() { 71 71 assertEquals(-1, Functions.osm_user_id(new EnvBuilder(NODE).setUser(User.getAnonymous()).build())); 72 72 } … … 76 76 */ 77 77 @Test 78 publicvoid testOsmVersion() {78 void testOsmVersion() { 79 79 assertEquals(0, Functions.osm_version(new EnvBuilder(NODE).build())); 80 80 } … … 84 84 */ 85 85 @Test 86 publicvoid testOsmChangesetId() {86 void testOsmChangesetId() { 87 87 assertEquals(0, Functions.osm_changeset_id(new EnvBuilder(NODE).build())); 88 88 } … … 92 92 */ 93 93 @Test 94 publicvoid testOsmTimestamp() {94 void testOsmTimestamp() { 95 95 assertEquals(0, Functions.osm_timestamp(new EnvBuilder(NODE).build())); 96 96 } … … 100 100 */ 101 101 @Test 102 publicvoid testParseFunctions() {102 void testParseFunctions() { 103 103 assertTrue(Functions.to_boolean("true")); 104 104 assertEquals(1, Functions.to_byte("1")); … … 114 114 */ 115 115 @Test 116 publicvoid testPref() {116 void testPref() { 117 117 String key = "Functions.JOSM_pref"; 118 118 Config.getPref().put(key, null); … … 135 135 */ 136 136 @Test 137 publicvoid testPrefColor() {137 void testPrefColor() { 138 138 String key = "Functions.JOSM_pref"; 139 139 String colorKey = NamedColorProperty.NAMED_COLOR_PREFIX + NamedColorProperty.COLOR_CATEGORY_MAPPAINT + ".unknown." + key; -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java
r14064 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 12 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * Unit tests of {@link KeyCondition}. 27 27 */ 28 publicclass KeyConditionTest {28 class KeyConditionTest { 29 29 30 30 private DataSet ds; … … 33 33 * Setup rule 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().projection(); … … 40 40 * Setup test 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 ds = new DataSet(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java
r14064 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertFalse; 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.StringReader; 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.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 30 30 * Unit tests of {@link KeyValueCondition}. 31 31 */ 32 publicclass KeyValueConditionTest {32 class KeyValueConditionTest { 33 33 34 34 private DataSet ds; … … 37 37 * Setup rule 38 38 */ 39 @R ule39 @RegisterExtension 40 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 41 public JOSMTestRules test = new JOSMTestRules().projection(); … … 44 44 * Setup test 45 45 */ 46 @Before 46 @BeforeEach 47 47 public void setUp() { 48 48 ds = new DataSet(); … … 114 114 115 115 @Test 116 publicvoid testKeyRegexValueRegex() throws Exception {116 void testKeyRegexValueRegex() throws Exception { 117 117 Selector selPos = new MapCSSParser(new StringReader("*[/^source/ =~ /.*,.*/]")).selector(); 118 118 Selector selNeg = new MapCSSParser(new StringReader("*[/^source/ !~ /.*,.*/]")).selector(); … … 129 129 130 130 @Test 131 publicvoid testValueFive() throws Exception {131 void testValueFive() throws Exception { 132 132 // ticket #5985 133 133 Selector sel = new MapCSSParser(new StringReader("*[width=5]")).selector(); … … 137 137 138 138 @Test 139 publicvoid testValueZero() throws Exception {139 void testValueZero() throws Exception { 140 140 // ticket #12267 141 141 Selector sel = new MapCSSParser(new StringReader("*[frequency=0]")).selector(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
r16909 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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.assertNull; 8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 10 import static org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context.PRIMITIVE; 10 11 … … 15 16 16 17 import org.junit.Assert; 17 import org.junit. Rule;18 import org.junit. Test;18 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension; 19 20 import org.openstreetmap.josm.TestUtils; 20 21 import org.openstreetmap.josm.data.coor.LatLon; … … 46 47 * Unit tests of {@link MapCSSParser}. 47 48 */ 48 publicclass MapCSSParserTest {49 class MapCSSParserTest { 49 50 50 51 protected static Environment getEnvironment(String key, String value) { … … 59 60 * Setup rule 60 61 */ 61 @R ule62 @RegisterExtension 62 63 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 63 64 public JOSMTestRules test = new JOSMTestRules().projection(); 64 65 65 66 @Test 66 publicvoid testDeclarations() throws Exception {67 void testDeclarations() throws Exception { 67 68 getParser("{ opacity: 0.5; color: rgb(1.0, 0.0, 0.0); }").declaration(); 68 69 getParser("{ set tag=value; }").declaration(); //set a tag … … 73 74 74 75 @Test 75 publicvoid testClassCondition() throws Exception {76 void testClassCondition() throws Exception { 76 77 List<Condition> conditions = ((Selector.GeneralSelector) getParser("way[name=X].highway:closed").selector()).conds; 77 78 assertTrue(conditions.get(0) instanceof SimpleKeyValueCondition); … … 83 84 84 85 @Test 85 publicvoid testPseudoClassCondition() throws Exception {86 void testPseudoClassCondition() throws Exception { 86 87 Condition c1 = ((Selector.GeneralSelector) getParser("way!:area-style").selector()).conds.get(0); 87 88 Condition c2 = ((Selector.GeneralSelector) getParser("way!:areaStyle").selector()).conds.get(0); … … 93 94 94 95 @Test 95 publicvoid testClassMatching() throws Exception {96 void testClassMatching() throws Exception { 96 97 MapCSSStyleSource css = new MapCSSStyleSource( 97 98 "way[highway=footway] { set .path; color: #FF6644; width: 2; }\n" + … … 117 118 118 119 @Test 119 publicvoid testEqualCondition() throws Exception {120 void testEqualCondition() throws Exception { 120 121 Condition condition = getParser("[surface=paved]").condition(PRIMITIVE); 121 122 assertTrue(condition instanceof SimpleKeyValueCondition); … … 127 128 128 129 @Test 129 publicvoid testNotEqualCondition() throws Exception {130 void testNotEqualCondition() throws Exception { 130 131 KeyValueCondition condition = (KeyValueCondition) getParser("[surface!=paved]").condition(PRIMITIVE); 131 132 assertEquals(Op.NEQ, condition.op); … … 135 136 136 137 @Test 137 publicvoid testRegexCondition() throws Exception {138 void testRegexCondition() throws Exception { 138 139 KeyValueCondition condition = (KeyValueCondition) getParser("[surface=~/paved|unpaved/]").condition(PRIMITIVE); 139 140 assertEquals(Op.REGEX, condition.op); … … 143 144 144 145 @Test 145 publicvoid testRegexConditionParenthesis() throws Exception {146 void testRegexConditionParenthesis() throws Exception { 146 147 KeyValueCondition condition = (KeyValueCondition) getParser("[name =~ /^\\(foo\\)/]").condition(PRIMITIVE); 147 148 assertTrue(condition.applies(getEnvironment("name", "(foo)"))); … … 151 152 152 153 @Test 153 publicvoid testNegatedRegexCondition() throws Exception {154 void testNegatedRegexCondition() throws Exception { 154 155 KeyValueCondition condition = (KeyValueCondition) getParser("[surface!~/paved|unpaved/]").condition(PRIMITIVE); 155 156 assertEquals(Op.NREGEX, condition.op); … … 159 160 160 161 @Test 161 publicvoid testBeginsEndsWithCondition() throws Exception {162 void testBeginsEndsWithCondition() throws Exception { 162 163 KeyValueCondition condition = (KeyValueCondition) getParser("[foo ^= bar]").condition(PRIMITIVE); 163 164 assertEquals(Op.BEGINS_WITH, condition.op); … … 173 174 174 175 @Test 175 publicvoid testOneOfCondition() throws Exception {176 void testOneOfCondition() throws Exception { 176 177 Condition condition = getParser("[vending~=stamps]").condition(PRIMITIVE); 177 178 assertTrue(condition.applies(getEnvironment("vending", "stamps"))); … … 182 183 183 184 @Test 184 publicvoid testStandardKeyCondition() throws Exception {185 void testStandardKeyCondition() throws Exception { 185 186 KeyCondition c1 = (KeyCondition) getParser("[ highway ]").condition(PRIMITIVE); 186 187 assertEquals(KeyMatchType.EQ, c1.matchType); … … 194 195 195 196 @Test 196 publicvoid testYesNoKeyCondition() throws Exception {197 void testYesNoKeyCondition() throws Exception { 197 198 KeyCondition c1 = (KeyCondition) getParser("[oneway?]").condition(PRIMITIVE); 198 199 KeyCondition c2 = (KeyCondition) getParser("[oneway?!]").condition(PRIMITIVE); … … 217 218 218 219 @Test 219 publicvoid testRegexKeyCondition() throws Exception {220 void testRegexKeyCondition() throws Exception { 220 221 KeyCondition c1 = (KeyCondition) getParser("[/.*:(backward|forward)$/]").condition(PRIMITIVE); 221 222 assertEquals(KeyMatchType.REGEX, c1.matchType); … … 227 228 228 229 @Test 229 publicvoid testRegexKeyValueRegexpCondition() throws Exception {230 void testRegexKeyValueRegexpCondition() throws Exception { 230 231 RegexpKeyValueRegexpCondition c1 = (RegexpKeyValueRegexpCondition) getParser("[/^name/=~/Test/]").condition(PRIMITIVE); 231 232 assertEquals("^name", c1.keyPattern.pattern()); … … 236 237 237 238 @Test 238 publicvoid testNRegexKeyConditionSelector() throws Exception {239 void testNRegexKeyConditionSelector() throws Exception { 239 240 Selector s1 = getParser("*[sport][tourism != hotel]").selector(); 240 241 assertTrue(s1.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar")))); … … 247 248 248 249 @Test 249 publicvoid testKeyKeyCondition() throws Exception {250 void testKeyKeyCondition() throws Exception { 250 251 KeyValueCondition c1 = (KeyValueCondition) getParser("[foo = *bar]").condition(PRIMITIVE); 251 252 Way w1 = new Way(); … … 270 271 */ 271 272 @Test 272 publicvoid testTagRegex() throws Exception {273 void testTagRegex() throws Exception { 273 274 DataSet ds = new DataSet(); 274 275 Way way1 = TestUtils.newWay("old_ref=A1 ref=A2", new Node(new LatLon(1, 1)), new Node(new LatLon(2, 2))); … … 300 301 301 302 @Test 302 publicvoid testParentTag() throws Exception {303 void testParentTag() throws Exception { 303 304 Selector c1 = getParser("way[foo] > node[tag(\"foo\")=parent_tag(\"foo\")] {}").child_selector(); 304 305 DataSet ds = new DataSet(); … … 330 331 */ 331 332 @Test 332 publicvoid testTrimList() {333 void testTrimList() { 333 334 List<String> trimmed = Functions.trim_list(Arrays.asList(" A1 ", "A2", " A3", "A4 ", "")); 334 335 assertEquals(4, trimmed.size()); … … 340 341 341 342 @Test 342 publicvoid testTicket8568() throws Exception {343 void testTicket8568() throws Exception { 343 344 MapCSSStyleSource sheet = new MapCSSStyleSource( 344 345 "way { width: 5; }\n" + … … 357 358 358 359 @Test 359 publicvoid testTicket8071() throws Exception {360 void testTicket8071() throws Exception { 360 361 MapCSSStyleSource sheet = new MapCSSStyleSource( 361 362 "*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }"); … … 377 378 378 379 @Test 379 publicvoid testColorNameTicket9191() throws Exception {380 void testColorNameTicket9191() throws Exception { 380 381 Environment e = new Environment(null, new MultiCascade(), Environment.DEFAULT_LAYER, null); 381 382 getParser("{color: testcolour1#88DD22}").declaration().instructions.get(0).execute(e); … … 385 386 386 387 @Test 387 publicvoid testColorNameTicket9191Alpha() throws Exception {388 void testColorNameTicket9191Alpha() throws Exception { 388 389 Environment e = new Environment(null, new MultiCascade(), Environment.DEFAULT_LAYER, null); 389 390 getParser("{color: testcolour2#12345678}").declaration().instructions.get(0).execute(e); … … 393 394 394 395 @Test 395 publicvoid testColorParsing() throws Exception {396 void testColorParsing() throws Exception { 396 397 assertEquals(new Color(0x12, 0x34, 0x56, 0x78), ColorHelper.html2color("#12345678")); 397 398 } 398 399 399 400 @Test 400 publicvoid testChildSelectorGreaterThanSignIsOptional() throws Exception {401 void testChildSelectorGreaterThanSignIsOptional() throws Exception { 401 402 assertEquals( 402 403 getParser("relation[type=route] way[highway]").child_selector().toString(), … … 405 406 406 407 @Test 407 publicvoid testSiblingSelector() throws Exception {408 void testSiblingSelector() throws Exception { 408 409 ChildOrParentSelector s1 = (Selector.ChildOrParentSelector) getParser( 409 410 "*[a?][parent_tag(\"highway\")=\"unclassified\"] + *[b?]").child_selector(); … … 431 432 432 433 @Test 433 publicvoid testParentTags() throws Exception {434 void testParentTags() throws Exception { 434 435 DataSet ds = new DataSet(); 435 436 Node n = new Node(new LatLon(1, 2)); … … 458 459 459 460 @Test 460 publicvoid testSort() throws Exception {461 void testSort() throws Exception { 461 462 assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), Functions.sort("beta", "alpha")); 462 463 Way way1 = TestUtils.newWay("highway=residential name=Alpha alt_name=Beta ref=\"A9;A8\"", new Node(new LatLon(0.001, 0.001)), … … 480 481 481 482 @Test 482 publicvoid testUniqueValues() throws Exception {483 void testUniqueValues() throws Exception { 483 484 assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), 484 485 Functions.uniq("alpha", "alpha", "alpha", "beta")); … … 488 489 489 490 @Test 490 publicvoid testCountRoles() throws Exception {491 void testCountRoles() throws Exception { 491 492 DataSet ds = new DataSet(); 492 493 Way way1 = TestUtils.newWay("highway=residential name=1", … … 538 539 539 540 @Test 540 publicvoid testSiblingSelectorInterpolation() throws Exception {541 void testSiblingSelectorInterpolation() throws Exception { 541 542 ChildOrParentSelector s1 = (Selector.ChildOrParentSelector) getParser( 542 543 "*[tag(\"addr:housenumber\") > child_tag(\"addr:housenumber\")][regexp_test(\"even|odd\", parent_tag(\"addr:interpolation\"))]" + … … 568 569 569 570 @Test 570 publicvoid testInvalidBaseSelector() throws Exception {571 void testInvalidBaseSelector() throws Exception { 571 572 MapCSSStyleSource css = new MapCSSStyleSource("invalid_base[key=value] {}"); 572 573 css.loadStyleSource(); … … 576 577 577 578 @Test 578 publicvoid testMinMaxFunctions() throws Exception {579 void testMinMaxFunctions() throws Exception { 579 580 MapCSSStyleSource sheet = new MapCSSStyleSource("* {" + 580 581 "min_value: min(tag(x), tag(y), tag(z)); " + … … 600 601 */ 601 602 @Test 602 publicvoid testTicket12549() throws ParseException {603 void testTicket12549() throws ParseException { 603 604 Condition condition = getParser("[name =~ /^(?i)(?u)fóo$/]").condition(PRIMITIVE); 604 605 assertTrue(condition.applies(getEnvironment("name", "fóo"))); … … 615 616 */ 616 617 @Test 617 publicvoid testTicket17053() {618 void testTicket17053() { 618 619 MapCSSStyleSource sheet = new MapCSSStyleSource( 619 620 "way {\n" + … … 625 626 "}"); 626 627 sheet.loadStyleSource(); 627 assertTrue(sheet.getErrors(). toString(), sheet.getErrors().isEmpty());628 assertTrue(sheet.getErrors().isEmpty(), sheet.getErrors()::toString); 628 629 } 629 630 … … 633 634 */ 634 635 @Test 635 publicvoid testZoom() throws ParseException {636 void testZoom() throws ParseException { 636 637 assertNotNull(getParser("|z12").zoom()); 637 638 assertNotNull(getParser("|z12-").zoom()); … … 642 643 /** 643 644 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/18759">Bug #18759</a>. 644 * @throws ParseException if a parsing error occurs 645 */ 646 @Test(expected = IllegalArgumentException.class) 647 public void testZoomIAE() throws ParseException { 648 assertNotNull(getParser("|z16-15").zoom()); 645 */ 646 @Test 647 void testZoomIAE() { 648 assertThrows(IllegalArgumentException.class, () -> getParser("|z16-15").zoom()); 649 649 } 650 650 … … 653 653 */ 654 654 @Test 655 publicvoid testTicket16183() {655 void testTicket16183() { 656 656 MapCSSStyleSource sheet = new MapCSSStyleSource( 657 657 "area:closed:areaStyle ⧉ area:closed:areaStyle {throwOther: \"xxx\";}"); … … 666 666 */ 667 667 @Test 668 publicvoid testTicket19685() {668 void testTicket19685() { 669 669 MapCSSStyleSource sheet = new MapCSSStyleSource("node:connection:foobar {}"); 670 670 sheet.loadStyleSource(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTestIT.java
r14746 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import org.junit. Ignore;5 import org.junit. Rule;6 import org.junit. Test;4 import org.junit.jupiter.api.Disabled; 5 import org.junit.jupiter.api.Test; 6 import org.junit.jupiter.api.extension.RegisterExtension; 7 7 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Integration tests of {@link MapCSSParser}. 14 14 */ 15 publicclass MapCSSParserTestIT {15 class MapCSSParserTestIT { 16 16 17 17 /** 18 18 * Setup rule 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().https().projection(); … … 26 26 */ 27 27 @Test 28 @ Ignore("parsing fails")29 publicvoid testKothicStylesheets() {28 @Disabled("parsing fails") 29 void testKothicStylesheets() { 30 30 new MapCSSStyleSource("https://raw.githubusercontent.com/kothic/kothic/master/src/styles/default.mapcss").loadStyleSource(); 31 31 new MapCSSStyleSource("https://raw.githubusercontent.com/kothic/kothic/master/src/styles/mapink.mapcss").loadStyleSource(); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java
r14064 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@code ParsingLinkSelector}. 14 14 */ 15 publicclass ParsingLinkSelectorTest {15 class ParsingLinkSelectorTest { 16 16 17 17 /** 18 18 * Setup rule 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().projection(); -
trunk/test/unit/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBoxTest.java
r10989 r17275 2 2 package org.openstreetmap.josm.gui.oauth; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import javax.swing.ListCellRenderer; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests of {@link AuthorizationProcedureComboBox} class. 16 16 */ 17 publicclass AuthorizationProcedureComboBoxTest {17 class AuthorizationProcedureComboBoxTest { 18 18 19 19 /** 20 20 * Setup tests 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testAuthorizationProcedureComboBox() {30 void testAuthorizationProcedureComboBox() { 31 31 ListCellRenderer<? super AuthorizationProcedure> r = new AuthorizationProcedureComboBox().getRenderer(); 32 32 for (AuthorizationProcedure procedure : AuthorizationProcedure.values()) { -
trunk/test/unit/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUITest.java
r12634 r17275 2 2 package org.openstreetmap.josm.gui.oauth; 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.gui.MainApplication; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link FullyAutomaticAuthorizationUI} class. 15 15 */ 16 publicclass FullyAutomaticAuthorizationUITest {16 class FullyAutomaticAuthorizationUITest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testFullyAutomaticAuthorizationUI() {29 void testFullyAutomaticAuthorizationUI() { 30 30 assertNotNull(new FullyAutomaticAuthorizationUI("", MainApplication.worker)); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanelTest.java
r11202 r17275 2 2 package org.openstreetmap.josm.gui.oauth; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link FullyAutomaticPropertiesPanel} class. 14 14 */ 15 publicclass FullyAutomaticPropertiesPanelTest {15 class FullyAutomaticPropertiesPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testFullyAutomaticPropertiesPanel() {28 void testFullyAutomaticPropertiesPanel() { 29 29 assertTrue(new FullyAutomaticPropertiesPanel().getComponentCount() > 0); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUITest.java
r12634 r17275 2 2 package org.openstreetmap.josm.gui.oauth; 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.gui.MainApplication; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link ManualAuthorizationUI} class. 15 15 */ 16 publicclass ManualAuthorizationUITest {16 class ManualAuthorizationUITest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testManualAuthorizationUI() {29 void testManualAuthorizationUI() { 30 30 assertNotNull(new ManualAuthorizationUI("", MainApplication.worker)); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUITest.java
r12634 r17275 2 2 package org.openstreetmap.josm.gui.oauth; 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.gui.MainApplication; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link SemiAutomaticAuthorizationUI} class. 15 15 */ 16 publicclass SemiAutomaticAuthorizationUITest {16 class SemiAutomaticAuthorizationUITest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testSemiAutomaticAuthorizationUI() {29 void testSemiAutomaticAuthorizationUI() { 30 30 assertNotNull(new SemiAutomaticAuthorizationUI("", MainApplication.worker)); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/PreferencesTestUtils.java
r16979 r17275 2 2 package org.openstreetmap.josm.gui.preferences; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 /** -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/ToolbarPreferencesTest.java
r10758 r17275 12 12 13 13 import org.junit.Assert; 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.actions.ActionParameter; 16 16 import org.openstreetmap.josm.actions.ActionParameter.StringActionParameter; … … 22 22 * Unit tests of {@link ToolbarPreferences} class. 23 23 */ 24 publicclass ToolbarPreferencesTest {24 class ToolbarPreferencesTest { 25 25 26 26 private static class TestAction extends AbstractAction implements ParameterizedAction { … … 58 58 59 59 @Test 60 publicvoid testCase1() {60 void testCase1() { 61 61 Map<String, Action> actions = new HashMap<>(); 62 62 actions.put("action", new TestAction()); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.advanced; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link AdvancedPreference} class. 13 13 */ 14 publicclass AdvancedPreferenceTest {14 class AdvancedPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testAdvancedPreference() {28 void testAdvancedPreference() { 29 29 assertNotNull(new AdvancedPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new AdvancedPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
r16159 r17275 6 6 import javax.swing.JOptionPane; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.TestUtils; 11 11 import org.openstreetmap.josm.data.Preferences; … … 18 18 * Unit tests of {@link ExportProfileAction} class. 19 19 */ 20 publicclass ExportProfileActionTest {20 class ExportProfileActionTest { 21 21 /** 22 22 * Setup tests 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT(); … … 30 30 */ 31 31 @Test 32 publicvoid testAction() {32 void testAction() { 33 33 TestUtils.assumeWorkingJMockit(); 34 34 new JOptionPaneSimpleMocker(Collections.singletonMap( -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.advanced; 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.util.Arrays; 9 9 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 import org.openstreetmap.josm.gui.preferences.advanced.ListEditor.ListSettingTableModel; … … 16 16 * Unit tests of {@link ListEditor} class. 17 17 */ 18 publicclass ListEditorTest {18 class ListEditorTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @Before Class23 @BeforeAll 24 24 public static void setUpBeforeClass() { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 30 30 */ 31 31 @Test 32 publicvoid testListSettingTableModel() {32 void testListSettingTableModel() { 33 33 ListSettingTableModel model = new ListSettingTableModel(null); 34 34 assertNotNull(model.getData()); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.gui.preferences.advanced; 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 import org.junit. BeforeClass;9 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.TestUtils; … … 17 17 * Unit tests of {@link PrefEntry} class. 18 18 */ 19 publicclass PrefEntryTest {19 class PrefEntryTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUpBeforeClass() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 31 31 */ 32 32 @Test 33 publicvoid testPrefEntry() {33 void testPrefEntry() { 34 34 String key = "key"; 35 35 StringSetting val = new StringSetting("value"); … … 55 55 */ 56 56 @Test 57 publicvoid testEqualsContract() {57 void testEqualsContract() { 58 58 TestUtils.assumeWorkingEqualsVerifier(); 59 59 EqualsVerifier.forClass(PrefEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
r16160 r17275 2 2 package org.openstreetmap.josm.gui.preferences.advanced; 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.Arrays; … … 11 11 import javax.swing.JOptionPane; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.gui.ExtendedDialog; … … 26 26 * Unit tests of {@link PreferencesTable} class. 27 27 */ 28 publicclass PreferencesTableTest {28 class PreferencesTableTest { 29 29 /** 30 30 * Setup tests 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT(); … … 48 48 */ 49 49 @Test 50 publicvoid testPreferencesTable() {50 void testPreferencesTable() { 51 51 TestUtils.assumeWorkingJMockit(); 52 52 final JOptionPaneSimpleMocker mocker = new JOptionPaneSimpleMocker(); … … 75 75 */ 76 76 @Test 77 publicvoid testAllSettingsTableModel() {77 void testAllSettingsTableModel() { 78 78 AllSettingsTableModel model = (AllSettingsTableModel) newTable().getModel(); 79 79 assertEquals(1, model.getRowCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java
r12849 r17275 2 2 package org.openstreetmap.josm.gui.preferences.audio; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 13 13 * Unit tests of {@link AudioPreference} class. 14 14 */ 15 publicclass AudioPreferenceTest {15 class AudioPreferenceTest { 16 16 17 17 /** 18 18 * Setup test. 19 19 */ 20 @Before Class20 @BeforeAll 21 21 public static void setUpBeforeClass() { 22 22 JOSMFixture.createUnitTestFixture().init(); … … 27 27 */ 28 28 @Test 29 publicvoid testAudioPreference() {29 void testAudioPreference() { 30 30 assertNotNull(new AudioPreference.Factory().createPreferenceSetting()); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testAddGui() {37 void testAddGui() { 38 38 Config.getPref().putBoolean("audio.menuinvisible", true); 39 39 PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link ColorPreference} class. 13 13 */ 14 publicclass ColorPreferenceTest {14 class ColorPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testColorPreference() {28 void testColorPreference() { 29 29 assertNotNull(new ColorPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ColorPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link DisplayPreference} class. 13 13 */ 14 publicclass DisplayPreferenceTest {14 class DisplayPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testDisplayPreference() {28 void testDisplayPreference() { 29 29 assertNotNull(new DisplayPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new DisplayPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link DrawingPreference} class. 13 13 */ 14 publicclass DrawingPreferenceTest {14 class DrawingPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testDrawingPreference() {28 void testDrawingPreference() { 29 29 assertNotNull(new DrawingPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new DrawingPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link GPXPreference} class. 13 13 */ 14 publicclass GPXPreferenceTest {14 class GPXPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testGPXPreference() {28 void testGPXPreference() { 29 29 assertNotNull(new GPXPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new GPXPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link LafPreference} class. 13 13 */ 14 publicclass LafPreferenceTest {14 class LafPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testLafPreference() {28 void testLafPreference() { 29 29 assertNotNull(new LafPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new LafPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link LanguagePreference} class. 13 13 */ 14 publicclass LanguagePreferenceTest {14 class LanguagePreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testLanguagePreference() {28 void testLanguagePreference() { 29 29 assertNotNull(new LanguagePreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new LanguagePreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanelTest.java
r10977 r17275 2 2 package org.openstreetmap.josm.gui.preferences.imagery; 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 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.JOSMTestRules; 10 10 … … 14 14 * Unit tests of {@link AddTMSLayerPanel} class. 15 15 */ 16 publicclass AddTMSLayerPanelTest {16 class AddTMSLayerPanelTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testAddTMSLayerPanel() {29 void testAddTMSLayerPanel() { 30 30 AddTMSLayerPanel panel = new AddTMSLayerPanel(); 31 31 assertEquals("", panel.getImageryInfo().getUrl()); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanelTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.preferences.imagery; 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 of {@link AddWMSLayerPanel} class. 14 14 */ 15 publicclass AddWMSLayerPanelTest {15 class AddWMSLayerPanelTest { 16 16 17 17 /** 18 18 * Setup tests 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testAddWMSLayerPanel() {28 void testAddWMSLayerPanel() { 29 29 AddWMSLayerPanel panel = new AddWMSLayerPanel(); 30 30 assertFalse(panel.isImageryValid()); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanelTest.java
r10977 r17275 2 2 package org.openstreetmap.josm.gui.preferences.imagery; 3 3 4 import static org.junit.Assert.assertFalse; 4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 import org.junit. Rule;7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 8 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 10 … … 13 14 * Unit tests of {@link AddWMTSLayerPanel} class. 14 15 */ 15 publicclass AddWMTSLayerPanelTest {16 class AddWMTSLayerPanelTest { 16 17 17 18 /** 18 19 * Setup tests 19 20 */ 20 @R ule21 @RegisterExtension 21 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 27 */ 27 28 @Test 28 publicvoid testAddWMTSLayerPanel() {29 void testAddWMTSLayerPanel() { 29 30 AddWMTSLayerPanel panel = new AddWMTSLayerPanel(); 30 31 assertFalse(panel.isImageryValid()); … … 34 35 * Unit test of {@link AddWMTSLayerPanel#getImageryInfo}. 35 36 */ 36 @Test (expected = IllegalArgumentException.class)37 publicvoid testGetImageryInfo() {38 new AddWMTSLayerPanel().getImageryInfo();37 @Test 38 void testGetImageryInfo() { 39 assertThrows(IllegalArgumentException.class, () -> new AddWMTSLayerPanel().getImageryInfo()); 39 40 } 40 41 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.preferences.imagery; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.File; 7 7 import java.util.Arrays; 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.gui.preferences.PreferencesTestUtils; … … 19 19 * Unit tests of {@link ImageryPreference} class. 20 20 */ 21 publicclass ImageryPreferenceTest {21 class ImageryPreferenceTest { 22 22 23 23 /** 24 24 * Setup tests 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().main(); … … 32 32 */ 33 33 @Test 34 publicvoid testImageryPreference() {34 void testImageryPreference() { 35 35 assertNotNull(new ImageryPreference.Factory().createPreferenceSetting()); 36 36 } … … 40 40 */ 41 41 @Test 42 publicvoid testAddGui() {42 void testAddGui() { 43 43 String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString(); 44 44 Config.getPref().putList("imagery.layers.sites", Arrays.asList(fileUrl)); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r16824 r17275 396 396 @ParameterizedTest(name = "{0}") 397 397 @MethodSource("data") 398 publicvoid testImageryEntryValidity(String id, ImageryInfo info) {398 void testImageryEntryValidity(String id, ImageryInfo info) { 399 399 checkEntry(info); 400 400 assertTrue(errors.isEmpty(), format(errors)); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link BackupPreference} class. 13 13 */ 14 publicclass BackupPreferenceTest {14 class BackupPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testBackupPreference() {28 void testBackupPreference() { 29 29 assertNotNull(new BackupPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new BackupPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link MapPaintPreference} class. 13 13 */ 14 publicclass MapPaintPreferenceTest {14 class MapPaintPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testMapPaintPreference() {28 void testMapPaintPreference() { 29 29 assertNotNull(new MapPaintPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new MapPaintPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTestIT.java
r15101 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit.Assert.assertTrue;5 4 import static org.junit.Assume.assumeFalse; 6 5 import static org.junit.Assume.assumeTrue; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.IOException; … … 10 10 import java.util.List; 11 11 12 import org.junit.BeforeClass;13 12 import org.junit.ClassRule; 14 import org.junit.Test; 13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 15 15 import org.junit.runner.RunWith; 16 16 import org.junit.runners.Parameterized.Parameters; … … 35 35 */ 36 36 @RunWith(ParallelParameterized.class) 37 publicclass MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {37 class MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase { 38 38 39 39 /** … … 48 48 * @throws IOException in case of I/O error 49 49 */ 50 @Before Class50 @BeforeAll 51 51 public static void beforeClass() throws IOException { 52 52 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(MapPaintPreferenceTestIT.class)); … … 70 70 * @param source source entry to test 71 71 */ 72 publicMapPaintPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {72 MapPaintPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) { 73 73 super(source); 74 74 } … … 79 79 */ 80 80 @Test 81 publicvoid testStyleValidity() throws Exception {81 void testStyleValidity() throws Exception { 82 82 assumeFalse(isIgnoredSubstring(source.url)); 83 83 StyleSource style = MapPaintStyles.addStyle(source); … … 108 108 warnings.removeAll(ignoredErrors); 109 109 110 assertTrue(errors. toString() + '\n' + warnings.toString(), errors.isEmpty() && warnings.isEmpty());110 assertTrue(errors.isEmpty() && warnings.isEmpty(), errors.toString() + '\n' + warnings.toString()); 111 111 assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty()); 112 112 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link MapPreference} class. 13 13 */ 14 publicclass MapPreferenceTest {14 class MapPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testMapPreference() {28 void testMapPreference() { 29 29 assertNotNull(new MapPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new MapPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link TaggingPresetPreference} class. 13 13 */ 14 publicclass TaggingPresetPreferenceTest {14 class TaggingPresetPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testTaggingPresetPreference() {28 void testTaggingPresetPreference() { 29 29 assertNotNull(new TaggingPresetPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new TaggingPresetPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java
r16768 r17275 2 2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 import static org.junit.Assert.assertFalse;5 import static org.junit.Assert.assertTrue;6 4 import static org.junit.Assume.assumeFalse; 7 5 import static org.junit.Assume.assumeTrue; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.io.IOException; … … 15 15 import java.util.Set; 16 16 17 import org.junit.BeforeClass;18 17 import org.junit.ClassRule; 19 import org.junit.Test; 18 import org.junit.jupiter.api.BeforeAll; 19 import org.junit.jupiter.api.Test; 20 20 import org.junit.runner.RunWith; 21 21 import org.junit.runners.Parameterized; … … 41 41 */ 42 42 @RunWith(Parameterized.class) 43 publicclass TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {43 class TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase { 44 44 45 45 /** … … 54 54 * @throws IOException in case of I/O error 55 55 */ 56 @Before Class56 @BeforeAll 57 57 public static void beforeClass() throws IOException { 58 58 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(TaggingPresetPreferenceTestIT.class)); … … 81 81 * @param source source entry to test 82 82 */ 83 publicTaggingPresetPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {83 TaggingPresetPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) { 84 84 super(source); 85 85 } … … 90 90 */ 91 91 @Test 92 publicvoid testPresetsValidity() throws Exception {92 void testPresetsValidity() throws Exception { 93 93 assumeFalse(isIgnoredSubstring(source.url)); 94 94 Set<String> errors = new HashSet<>(); … … 106 106 handleException(e, errors); 107 107 } 108 assertTrue(errors. toString(), errors.isEmpty());108 assertTrue(errors.isEmpty(), errors::toString); 109 109 assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty()); 110 110 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
r16160 r17275 2 2 package org.openstreetmap.josm.gui.preferences.plugin; 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.File; … … 10 10 import java.util.Collections; 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.TestUtils; 15 15 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 18 18 import org.openstreetmap.josm.plugins.PluginException; 19 19 import org.openstreetmap.josm.plugins.PluginInformation; 20 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 21 import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker; 21 import org.openstreetmap.josm.testutils.JOSMTestRules;22 22 23 23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 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().preferences().assertionsInEDT(); … … 38 38 */ 39 39 @Test 40 publicvoid testPluginPreference() {40 void testPluginPreference() { 41 41 assertNotNull(new PluginPreference.Factory().createPreferenceSetting()); 42 42 } … … 57 57 */ 58 58 @Test 59 publicvoid testBuildDownloadSummary() throws Exception {59 void testBuildDownloadSummary() throws Exception { 60 60 final PluginInformation dummy = getDummyPluginInformation(); 61 61 assertEquals("", PluginPreference.buildDownloadSummary( … … 89 89 */ 90 90 @Test 91 publicvoid testNotifyDownloadResults() {91 void testNotifyDownloadResults() { 92 92 final HelpAwareOptionPaneMocker mocker = new HelpAwareOptionPaneMocker(); 93 93 mocker.getMockResultMap().put("<html></html>", "OK"); // (buildDownloadSummary() output was empty) … … 103 103 */ 104 104 @Test 105 publicvoid testAddGui() {105 void testAddGui() { 106 106 PreferencesTestUtils.doTestPreferenceSettingAddGui(new PluginPreference.Factory(), null); 107 107 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.projection; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link ProjectionPreference} class. 13 13 */ 14 publicclass ProjectionPreferenceTest {14 class ProjectionPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testProjectionPreference() {28 void testProjectionPreference() { 29 29 assertNotNull(new ProjectionPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ProjectionPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.remotecontrol; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link RemoteControlPreference} class. 13 13 */ 14 publicclass RemoteControlPreferenceTest {14 class RemoteControlPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testRemoteControlPreference() {28 void testRemoteControlPreference() { 29 29 assertNotNull(new RemoteControlPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new RemoteControlPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ProxyPreferenceTest.java
r17179 r17275 2 2 package org.openstreetmap.josm.gui.preferences.server; 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.gui.preferences.PreferencesTestUtils; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link ProxyPreference} class. 15 15 */ 16 publicclass ProxyPreferenceTest {16 class ProxyPreferenceTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testProxyPreference() {29 void testProxyPreference() { 30 30 assertNotNull(new ProxyPreference.Factory().createPreferenceSetting()); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testAddGui() {37 void testAddGui() { 38 38 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ProxyPreference.Factory(), null); 39 39 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreferenceTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.gui.preferences.server; 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.gui.preferences.PreferencesTestUtils; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link ServerAccessPreference} class. 15 15 */ 16 publicclass ServerAccessPreferenceTest {16 class ServerAccessPreferenceTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testServerAccessPreference() {29 void testServerAccessPreference() { 30 30 assertNotNull(new ServerAccessPreference.Factory().createPreferenceSetting()); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testAddGui() {37 void testAddGui() { 38 38 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ServerAccessPreference.Factory(), null); 39 39 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.shortcut; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link ShortcutPreference} class. 13 13 */ 14 publicclass ShortcutPreferenceTest {14 class ShortcutPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testShortcutPreference() {28 void testShortcutPreference() { 29 29 assertNotNull(new ShortcutPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ShortcutPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.validator; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link ValidatorPreference} class. 13 13 */ 14 publicclass ValidatorPreferenceTest {14 class ValidatorPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testValidatorPreference() {28 void testValidatorPreference() { 29 29 assertNotNull(new ValidatorPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ValidatorPreference.Factory(), null); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreferenceTestIT.java
r14719 r17275 2 2 package org.openstreetmap.josm.gui.preferences.validator; 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.io.IOException; … … 9 9 import java.util.Collection; 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.data.preferences.sources.ExtendedSourceEntry; 14 14 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker; … … 21 21 * Integration tests of {@link ValidatorTagCheckerRulesPreference} class. 22 22 */ 23 publicclass ValidatorTagCheckerRulesPreferenceTestIT {23 class ValidatorTagCheckerRulesPreferenceTestIT { 24 24 25 25 /** 26 26 * Setup rule 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().https().timeout(20_000); … … 35 35 */ 36 36 @Test 37 publicvoid testValidityOfAvailableRules() throws Exception {37 void testValidityOfAvailableRules() throws Exception { 38 38 Collection<ExtendedSourceEntry> sources = new ValidatorTagCheckerRulesPreference.TagCheckerRulesSourceEditor() 39 39 .loadAndGetAvailableSources(); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java
r10378 r17275 2 2 package org.openstreetmap.josm.gui.preferences.validator; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; … … 12 12 * Unit tests of {@link ValidatorTestsPreference} class. 13 13 */ 14 publicclass ValidatorTestsPreferenceTest {14 class ValidatorTestsPreferenceTest { 15 15 16 16 /** 17 17 * Setup test. 18 18 */ 19 @Before Class19 @BeforeAll 20 20 public static void setUpBeforeClass() { 21 21 JOSMFixture.createUnitTestFixture().init(); … … 26 26 */ 27 27 @Test 28 publicvoid testValidatorTestsPreference() {28 void testValidatorTestsPreference() { 29 29 assertNotNull(new ValidatorTestsPreference.Factory().createPreferenceSetting()); 30 30 } … … 34 34 */ 35 35 @Test 36 publicvoid testAddGui() {36 void testAddGui() { 37 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ValidatorTestsPreference.Factory(), ValidatorPreference.class); 38 38 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/TagEditorModelTest.java
r9816 r17275 2 2 package org.openstreetmap.josm.gui.tagging; 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 8 8 /** 9 9 * Unit tests of {@link TagEditorModel} class. 10 10 */ 11 publicclass TagEditorModelTest {11 class TagEditorModelTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testTagEditorModel() {17 void testTagEditorModel() { 18 18 TagEditorModel tem = new TagEditorModel(); 19 19 tem.add(null, null); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/TagModelTest.java
r9816 r17275 2 2 package org.openstreetmap.josm.gui.tagging; 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. Test;7 import org.junit.jupiter.api.Test; 8 8 9 9 /** 10 10 * Unit tests of {@link TagModel} class. 11 11 */ 12 publicclass TagModelTest {12 class TagModelTest { 13 13 14 14 /** … … 16 16 */ 17 17 @Test 18 publicvoid testTagModelSingleValue() {18 void testTagModelSingleValue() { 19 19 TagModel tm = new TagModel(); 20 20 assertEquals("", tm.getName()); … … 43 43 */ 44 44 @Test 45 publicvoid testTagModelMultipleValues() {45 void testTagModelMultipleValues() { 46 46 TagModel tm = new TagModel("key2", "val2"); 47 47 assertEquals("key2", tm.getName()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java
r14503 r17275 2 2 package org.openstreetmap.josm.gui.tagging.ac; 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; 7 7 import org.openstreetmap.josm.data.osm.DataSet; … … 17 17 * Unit tests of {@link AutoCompletionManager} class. 18 18 */ 19 publicclass AutoCompletionManagerTest {19 class AutoCompletionManagerTest { 20 20 21 21 /** 22 22 * Setup rule 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 testTicket17064() {32 void testTicket17064() { 33 33 DataSet ds = new DataSet(); 34 34 OsmDataLayer layer = new OsmDataLayer(ds, "testTicket17064", null); … … 42 42 */ 43 43 @Test 44 publicvoid testEqualsContract() {44 void testEqualsContract() { 45 45 TestUtils.assumeWorkingEqualsVerifier(); 46 46 EqualsVerifier.forClass(UserInputTag.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java
r10638 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets; 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.io.IOException; … … 12 12 import java.util.stream.Collectors; 13 13 14 import org.junit. BeforeClass;15 import org.junit. Test;14 import org.junit.jupiter.api.BeforeAll; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.JOSMFixture; 17 17 import org.openstreetmap.josm.data.osm.Node; … … 26 26 * Unit tests of {@link PresetClassifications} class. 27 27 */ 28 publicclass PresetClassificationsTest {28 class PresetClassificationsTest { 29 29 30 30 static final PresetClassifications classifications = new PresetClassifications(); … … 35 35 * @throws IOException if any I/O error occurs 36 36 */ 37 @Before Class37 @BeforeAll 38 38 public static void setUp() throws IOException, SAXException { 39 39 JOSMFixture.createUnitTestFixture().init(); … … 55 55 */ 56 56 @Test 57 publicvoid testBuilding() {57 void testBuilding() { 58 58 final Way w = new Way(); 59 59 final Node n1 = new Node(); … … 61 61 w.addNode(new Node()); 62 62 w.addNode(new Node()); 63 assertFalse( "unclosed way should not match building preset", getMatchingPresetNames("building", w).contains("Building"));63 assertFalse(getMatchingPresetNames("building", w).contains("Building"), "unclosed way should not match building preset"); 64 64 w.addNode(n1); 65 assertTrue( "closed way should match building preset", getMatchingPresetNames("building", w).contains("Building"));65 assertTrue(getMatchingPresetNames("building", w).contains("Building"), "closed way should match building preset"); 66 66 } 67 67 … … 70 70 */ 71 71 @Test 72 publicvoid testRelationsForTram() {72 void testRelationsForTram() { 73 73 final OsmPrimitive tram = OsmUtils.createPrimitive("way railway=tram"); 74 assertTrue("railway=tram should match 'Railway Route' for relation creation", getMatchingPresetNames("route", tram) 75 .contains("Railway Route")); 76 assertTrue("railway=tram should match 'Public Transport Route (Rail)' for relation creation", getMatchingPresetNames("route", tram) 77 .contains("Public Transport Route (Rail)")); 78 assertFalse("railway=tram should not match 'Bus'", getMatchingPresetNames("route", tram).toString().contains("Bus")); 74 assertTrue(getMatchingPresetNames("route", tram).contains("Railway Route"), 75 "railway=tram should match 'Railway Route' for relation creation"); 76 assertTrue(getMatchingPresetNames("route", tram).contains("Public Transport Route (Rail)"), 77 "railway=tram should match 'Public Transport Route (Rail)' for relation creation"); 78 assertFalse(getMatchingPresetNames("route", tram).toString().contains("Bus"), 79 "railway=tram should not match 'Bus'"); 79 80 } 80 81 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
r16618 r17275 4 4 import static org.CustomMatchers.hasSize; 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 import static org.junit. Assert.assertEquals;7 import static org.junit. Assert.assertTrue;8 import static org.junit. Assert.fail;6 import static org.junit.jupiter.api.Assertions.assertEquals; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.fail; 9 9 10 10 import java.io.IOException; … … 14 14 15 15 import org.junit.Assert; 16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.gui.tagging.presets.items.Check; … … 27 27 * Unit tests of {@link TaggingPresetReader} class. 28 28 */ 29 publicclass TaggingPresetReaderTest {29 class TaggingPresetReaderTest { 30 30 31 31 /** 32 32 * Setup rule 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules(); … … 42 42 */ 43 43 @Test 44 publicvoid testTicket8954() throws SAXException, IOException {44 void testTicket8954() throws SAXException, IOException { 45 45 String presetfile = TestUtils.getRegressionDataFile(8954, "preset.xml"); 46 46 final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, false); … … 58 58 */ 59 59 @Test 60 publicvoid testNestedChunks() throws SAXException, IOException {60 void testNestedChunks() throws SAXException, IOException { 61 61 final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_chunk.xml", true); 62 62 assertThat(presets, hasSize(1)); … … 70 70 * Test external entity resolving. 71 71 * See #19286 72 * @throws IOException in case of I/O error 72 73 */ 73 74 @Test 74 publicvoid testExternalEntityResolving() throws IOException {75 void testExternalEntityResolving() throws IOException { 75 76 try { 76 77 TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_external_entity.xml", true); … … 89 90 */ 90 91 @Test 91 publicvoid testReadDefaulPresets() throws SAXException, IOException {92 void testReadDefaulPresets() throws SAXException, IOException { 92 93 String presetfile = "resource://data/defaultpresets.xml"; 93 94 final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelectorTest.java
r13836 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets; 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.gui.tagging.presets.TaggingPresetSelector.PresetClassification; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 15 15 * Unit tests of {@link TaggingPresetSelector} class. 16 16 */ 17 publicclass TaggingPresetSelectorTest {17 class TaggingPresetSelectorTest { 18 18 19 19 /** 20 20 * Setup rule 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules(); … … 28 28 */ 29 29 @Test 30 publicvoid testIsMatching() {30 void testIsMatching() { 31 31 TaggingPreset preset = new TaggingPreset(); 32 32 preset.name = "estação de bombeiros"; // fire_station in brazilian portuguese -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java
r16768 r17275 8 8 import java.util.concurrent.TimeoutException; 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.testutils.JOSMTestRules; 13 13 import org.openstreetmap.josm.tools.Logging; … … 24 24 * Setup rule 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testUtilityClass() throws ReflectiveOperationException {35 void testUtilityClass() throws ReflectiveOperationException { 36 36 UtilityClassTestUtil.assertUtilityClassWellDefined(TaggingPresets.class); 37 37 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java
r16042 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 18 * Unit tests of {@link CheckGroup} class. 19 19 */ 20 publicclass CheckGroupTest {20 class CheckGroupTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @Before Class25 @BeforeAll 26 26 public static void setUp() { 27 27 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 CheckGroup cg = new CheckGroup(); 36 36 JPanel p = new JPanel(); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java
r16282 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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; … … 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.data.osm.OsmPrimitive; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 19 19 * Unit tests of {@link Check} class. 20 20 */ 21 publicclass CheckTest {21 class CheckTest { 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(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
r16693 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.awt.Color; … … 11 11 import javax.swing.JPanel; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 16 import org.openstreetmap.josm.data.osm.OsmUtils; … … 22 22 * Unit tests of {@link Combo} class. 23 23 */ 24 publicclass ComboTest {24 class ComboTest { 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().i18n("de"); … … 35 35 */ 36 36 @Test 37 publicvoid testAddToPanel() {37 void testAddToPanel() { 38 38 JPanel p = new JPanel(); 39 39 assertEquals(0, p.getComponentCount()); … … 46 46 */ 47 47 @Test 48 publicvoid testUseLastAsDefault() {48 void testUseLastAsDefault() { 49 49 Combo combo = new Combo(); 50 50 combo.key = "addr:country"; … … 83 83 84 84 @Test 85 publicvoid testColor() {85 void testColor() { 86 86 Combo combo = new Combo(); 87 87 combo.key = "colour"; -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 18 * Unit tests of {@link ItemSeparator} class. 19 19 */ 20 publicclass ItemSeparatorTest {20 class ItemSeparatorTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @Before Class25 @BeforeAll 26 26 public static void setUp() { 27 27 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 9 9 import javax.swing.JPanel; 10 10 11 import org.junit. BeforeClass;12 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.JOSMFixture; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 17 17 * Unit tests of {@link Key} class. 18 18 */ 19 publicclass KeyTest {19 class KeyTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUp() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 31 31 */ 32 32 @Test 33 publicvoid testAddToPanel() {33 void testAddToPanel() { 34 34 JPanel p = new JPanel(); 35 35 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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; … … 9 9 import javax.swing.JPanel; 10 10 11 import org.junit. BeforeClass;12 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.JOSMFixture; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 17 17 * Unit tests of {@link Label} class. 18 18 */ 19 publicclass LabelTest {19 class LabelTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUp() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 31 31 */ 32 32 @Test 33 publicvoid testAddToPanel() {33 void testAddToPanel() { 34 34 JPanel p = new JPanel(); 35 35 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java
r14119 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 19 19 * Unit tests of {@link Link} class. 20 20 */ 21 publicclass LinkTest {21 class LinkTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @Before Class26 @BeforeAll 27 27 public static void setUp() { 28 28 JOSMFixture.createUnitTestFixture().init(); … … 33 33 */ 34 34 @Test 35 publicvoid testAddToPanel() {35 void testAddToPanel() { 36 36 Link l = new Link(); 37 37 JPanel p = new JPanel(); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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; … … 9 9 import javax.swing.JPanel; 10 10 11 import org.junit. BeforeClass;12 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.JOSMFixture; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 17 17 * Unit tests of {@link MultiSelect} class. 18 18 */ 19 publicclass MultiSelectTest {19 class MultiSelectTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUp() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 31 31 */ 32 32 @Test 33 publicvoid testAddToPanel() {33 void testAddToPanel() { 34 34 JPanel p = new JPanel(); 35 35 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 18 * Unit tests of {@link Optional} class. 19 19 */ 20 publicclass OptionalTest {20 class OptionalTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @Before Class25 @BeforeAll 26 26 public static void setUp() { 27 27 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java
r12568 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 20 20 * Unit tests of {@link PresetLink} class. 21 21 */ 22 publicclass PresetLinkTest {22 class PresetLinkTest { 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 rule = new JOSMTestRules().presets(); … … 33 33 */ 34 34 @Test 35 publicvoid testAddToPanel() {35 void testAddToPanel() { 36 36 PresetLink l = new PresetLink(); 37 37 l.preset_name = "River"; -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java
r16690 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. BeforeClass;7 import org.junit. Test;6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 9 … … 11 11 * Unit tests of {@link PresetListEntry} class. 12 12 */ 13 publicclass PresetListEntryTest {13 class PresetListEntryTest { 14 14 15 15 /** 16 16 * Setup test. 17 17 */ 18 @Before Class18 @BeforeAll 19 19 public static void setUp() { 20 20 JOSMFixture.createUnitTestFixture().init(); … … 25 25 */ 26 26 @Test 27 publicvoid testTicket12416() {27 void testTicket12416() { 28 28 assertEquals(" ", new PresetListEntry("").getListDisplay()); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 18 * Unit tests of {@link Roles} class. 19 19 */ 20 publicclass RolesTest {20 class RolesTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @Before Class25 @BeforeAll 26 26 public static void setUp() { 27 27 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java
r9996 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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.util.Collections; … … 10 10 import javax.swing.JPanel; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 18 18 * Unit tests of {@link Space} class. 19 19 */ 20 publicclass SpaceTest {20 class SpaceTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @Before Class25 @BeforeAll 26 26 public static void setUp() { 27 27 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java
r16282 r17275 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 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; … … 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.data.osm.OsmPrimitive; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 19 19 * Unit tests of {@link Text} class. 20 20 */ 21 publicclass TextTest {21 class TextTest { 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(); … … 32 32 */ 33 33 @Test 34 publicvoid testAddToPanel() {34 void testAddToPanel() { 35 35 JPanel p = new JPanel(); 36 36 assertEquals(0, p.getComponentCount()); -
trunk/test/unit/org/openstreetmap/josm/gui/util/FileFilterAllFilesTest.java
r11202 r17275 2 2 package org.openstreetmap.josm.gui.util; 3 3 4 import static org.junit. Assert.assertNotNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.File; 8 8 9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 10 11 11 /** 12 12 * Unit tests of {@link FileFilterAllFiles} class. 13 13 */ 14 publicclass FileFilterAllFilesTest {14 class FileFilterAllFilesTest { 15 15 16 16 /** … … 18 18 */ 19 19 @Test 20 publicvoid testFileFilterAllFiles() {20 void testFileFilterAllFiles() { 21 21 assertTrue(FileFilterAllFiles.getInstance().accept(new File("."))); 22 22 assertNotNull(FileFilterAllFiles.getInstance().getDescription()); -
trunk/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java
r16034 r17275 2 2 package org.openstreetmap.josm.gui.util; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.awt.Dimension; … … 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.JOSMTestRules; 16 16 … … 21 21 * @author Michael Zangl 22 22 */ 23 publicclass MultiLineFlowLayoutTest {23 class MultiLineFlowLayoutTest { 24 24 /** 25 25 * No special rules. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 * Prepare test container. 36 36 */ 37 @Before 37 @BeforeEach 38 38 public void setUp() { 39 39 JPanel parent = new JPanel(); … … 48 48 */ 49 49 @Test 50 publicvoid testOneLine() {50 void testOneLine() { 51 51 fillOneLine(); 52 52 … … 65 65 */ 66 66 @Test 67 publicvoid testInsets() {67 void testInsets() { 68 68 fillOneLine(); 69 69 … … 86 86 */ 87 87 @Test 88 publicvoid testGaps() {88 void testGaps() { 89 89 fillOneLine(); 90 90 … … 100 100 */ 101 101 @Test 102 publicvoid testSameAsFlowLayout() {102 void testSameAsFlowLayout() { 103 103 fillOneLine(); 104 104 JPanel childx = new JPanel(); -
trunk/test/unit/org/openstreetmap/josm/gui/util/WindowGeometryTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.gui.util; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.awt.Dimension; … … 14 15 import javax.swing.JPanel; 15 16 16 import org.junit. Rule;17 import org.junit. Test;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.gui.util.WindowGeometry.WindowGeometryException; … … 28 29 * Unit tests of {@link WindowGeometry} class. 29 30 */ 30 publicclass WindowGeometryTest {31 class WindowGeometryTest { 31 32 /** 32 33 * Some of this depends on preferences. 33 34 */ 34 @R ule35 @RegisterExtension 35 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 37 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 40 41 */ 41 42 @Test 42 publicvoid testCenterInWindow() {43 void testCenterInWindow() { 43 44 assertNotNull(WindowGeometry.centerInWindow(null, null)); 44 45 assertNotNull(WindowGeometry.centerInWindow(new JPanel(), null)); … … 49 50 */ 50 51 @Test 51 publicvoid testCenterOnScreen() {52 void testCenterOnScreen() { 52 53 Dimension dim = new Dimension(200, 100); 53 54 assertEquals(new WindowGeometry(new Point(0, 0), dim), WindowGeometry.centerOnScreen(dim)); … … 60 61 /** 61 62 * Test of {@link WindowGeometry.WindowGeometryException} class. 62 * @throws WindowGeometryException always63 63 */ 64 @Test (expected = WindowGeometryException.class)65 public void testWindowGeometryException1() throws WindowGeometryException{64 @Test 65 void testWindowGeometryException1() { 66 66 Config.getPref().put("test", null); 67 new WindowGeometry("test");67 assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test")); 68 68 } 69 69 70 70 /** 71 71 * Test of {@link WindowGeometry.WindowGeometryException} class. 72 * @throws WindowGeometryException always73 72 */ 74 @Test (expected = WindowGeometryException.class)75 public void testWindowGeometryException2() throws WindowGeometryException{73 @Test 74 void testWindowGeometryException2() { 76 75 Config.getPref().put("test", ""); 77 new WindowGeometry("test");76 assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test")); 78 77 } 79 78 80 79 /** 81 80 * Test of {@link WindowGeometry.WindowGeometryException} class. 82 * @throws WindowGeometryException always83 81 */ 84 @Test (expected = WindowGeometryException.class)85 public void testWindowGeometryException3() throws WindowGeometryException{82 @Test 83 void testWindowGeometryException3() { 86 84 Config.getPref().put("test", "x=not_a_number"); 87 new WindowGeometry("test");85 assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test")); 88 86 } 89 87 90 88 /** 91 89 * Test of {@link WindowGeometry.WindowGeometryException} class. 92 * @throws WindowGeometryException always93 90 */ 94 @Test (expected = WindowGeometryException.class)95 public void testWindowGeometryException4() throws WindowGeometryException{91 @Test 92 void testWindowGeometryException4() { 96 93 Config.getPref().put("test", "wrong_pattern"); 97 new WindowGeometry("test");94 assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test")); 98 95 } 99 96 … … 103 100 */ 104 101 @Test 105 publicvoid testWindowGeometryException5() throws WindowGeometryException {102 void testWindowGeometryException5() throws WindowGeometryException { 106 103 Config.getPref().put("test", "x=15,y=55,width=200,height=100"); 107 104 assertNotNull(new WindowGeometry("test")); … … 112 109 */ 113 110 @Test 114 publicvoid testIsBugInMaximumWindowBounds() {111 void testIsBugInMaximumWindowBounds() { 115 112 assertFalse(WindowGeometry.isBugInMaximumWindowBounds(new Rectangle(10, 10))); 116 113 assertTrue(WindowGeometry.isBugInMaximumWindowBounds(new Rectangle(10, 0))); … … 122 119 */ 123 120 @Test 124 publicvoid testGetVirtualScreenBounds() {121 void testGetVirtualScreenBounds() { 125 122 assertNotNull(WindowGeometry.getVirtualScreenBounds()); 126 123 } … … 130 127 */ 131 128 @Test 132 publicvoid testGetMaxDimensionOnScreen() {129 void testGetMaxDimensionOnScreen() { 133 130 assertNotNull(WindowGeometry.getMaxDimensionOnScreen(new JLabel())); 134 131 } … … 138 135 */ 139 136 @Test 140 publicvoid testToString() {137 void testToString() { 141 138 assertEquals("WindowGeometry{topLeft=java.awt.Point[x=0,y=0],extent=java.awt.Dimension[width=0,height=0]}", 142 139 new WindowGeometry(new Rectangle()).toString()); … … 147 144 */ 148 145 @Test 149 publicvoid testEqualsContract() {146 void testEqualsContract() { 150 147 TestUtils.assumeWorkingEqualsVerifier(); 151 148 EqualsVerifier.forClass(WindowGeometry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java
r11772 r17275 2 2 package org.openstreetmap.josm.gui.widgets; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.beans.PropertyChangeEvent; … … 8 8 import javax.swing.JSplitPane; 9 9 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.testutils.JOSMTestRules; 13 13 … … 17 17 * Unit tests of {@link AutoAdjustingSplitPane} class. 18 18 */ 19 publicclass AutoAdjustingSplitPaneTest {19 class AutoAdjustingSplitPaneTest { 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 testAutoAdjustingSplitPane() {32 void testAutoAdjustingSplitPane() { 33 33 AutoAdjustingSplitPane pane = new AutoAdjustingSplitPane(JSplitPane.VERTICAL_SPLIT); 34 34 assertEquals(-1, pane.getDividerLocation()); -
trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java
r17212 r17275 2 2 package org.openstreetmap.josm.io; 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.InputStream; … … 11 11 import java.util.Collections; 12 12 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.xml.sax.InputSource; … … 18 18 * Unit tests of {@link Capabilities} class. 19 19 */ 20 publicclass CapabilitiesTest {20 class CapabilitiesTest { 21 21 22 22 /** … … 26 26 */ 27 27 @Test 28 publicvoid testCapabilities() throws Exception {28 void testCapabilities() throws Exception { 29 29 final Path path = Paths.get(TestUtils.getTestDataRoot(), "__files/api/0.6/capabilities"); 30 30 final Capabilities capabilities; -
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.io; 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 … … 12 12 * Unit tests of {@link CertificateAmendment} class. 13 13 */ 14 publicclass CertificateAmendmentTest {14 class CertificateAmendmentTest { 15 15 16 16 /** 17 17 * Setup rule 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(CertificateAmendment.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java
r15509 r17275 13 13 14 14 import org.junit.Assert; 15 import org.junit.BeforeClass;16 15 import org.junit.ClassRule; 17 import org.junit.Test; 16 import org.junit.jupiter.api.BeforeAll; 17 import org.junit.jupiter.api.Test; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 24 24 * Integration tests of {@link CertificateAmendment} class. 25 25 */ 26 publicclass CertificateAmendmentTestIT {26 class CertificateAmendmentTestIT { 27 27 28 28 /** … … 39 39 * @throws IOException in case of I/O error 40 40 */ 41 @Before Class41 @BeforeAll 42 42 public static void beforeClass() throws IOException { 43 43 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(CertificateAmendmentTestIT.class)); … … 49 49 */ 50 50 @Test 51 publicvoid testDefault() throws IOException {51 void testDefault() throws IOException { 52 52 // something that is not embedded 53 53 connect("https://www.bing.com", true); … … 59 59 */ 60 60 @Test 61 publicvoid testLetsEncrypt() throws IOException {61 void testLetsEncrypt() throws IOException { 62 62 // signed by letsencrypt's own ISRG root 63 63 connect("https://valid-isrgrootx1.letsencrypt.org", true); … … 73 73 */ 74 74 @Test 75 publicvoid testOverpass() throws IOException {75 void testOverpass() throws IOException { 76 76 connect("https://overpass-api.de", true); 77 77 } … … 82 82 */ 83 83 @Test 84 publicvoid testDutchGovernment() throws IOException {84 void testDutchGovernment() throws IOException { 85 85 connect("https://geodata.nationaalgeoregister.nl", true); 86 86 } … … 91 91 */ 92 92 @Test 93 publicvoid testTaiwanGovernment() throws IOException {93 void testTaiwanGovernment() throws IOException { 94 94 connect("https://grca.nat.gov.tw", true); 95 95 } -
trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.java
r14068 r17275 2 2 package org.openstreetmap.josm.io; 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.time.OffsetDateTime; … … 12 12 import java.util.Arrays; 13 13 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException; 16 16 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlParser; … … 20 20 * Unit tests of {@link ChangesetQueryUrlParser} class 21 21 */ 22 publicclass ChangesetQueryUrlParserTest {22 class ChangesetQueryUrlParserTest { 23 23 24 24 /** … … 27 27 */ 28 28 @Test 29 publicvoid testParseBasic() throws ChangesetQueryUrlException {29 void testParseBasic() throws ChangesetQueryUrlException { 30 30 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 31 31 … … 56 56 */ 57 57 @Test 58 publicvoid testUid() throws ChangesetQueryUrlException {58 void testUid() throws ChangesetQueryUrlException { 59 59 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 60 60 ChangesetQuery q; … … 74 74 */ 75 75 @Test 76 publicvoid testDisplayName() throws ChangesetQueryUrlException {76 void testDisplayName() throws ChangesetQueryUrlException { 77 77 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 78 78 ChangesetQuery q; … … 89 89 */ 90 90 @Test 91 publicvoid testOpen() throws ChangesetQueryUrlException {91 void testOpen() throws ChangesetQueryUrlException { 92 92 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 93 93 ChangesetQuery q; … … 112 112 */ 113 113 @Test 114 publicvoid testClosed() throws ChangesetQueryUrlException {114 void testClosed() throws ChangesetQueryUrlException { 115 115 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 116 116 ChangesetQuery q; … … 134 134 */ 135 135 @Test 136 publicvoid testUidAndDisplayName() {136 void testUidAndDisplayName() { 137 137 shouldFail("uid=1&display_name=abcd"); 138 138 } … … 143 143 */ 144 144 @Test 145 publicvoid testTime() throws ChangesetQueryUrlException {145 void testTime() throws ChangesetQueryUrlException { 146 146 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 147 147 ChangesetQuery q; … … 169 169 */ 170 170 @Test 171 publicvoid testBbox() throws ChangesetQueryUrlException {171 void testBbox() throws ChangesetQueryUrlException { 172 172 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 173 173 ChangesetQuery q; … … 191 191 */ 192 192 @Test 193 publicvoid testChangesetIds() throws ChangesetQueryUrlException {193 void testChangesetIds() throws ChangesetQueryUrlException { 194 194 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 195 195 ChangesetQuery q; -
trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.java
r14046 r17275 2 2 package org.openstreetmap.josm.io; 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 8 import java.util.Arrays; … … 10 10 import java.util.Set; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.osm.Changeset; … … 31 31 * Unit tests of {@link DiffResultProcessor} 32 32 */ 33 publicclass DiffResultProcessorTest {33 class DiffResultProcessorTest { 34 34 35 35 /** 36 36 * Setup rule 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules(); … … 53 53 */ 54 54 @Test 55 publicvoid testConstructor() {55 void testConstructor() { 56 56 Node n = new Node(1); 57 57 // these calls should not fail … … 66 66 */ 67 67 @Test 68 publicvoid testParse_NOK_Cases() {68 void testParse_NOK_Cases() { 69 69 shouldFail(null); 70 70 shouldFail(""); … … 77 77 */ 78 78 @Test 79 publicvoid testParse_OK_Cases() throws XmlParsingException {79 void testParse_OK_Cases() throws XmlParsingException { 80 80 DiffResultProcessor processor = new DiffResultProcessor(null); 81 81 String doc = … … 112 112 */ 113 113 @Test 114 publicvoid testPostProcess_Invocation_Variants() throws XmlParsingException {114 void testPostProcess_Invocation_Variants() throws XmlParsingException { 115 115 DiffResultProcessor processor = new DiffResultProcessor(null); 116 116 String doc = … … 136 136 */ 137 137 @Test 138 publicvoid testPostProcess_OK() throws XmlParsingException {138 void testPostProcess_OK() throws XmlParsingException { 139 139 140 140 Node n = new Node(); … … 171 171 */ 172 172 @Test 173 publicvoid testPostProcess_ForCreatedElement() throws XmlParsingException {173 void testPostProcess_ForCreatedElement() throws XmlParsingException { 174 174 175 175 Node n = new Node(); … … 193 193 */ 194 194 @Test 195 publicvoid testPostProcess_ForModifiedElement() throws XmlParsingException {195 void testPostProcess_ForModifiedElement() throws XmlParsingException { 196 196 197 197 Node n = new Node(1); … … 218 218 */ 219 219 @Test 220 publicvoid testPostProcess_ForDeletedElement() throws XmlParsingException {220 void testPostProcess_ForDeletedElement() throws XmlParsingException { 221 221 222 222 Node n = new Node(1); -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java
r17185 r17275 2 2 package org.openstreetmap.josm.io; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 9 9 … … 19 19 import java.util.stream.IntStream; 20 20 21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.extension.RegisterExtension; 22 import org.junit.jupiter.api.Test; 23 23 import org.openstreetmap.josm.TestUtils; 24 24 import org.openstreetmap.josm.data.coor.LatLon; … … 32 32 * Unit tests of {@link GeoJSONReader}. 33 33 */ 34 publicclass GeoJSONReaderTest {34 class GeoJSONReaderTest { 35 35 36 36 /** 37 37 * Setup test. 38 38 */ 39 @R ule39 @RegisterExtension 40 40 public JOSMTestRules rules = new JOSMTestRules(); 41 41 … … 45 45 */ 46 46 @Test 47 publicvoid testReadGeoJson() throws Exception {47 void testReadGeoJson() throws Exception { 48 48 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geo.json"))) { 49 49 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 60 60 */ 61 61 @Test 62 publicvoid testReadLineByLineGeoJSON() throws Exception {62 void testReadLineByLineGeoJSON() throws Exception { 63 63 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geoLineByLine.json"))) { 64 64 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 150 150 */ 151 151 @Test 152 publicvoid testReadGeoJsonNamedCrs() throws Exception {152 void testReadGeoJsonNamedCrs() throws Exception { 153 153 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geocrs.json"))) { 154 154 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 165 165 */ 166 166 @Test 167 publicvoid testReadGeoJsonWithoutType() {167 void testReadGeoJsonWithoutType() { 168 168 assertThrows(IllegalDataException.class, () -> 169 169 new GeoJSONReader().doParseDataSet(new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)), null)); … … 193 193 */ 194 194 @Test 195 publicvoid testTicket19822() throws Exception {195 void testTicket19822() throws Exception { 196 196 try (InputStream in = TestUtils.getRegressionDataStream(19822, "data.geojson")) { 197 197 final List<OsmPrimitive> primitives = new ArrayList<>( … … 207 207 */ 208 208 @Test 209 publicvoid testTicket19822Nested() throws Exception {209 void testTicket19822Nested() throws Exception { 210 210 try (InputStream in = TestUtils.getRegressionDataStream(19822, "problem3.geojson")) { 211 211 final List<OsmPrimitive> primitives = new ArrayList<>( -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java
r16936 r17275 2 2 package org.openstreetmap.josm.io; 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.InputStream; … … 10 10 import java.util.Arrays; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.TestUtils; … … 22 22 * Unit tests of {@link GeoJSONWriter} class. 23 23 */ 24 publicclass GeoJSONWriterTest {24 class GeoJSONWriterTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @Before Class29 @BeforeAll 30 30 public static void setUp() { 31 31 JOSMFixture.createUnitTestFixture().init(); … … 36 36 */ 37 37 @Test 38 publicvoid testPoint() {38 void testPoint() { 39 39 final Node node = new Node(new LatLon(12.3, 4.56)); 40 40 node.put("name", "foo"); … … 75 75 */ 76 76 @Test 77 publicvoid testLineString() {77 void testLineString() { 78 78 final DataSet ds = new DataSet(); 79 79 final Node n1 = new Node(new LatLon(12.3, 4.56)); … … 119 119 */ 120 120 @Test 121 publicvoid testMultipolygon() throws Exception {121 void testMultipolygon() throws Exception { 122 122 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) { 123 123 DataSet ds = OsmReader.parseDataSet(in, null); … … 132 132 */ 133 133 @Test 134 publicvoid testMultipolygonRobustness() throws Exception {134 void testMultipolygonRobustness() throws Exception { 135 135 try (InputStream in = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm"))) { 136 136 DataSet ds = OsmReader.parseDataSet(in, null); -
trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 6 7 7 8 import java.io.ByteArrayInputStream; … … 14 15 import java.util.Map; 15 16 16 import org.junit. Rule;17 import org.junit. Test;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.data.Bounds; … … 34 35 * Setup rule 35 36 */ 36 @R ule37 @RegisterExtension 37 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 39 public JOSMTestRules test = new JOSMTestRules(); … … 60 61 */ 61 62 @Test 62 publicvoid testMunich() throws Exception {63 void testMunich() throws Exception { 63 64 final GpxData result = parseGpxData("nodist/data/munich.gpx"); 64 65 assertEquals(2762, result.getTracks().size()); … … 76 77 */ 77 78 @Test 78 publicvoid testLayerPrefs() throws Exception {79 void testLayerPrefs() throws Exception { 79 80 final GpxData data = parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks-layerprefs.gpx"); 80 81 Map<String, String> e = new HashMap<>(); … … 93 94 * @throws Exception always SAXException 94 95 */ 95 @Test(expected = SAXException.class) 96 public void testException() throws Exception { 97 new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true); 96 @Test 97 void testException() throws Exception { 98 assertThrows(SAXException.class, 99 () -> new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true)); 98 100 } 99 101 … … 104 106 */ 105 107 @Test 106 publicvoid testTicket15634() throws IOException, SAXException {108 void testTicket15634() throws IOException, SAXException { 107 109 assertEquals(new Bounds(53.7229357, -7.9135019, 53.9301103, -7.59656), 108 110 GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(15634, "drumlish.gpx")).getMetaBounds()); -
trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java
r17149 r17275 15 15 import java.util.function.Consumer; 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.gpx.GpxConstants; … … 37 37 * Setup rule 38 38 */ 39 @R ule39 @RegisterExtension 40 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 41 public JOSMTestRules test = new JOSMTestRules(); … … 68 68 */ 69 69 @Test 70 publicvoid testTicket16550() throws IOException {70 void testTicket16550() throws IOException { 71 71 // Checks that time stored as date is correctly written into XML timestamp 72 72 testSingleWaypoint( … … 80 80 */ 81 81 @Test 82 publicvoid testTicket16725() throws IOException {82 void testTicket16725() throws IOException { 83 83 // Checks that sat, hdop, pdop, vdop are correctly exported 84 84 testSingleWaypoint( … … 100 100 */ 101 101 @Test 102 publicvoid testExtensions() throws IOException {102 void testExtensions() throws IOException { 103 103 GpxData data = new GpxData(); 104 104 // only namespace, no location printed -
trunk/test/unit/org/openstreetmap/josm/io/MultiFetchOverpassObjectReaderTest.java
r16612 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 import java.util.List; 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.osm.Node; 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 20 20 * Unit tests of {@link MultiFetchOverpassObjectReader}. 21 21 */ 22 publicclass MultiFetchOverpassObjectReaderTest {22 class MultiFetchOverpassObjectReaderTest { 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().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testBuildRequestNodesString() {35 void testBuildRequestNodesString() { 36 36 List<OsmPrimitive> objects = Arrays.asList(new Node(123), new Node(126), new Node(130)); 37 37 String requestString; … … 61 61 */ 62 62 @Test 63 publicvoid testBuildRequestWaysString() {63 void testBuildRequestWaysString() { 64 64 List<OsmPrimitive> objects = Arrays.asList(new Way(123), new Way(126), new Way(130)); 65 65 String requestString; … … 86 86 */ 87 87 @Test 88 publicvoid testBuildRequestRelationsString() {88 void testBuildRequestRelationsString() { 89 89 List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130)); 90 90 String requestString; … … 112 112 */ 113 113 @Test 114 publicvoid testBuildComplexString() {114 void testBuildComplexString() { 115 115 List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130), new Way(88), new Way(99), 116 116 new Node(1)); -
trunk/test/unit/org/openstreetmap/josm/io/NameFinderTest.java
r14015 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.StringReader; … … 8 8 import java.util.stream.Collectors; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 12 12 /** 13 13 * Unit tests of {@link NameFinder} class. 14 14 */ 15 publicclass NameFinderTest {15 class NameFinderTest { 16 16 17 17 // CHECKSTYLE.OFF: LineLength … … 41 41 */ 42 42 @Test 43 publicvoid testParseSearchResults() throws Exception {43 void testParseSearchResults() throws Exception { 44 44 try (StringReader reader = new StringReader(SAMPLE)) { 45 45 assertEquals(Arrays.asList( -
trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java
r16426 r17275 2 2 package org.openstreetmap.josm.io; 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.net.MalformedURLException; … … 10 10 import java.util.Map; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 … … 19 19 * Unit tests of {@link NetworkManager} class. 20 20 */ 21 publicclass NetworkManagerTest {21 class NetworkManagerTest { 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().https().devAPI().main().projection(); … … 35 35 */ 36 36 @Test 37 publicvoid testNetworkErrors() throws MalformedURLException {37 void testNetworkErrors() throws MalformedURLException { 38 38 NetworkManager.clearNetworkErrors(); 39 39 assertTrue(NetworkManager.getNetworkErrors().isEmpty()); … … 52 52 */ 53 53 @Test 54 publicvoid testOfflineResources() {54 void testOfflineResources() { 55 55 NetworkManager.setOnline(OnlineResource.ALL); 56 56 assertFalse(NetworkManager.isOffline("http://www.example.com/")); -
trunk/test/unit/org/openstreetmap/josm/io/NoteReaderTest.java
r10134 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; 7 7 import java.util.List; 8 8 9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 import org.openstreetmap.josm.data.notes.Note; … … 20 20 * Unit tests of {@link NoteReader} class. 21 21 */ 22 publicclass NoteReaderTest {22 class NoteReaderTest { 23 23 24 24 /** … … 28 28 */ 29 29 @Test 30 publicvoid testNoteReader() throws SAXException, IOException {30 void testNoteReader() throws SAXException, IOException { 31 31 List<Note> list = new NoteReader( 32 32 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ … … 89 89 */ 90 90 @Test 91 publicvoid testTicket12393() throws Exception {91 void testTicket12393() throws Exception { 92 92 // CHECKSTYLE.OFF: LineLength 93 93 new NoteReader( -
trunk/test/unit/org/openstreetmap/josm/io/OsmApiExceptionTest.java
r14810 r17275 2 2 package org.openstreetmap.josm.io; 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 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.JOSMTestRules; 10 10 … … 14 14 * Unit tests of {@link OsmApiException} class. 15 15 */ 16 publicclass OsmApiExceptionTest {16 class OsmApiExceptionTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testTicket17328() {29 void testTicket17328() { 30 30 assertFalse(new OsmApiException(503, "foo", "bar").isHtml()); 31 31 assertTrue(new OsmApiException(503, null, "<h2>This website is under heavy load (queue full)</h2><p>Sorry...</p>").isHtml()); -
trunk/test/unit/org/openstreetmap/josm/io/OsmApiTest.java
r10051 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.ByteArrayInputStream; 7 7 import java.nio.charset.StandardCharsets; 8 8 9 import org.junit. BeforeClass;10 import org.junit. Test;9 import org.junit.jupiter.api.BeforeAll; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.data.osm.Changeset; … … 17 17 * Unit tests of {@link OsmApi} class. 18 18 */ 19 publicclass OsmApiTest {19 class OsmApiTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUp() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testTicket12675() throws IllegalDataException {34 void testTicket12675() throws IllegalDataException { 35 35 OsmApi api = OsmApi.getOsmApi(); 36 36 Changeset cs = new Changeset(); -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.java
r14048 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.fail; 6 6 7 7 import java.util.Arrays; 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.LatLon; 12 12 import org.openstreetmap.josm.data.osm.Changeset; … … 20 20 * Unit tests of {@link OsmChangeBuilder} 21 21 */ 22 publicclass OsmChangeBuilderTest {22 class OsmChangeBuilderTest { 23 23 24 24 /** 25 25 * Setup rule 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 42 42 */ 43 43 @Test 44 publicvoid testConstructor() {44 void testConstructor() { 45 45 Changeset cs = new Changeset(1); 46 46 // should not fail … … 57 57 */ 58 58 @Test 59 publicvoid testSequenceOfMethodCalls() {59 void testSequenceOfMethodCalls() { 60 60 Changeset cs = new Changeset(1); 61 61 OsmChangeBuilder csBuilder = new OsmChangeBuilder(cs); … … 93 93 */ 94 94 @Test 95 publicvoid testDocumentWithNewNode() {95 void testDocumentWithNewNode() { 96 96 Changeset cs = new Changeset(1); 97 97 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 114 114 */ 115 115 @Test 116 publicvoid testDocumentWithModifiedNode() {116 void testDocumentWithModifiedNode() { 117 117 Changeset cs = new Changeset(1); 118 118 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 137 137 */ 138 138 @Test 139 publicvoid testDocumentWithDeletedNode() {139 void testDocumentWithDeletedNode() { 140 140 Changeset cs = new Changeset(1); 141 141 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 160 160 */ 161 161 @Test 162 publicvoid testMixed() {162 void testMixed() { 163 163 Changeset cs = new Changeset(1); 164 164 OsmChangeBuilder builder = new OsmChangeBuilder(cs); -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangeReaderTest.java
r14314 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.ByteArrayInputStream; … … 10 10 import java.util.Iterator; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.notes.Note; … … 25 25 * Unit tests of {@link OsmChangeReader}. 26 26 */ 27 publicclass OsmChangeReaderTest {27 class OsmChangeReaderTest { 28 28 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 */ 55 55 @Test 56 publicvoid testNotes() throws Exception {56 void testNotes() throws Exception { 57 57 NoteData nd = parse( 58 58 "<create>\r\n" + -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;7 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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.io.ByteArrayInputStream; … … 12 12 import java.util.Arrays; 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.data.osm.ChangesetDataSet; 17 17 import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType; … … 31 31 * Unit tests of {@link OsmChangesetContentParser}. 32 32 */ 33 publicclass OsmChangesetContentParserTest {33 class OsmChangesetContentParserTest { 34 34 35 35 /** 36 36 * Setup rule 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 @Test 55 55 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL") 56 publicvoid test_Constructor() {56 void test_Constructor() { 57 57 58 58 // should be OK … … 73 73 */ 74 74 @Test 75 publicvoid test_parse_arguments() throws XmlParsingException {75 void test_parse_arguments() throws XmlParsingException { 76 76 OsmChangesetContentParser parser; 77 77 … … 96 96 */ 97 97 @Test 98 publicvoid test_OK_OneCreatedNode() throws XmlParsingException {98 void test_OK_OneCreatedNode() throws XmlParsingException { 99 99 OsmChangesetContentParser parser; 100 100 … … 126 126 */ 127 127 @Test 128 publicvoid test_OK_OneUpdatedNode() throws XmlParsingException {128 void test_OK_OneUpdatedNode() throws XmlParsingException { 129 129 OsmChangesetContentParser parser; 130 130 … … 156 156 */ 157 157 @Test 158 publicvoid test_OK_OneDeletedNode() throws XmlParsingException {158 void test_OK_OneDeletedNode() throws XmlParsingException { 159 159 OsmChangesetContentParser parser; 160 160 … … 186 186 */ 187 187 @Test 188 publicvoid test_OK_ComplexTestCase() throws XmlParsingException {188 void test_OK_ComplexTestCase() throws XmlParsingException { 189 189 OsmChangesetContentParser parser; 190 190 -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetParserTest.java
r14231 r17275 2 2 package org.openstreetmap.josm.io; 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.ByteArrayInputStream; … … 9 9 import java.util.List; 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.data.osm.Changeset; 14 14 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 20 20 * Unit tests of {@link OsmChangesetParser} class. 21 21 */ 22 publicclass OsmChangesetParserTest {22 class OsmChangesetParserTest { 23 23 24 24 private static final String BEGIN = … … 58 58 * Setup test. 59 59 */ 60 @R ule60 @RegisterExtension 61 61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 62 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 71 71 */ 72 72 @Test 73 publicvoid testParseWithoutDiscussion() throws IllegalDataException {73 void testParseWithoutDiscussion() throws IllegalDataException { 74 74 // http://api.openstreetmap.org/api/0.6/changeset/36749147 75 75 Changeset cs = parse(BEGIN + END).iterator().next(); … … 84 84 */ 85 85 @Test 86 publicvoid testParseWithDiscussion() throws IllegalDataException {86 void testParseWithDiscussion() throws IllegalDataException { 87 87 // http://api.openstreetmap.org/api/0.6/changeset/36749147?include_discussion=true 88 88 Changeset cs = parse(BEGIN + DISCUSSION + END).iterator().next(); -
trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java
r17232 r17275 2 2 package org.openstreetmap.josm.io; 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.io.ByteArrayInputStream; … … 11 11 import java.util.Iterator; 12 12 13 import org.junit. BeforeClass;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.data.coor.LatLon; 17 17 import org.openstreetmap.josm.data.osm.DataSet; … … 29 29 * Unit tests of {@link OsmReader} class. 30 30 */ 31 publicclass OsmJsonReaderTest {31 class OsmJsonReaderTest { 32 32 33 33 /** 34 34 * Setup rule 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules(); … … 41 41 * Setup test 42 42 */ 43 @Before Class43 @BeforeAll 44 44 public static void setUp() { 45 45 DateUtils.newIsoDateTimeFormat().setTimeZone(DateUtils.UTC); … … 89 89 */ 90 90 @Test 91 publicvoid testHeader() throws Exception {91 void testHeader() throws Exception { 92 92 DataSet ds = parse(""); 93 93 assertEquals("0.6", ds.getVersion()); … … 99 99 */ 100 100 @Test 101 publicvoid testNodeSpatialData() throws Exception {101 void testNodeSpatialData() throws Exception { 102 102 DataSet ds = parse("{\n" + 103 103 " \"type\": \"node\",\n" + … … 116 116 */ 117 117 @Test 118 publicvoid testNodeMetaData() throws Exception {118 void testNodeMetaData() throws Exception { 119 119 DataSet ds = parse("{\n" + 120 120 " \"type\": \"node\",\n" + … … 143 143 */ 144 144 @Test 145 publicvoid testNodeTags() throws Exception {145 void testNodeTags() throws Exception { 146 146 DataSet ds = parse("{\n" + 147 147 " \"type\": \"node\",\n" + … … 167 167 */ 168 168 @Test 169 publicvoid testWay() throws Exception {169 void testWay() throws Exception { 170 170 DataSet ds = parse("{\n" + 171 171 " \"type\": \"way\",\n" + … … 199 199 */ 200 200 @Test 201 publicvoid testRelation() throws Exception {201 void testRelation() throws Exception { 202 202 DataSet ds = parse("{\n" + 203 203 " \"type\": \"relation\",\n" + … … 244 244 */ 245 245 @Test 246 publicvoid testEmptyRelation() throws Exception {246 void testEmptyRelation() throws Exception { 247 247 DataSet ds = parse("{\n" + 248 248 " \"type\": \"relation\",\n" + … … 260 260 */ 261 261 @Test 262 publicvoid testRemark() throws Exception {262 void testRemark() throws Exception { 263 263 DataSet ds = parse("", "," + 264 264 " \"remark\": \"runtime error: Query ran out of memory in \\\"query\\\" at line 5.\"\n"); -
trunk/test/unit/org/openstreetmap/josm/io/OsmReaderTest.java
r17169 r17275 5 5 import static org.hamcrest.CoreMatchers.is; 6 6 import static org.hamcrest.MatcherAssert.assertThat; 7 import static org.junit. Assert.assertEquals;8 import static org.junit. Assert.assertFalse;9 import static org.junit. Assert.assertNull;10 import static org.junit. Assert.assertTrue;11 import static org.junit. Assert.fail;7 import static org.junit.jupiter.api.Assertions.assertEquals; 8 import static org.junit.jupiter.api.Assertions.assertFalse; 9 import static org.junit.jupiter.api.Assertions.assertNull; 10 import static org.junit.jupiter.api.Assertions.assertTrue; 11 import static org.junit.jupiter.api.Assertions.fail; 12 12 13 13 import java.io.ByteArrayInputStream; … … 18 18 import java.util.Arrays; 19 19 20 import org.junit. Rule;21 import org.junit. Test;20 import org.junit.jupiter.api.extension.RegisterExtension; 21 import org.junit.jupiter.api.Test; 22 22 import org.openstreetmap.josm.TestUtils; 23 23 import org.openstreetmap.josm.data.osm.DataSet; … … 34 34 * Unit tests of {@link OsmReader} class. 35 35 */ 36 publicclass OsmReaderTest {36 class OsmReaderTest { 37 37 38 38 /** 39 39 * Setup rule 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules(); … … 66 66 */ 67 67 @Test 68 publicvoid testPostProcessors() throws Exception {68 void testPostProcessors() throws Exception { 69 69 PostProcessorStub registered = new PostProcessorStub(); 70 70 PostProcessorStub unregistered = new PostProcessorStub(); … … 96 96 */ 97 97 @Test 98 publicvoid testUnknownRoot() throws Exception {98 void testUnknownRoot() throws Exception { 99 99 for (Options[] options : options()) { 100 100 testUnknown("<nonosm/>", options); … … 107 107 */ 108 108 @Test 109 publicvoid testUnknownMeta() throws Exception {109 void testUnknownMeta() throws Exception { 110 110 for (Options[] options : options()) { 111 111 testUnknown("<osm version='0.6'><meta osm_base='2017-03-29T19:04:03Z'/></osm>", options); … … 118 118 */ 119 119 @Test 120 publicvoid testUnknownNote() throws Exception {120 void testUnknownNote() throws Exception { 121 121 for (Options[] options : options()) { 122 122 testUnknown("<osm version='0.6'><note>The data included in this document is from www.openstreetmap.org.</note></osm>", options); … … 129 129 */ 130 130 @Test 131 publicvoid testUnknownTag() throws Exception {131 void testUnknownTag() throws Exception { 132 132 for (Options[] options : options()) { 133 133 testUnknown("<osm version='0.6'><foo>bar</foo></osm>", options); … … 170 170 */ 171 171 @Test 172 publicvoid testInvalidUid() throws Exception {172 void testInvalidUid() throws Exception { 173 173 testInvalidData("<osm version='0.6'><node id='1' uid='nan'/></osm>", 174 174 "Illegal value for attribute 'uid'. Got 'nan'. (at line 1, column 82). 82 bytes have been read"); … … 180 180 */ 181 181 @Test 182 publicvoid testMissingId() throws Exception {182 void testMissingId() throws Exception { 183 183 testInvalidData("<osm version='0.6'><node/></osm>", 184 184 "Missing required attribute 'id'. (at line 1, column 65). 64 bytes have been read"); … … 190 190 */ 191 191 @Test 192 publicvoid testMissingRef() throws Exception {192 void testMissingRef() throws Exception { 193 193 testInvalidData("<osm version='0.6'><way id='1' version='1'><nd/></way></osm>", 194 194 "Missing mandatory attribute 'ref' on <nd> of way 1. (at line 1, column 87). 88 bytes have been read"); … … 202 202 */ 203 203 @Test 204 publicvoid testIllegalRef() throws Exception {204 void testIllegalRef() throws Exception { 205 205 testInvalidData("<osm version='0.6'><way id='1' version='1'><nd ref='0'/></way></osm>", 206 206 "Illegal value of attribute 'ref' of element <nd>. Got 0. (at line 1, column 95). 96 bytes have been read"); … … 219 219 */ 220 220 @Test 221 publicvoid testMissingType() throws Exception {221 void testMissingType() throws Exception { 222 222 testInvalidData("<osm version='0.6'><relation id='1' version='1'><member ref='1'/></relation></osm>", 223 223 "Missing attribute 'type' on member 1 in relation 1. (at line 1, column 104). 109 bytes have been read"); … … 229 229 */ 230 230 @Test 231 publicvoid testIllegalType() throws Exception {231 void testIllegalType() throws Exception { 232 232 testInvalidData("<osm version='0.6'><relation id='1' version='1'><member type='foo' ref='1'/></relation></osm>", 233 233 "Illegal value for attribute 'type' on member 1 in relation 1. Got foo. (at line 1, column 115). 120 bytes have been read"); … … 239 239 */ 240 240 @Test 241 publicvoid testMissingKeyValue() throws Exception {241 void testMissingKeyValue() throws Exception { 242 242 testInvalidData("<osm version='0.6'><node id='1' version='1'><tag/></node></osm>", 243 243 "Missing key or value attribute in tag. (at line 1, column 89). 89 bytes have been read"); … … 253 253 */ 254 254 @Test 255 publicvoid testMissingVersion() throws Exception {255 void testMissingVersion() throws Exception { 256 256 testInvalidData("<osm/>", 257 257 "Missing mandatory attribute 'version'. (at line 1, column 45). 44 bytes have been read"); … … 265 265 */ 266 266 @Test 267 publicvoid testUnsupportedVersion() throws Exception {267 void testUnsupportedVersion() throws Exception { 268 268 testInvalidData("<osm version='0.1'/>", 269 269 "Unsupported version: 0.1 (at line 1, column 59). 58 bytes have been read"); … … 275 275 */ 276 276 @Test 277 publicvoid testIllegalVersion() throws Exception {277 void testIllegalVersion() throws Exception { 278 278 testInvalidData("<osm version='0.6'><node id='1' version='nan'/></osm>", 279 279 "Illegal value for attribute 'version' on OSM primitive with ID 1. Got nan. (at line 1, column 86). 86 bytes have been read"); … … 285 285 */ 286 286 @Test 287 publicvoid testIllegalChangeset() throws Exception {287 void testIllegalChangeset() throws Exception { 288 288 testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='nan'/></osm>", 289 289 "Illegal value for attribute 'changeset'. Got nan. (at line 1, column 100). 100 bytes have been read"); … … 297 297 */ 298 298 @Test 299 publicvoid testGdprChangeset() throws Exception {299 void testGdprChangeset() throws Exception { 300 300 String gdprChangeset = "<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>"; 301 301 for (Options[] options : options()) { … … 309 309 */ 310 310 @Test 311 publicvoid testInvalidBounds() throws Exception {311 void testInvalidBounds() throws Exception { 312 312 testInvalidData("<osm version='0.6'><bounds/></osm>", 313 313 "Missing mandatory attributes on element 'bounds'. " + … … 329 329 */ 330 330 @Test 331 publicvoid testTicket14199() throws Exception {331 void testTicket14199() throws Exception { 332 332 try (InputStream in = TestUtils.getRegressionDataStream(14199, "emptytag.osm")) { 333 333 Way w = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE).getWays().iterator().next(); … … 343 343 */ 344 344 @Test 345 publicvoid testTicket14754() throws Exception {345 void testTicket14754() throws Exception { 346 346 try (InputStream in = TestUtils.getRegressionDataStream(14754, "malformed_for_14754.osm")) { 347 347 OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); … … 361 361 */ 362 362 @Test 363 publicvoid testTicket14788() throws Exception {363 void testTicket14788() throws Exception { 364 364 try (InputStream in = TestUtils.getRegressionDataStream(14788, "remove_sign_test_4.osm")) { 365 365 OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); … … 379 379 */ 380 380 @Test 381 publicvoid testRemark() throws Exception {381 void testRemark() throws Exception { 382 382 String query = "<osm version=\"0.6\" generator=\"Overpass API 0.7.55.4 3079d8ea\">\r\n" + 383 383 "<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>\r\n" + … … 396 396 */ 397 397 @Test 398 publicvoid testUnknownAttributeTags() throws Exception {398 void testUnknownAttributeTags() throws Exception { 399 399 String testData = "<osm version=\"0.6\" generator=\"fake generator\">" 400 400 + "<node id='1' version='1' visible='true' changeset='82' randomkey='randomvalue'></node>" + "</osm>"; -
trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java
r16663 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.io.ByteArrayOutputStream; … … 16 16 import java.util.List; 17 17 18 import org.junit. Test;18 import org.junit.jupiter.api.Test; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 20 import org.openstreetmap.josm.data.osm.Changeset; … … 28 28 * Unit tests of {@link OsmWriter} class. 29 29 */ 30 publicclass OsmWriterTest {30 class OsmWriterTest { 31 31 32 32 /** … … 34 34 */ 35 35 @Test 36 publicvoid testByIdComparator() {36 void testByIdComparator() { 37 37 38 38 final List<NodeData> ids = new ArrayList<>(); … … 56 56 */ 57 57 @Test 58 publicvoid testHeader() throws IOException {58 void testHeader() throws IOException { 59 59 doTestHeader(null, null, 60 60 "<osm version='0.6' generator='JOSM'>"); … … 82 82 */ 83 83 @Test 84 publicvoid testWriteLock() throws IOException {84 void testWriteLock() throws IOException { 85 85 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 86 86 try (PrintWriter out = new PrintWriter(new OutputStreamWriter(baos, StandardCharsets.UTF_8)); … … 101 101 */ 102 102 @Test 103 publicvoid testChangeset() throws IOException {103 void testChangeset() throws IOException { 104 104 Changeset cs = new Changeset(); 105 105 cs.setUser(User.getAnonymous()); -
trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.java
r14040 r17275 2 2 package org.openstreetmap.josm.io; 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 8 import java.io.ByteArrayInputStream; … … 11 11 import java.nio.charset.StandardCharsets; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.osm.DataSet; 16 16 import org.openstreetmap.josm.data.osm.Node; … … 25 25 * Additional unit tests for {@link OsmReader}. 26 26 */ 27 publicclass ParseWithChangesetReaderTest {27 class ParseWithChangesetReaderTest { 28 28 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 */ 55 55 @Test 56 publicvoid test_1() throws Exception {56 void test_1() throws Exception { 57 57 String doc = 58 58 "<osm version=\"0.6\">\n" + … … 73 73 */ 74 74 @Test 75 publicvoid test_11() throws Exception {75 void test_11() throws Exception { 76 76 String doc = 77 77 "<osm version=\"0.6\">\n" + … … 92 92 */ 93 93 @Test 94 publicvoid test_12() throws Exception {94 void test_12() throws Exception { 95 95 String doc = 96 96 "<osm version=\"0.6\">\n" + … … 111 111 */ 112 112 @Test 113 publicvoid test_13() throws Exception {113 void test_13() throws Exception { 114 114 String doc = 115 115 "<osm version=\"0.6\">\n" + … … 131 131 */ 132 132 @Test 133 publicvoid test_14() throws Exception {133 void test_14() throws Exception { 134 134 String doc = 135 135 "<osm version=\"0.6\">\n" + … … 152 152 */ 153 153 @Test 154 publicvoid test_2() throws Exception {154 void test_2() throws Exception { 155 155 String doc = 156 156 "<osm version=\"0.6\">\n" + … … 171 171 */ 172 172 @Test 173 publicvoid test_3() throws Exception {173 void test_3() throws Exception { 174 174 String doc = 175 175 "<osm version=\"0.6\">\n" + … … 190 190 */ 191 191 @Test 192 publicvoid test_4() throws IOException {192 void test_4() throws IOException { 193 193 String doc = 194 194 "<osm version=\"0.6\">\n" + … … 205 205 */ 206 206 @Test 207 publicvoid test_5() throws IOException {207 void test_5() throws IOException { 208 208 String doc = 209 209 "<osm version=\"0.6\">\n" + … … 220 220 */ 221 221 @Test 222 publicvoid test_6() throws IOException {222 void test_6() throws IOException { 223 223 String doc = 224 224 "<osm version=\"0.6\">\n" + -
trunk/test/unit/org/openstreetmap/josm/io/UrlPatternsTest.java
r15784 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.util.Arrays; … … 8 8 import java.util.regex.Pattern; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 … … 14 14 * Unit tests of {@link UrlPatterns}. 15 15 */ 16 publicclass UrlPatternsTest {16 class UrlPatternsTest { 17 17 18 18 private static final List<Class<? extends Enum<?>>> patterns = Arrays.asList( … … 27 27 */ 28 28 @Test 29 publicvoid testUrlPatternEnums() {29 void testUrlPatternEnums() { 30 30 patterns.forEach(TestUtils::superficialEnumCodeCoverage); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testUrlPatterns() {37 void testUrlPatterns() { 38 38 assertTrue(patterns.stream().flatMap(c -> Arrays.stream(c.getEnumConstants())).map(t -> ((UrlPattern) t).pattern()) 39 39 .map(Pattern::compile).count() > 0); -
trunk/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java
r15755 r17275 2 2 package org.openstreetmap.josm.io.audio; 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 import static org.junit.jupiter.api.Assertions.assertTimeout; 6 7 7 8 import java.io.File; 8 9 import java.net.MalformedURLException; 9 10 import java.net.URL; 11 import java.time.Duration; 10 12 11 import org.junit. BeforeClass;12 import org.junit. Ignore;13 import org.junit. Test;13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Disabled; 15 import org.junit.jupiter.api.Test; 14 16 import org.openstreetmap.josm.JOSMFixture; 15 17 import org.openstreetmap.josm.TestUtils; … … 19 21 * Unit tests of {@link AudioPlayer} class. 20 22 */ 21 @ Ignore("unresolved sporadic deadlock - see #13809")22 publicclass AudioPlayerTest {23 @Disabled("unresolved sporadic deadlock - see #13809") 24 class AudioPlayerTest { 23 25 24 26 // We play wav files of about 4 seconds + pause, so define timeout at 16 seconds … … 28 30 * Setup test. 29 31 */ 30 @Before Class32 @BeforeAll 31 33 public static void setUp() { 32 34 JOSMFixture.createUnitTestFixture().init(); … … 38 40 * @throws MalformedURLException wrong URL 39 41 */ 40 @Test(timeout = 4*MAX_DURATION) 41 public void testPlay() throws MalformedURLException, Exception { 42 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); 43 File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav")); 42 @Test 43 void testPlay() throws MalformedURLException, Exception { 44 assertTimeout(Duration.ofMillis(4*MAX_DURATION), () -> { 45 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); 46 File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav")); 44 47 45 for (File w : new File[] {wav1, wav2}) { 46 System.out.println("Playing " + w.toPath()); 47 URL url = w.toURI().toURL(); 48 final Stopwatch stopwatch = Stopwatch.createStarted(); 49 AudioPlayer.play(url); 50 assertTrue(AudioPlayer.playing()); 51 assertFalse(AudioPlayer.paused()); 52 AudioPlayer.pause(); 53 assertFalse(AudioPlayer.playing()); 54 assertTrue(AudioPlayer.paused()); 55 AudioPlayer.play(url, AudioPlayer.position()); 56 while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) { 57 Thread.sleep(500); 48 for (File w : new File[] {wav1, wav2}) { 49 System.out.println("Playing " + w.toPath()); 50 URL url = w.toURI().toURL(); 51 final Stopwatch stopwatch = Stopwatch.createStarted(); 52 AudioPlayer.play(url); 53 assertTrue(AudioPlayer.playing()); 54 assertFalse(AudioPlayer.paused()); 55 AudioPlayer.pause(); 56 assertFalse(AudioPlayer.playing()); 57 assertTrue(AudioPlayer.paused()); 58 AudioPlayer.play(url, AudioPlayer.position()); 59 while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) { 60 Thread.sleep(500); 61 } 62 System.out.println("Play finished after " + stopwatch); 63 assertTrue(stopwatch.elapsed() < MAX_DURATION); 64 AudioPlayer.reset(); 65 Thread.sleep(1000); // precaution, see #13809 58 66 } 59 System.out.println("Play finished after " + stopwatch); 60 assertTrue(stopwatch.elapsed() < MAX_DURATION); 61 AudioPlayer.reset(); 62 Thread.sleep(1000); // precaution, see #13809 63 } 67 }); 64 68 } 65 69 } -
trunk/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java
r12327 r17275 2 2 package org.openstreetmap.josm.io.audio; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.File; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.TestUtils; … … 14 14 * Unit tests of {@link AudioUtil} class. 15 15 */ 16 publicclass AudioUtilTest {16 class AudioUtilTest { 17 17 18 18 private static final double EPSILON = 1e-11; … … 21 21 * Setup test. 22 22 */ 23 @Before Class23 @BeforeAll 24 24 public static void setUp() { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 30 30 */ 31 31 @Test 32 publicvoid testGetCalibratedDuration() {32 void testGetCalibratedDuration() { 33 33 assertEquals(0.0, AudioUtil.getCalibratedDuration(new File("invalid_file")), EPSILON); 34 34 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); -
trunk/test/unit/org/openstreetmap/josm/io/auth/CredentialsAgentExceptionTest.java
r11102 r17275 2 2 package org.openstreetmap.josm.io.auth; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link CredentialsAgentException} class. 14 14 */ 15 publicclass CredentialsAgentExceptionTest {15 class CredentialsAgentExceptionTest { 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 testCredentialsAgentException() {28 void testCredentialsAgentException() { 29 29 String msg = "test1"; 30 30 Exception cause = new Exception("test2"); -
trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io.nmea; 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.io.ByteArrayInputStream; … … 17 17 import java.util.TimeZone; 18 18 19 import org.junit. Before;20 import org.junit. Rule;21 import org.junit. Test;19 import org.junit.jupiter.api.BeforeEach; 20 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.api.extension.RegisterExtension; 22 22 import org.openstreetmap.josm.TestUtils; 23 23 import org.openstreetmap.josm.data.coor.LatLon; … … 37 37 * Unit tests of {@link NmeaReader} class. 38 38 */ 39 publicclass NmeaReaderTest {39 class NmeaReaderTest { 40 40 /** 41 41 * Set the timezone and timeout. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules(); … … 50 50 * Forces the timezone. 51 51 */ 52 @Before 52 @BeforeEach 53 53 public void setUp() { 54 54 iso8601.setTimeZone(DateUtils.UTC); … … 60 60 */ 61 61 @Test 62 publicvoid testReader() throws Exception {62 void testReader() throws Exception { 63 63 TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); 64 64 final NmeaReader in = new NmeaReader(Files.newInputStream(Paths.get("nodist/data/btnmeatrack_2016-01-25.nmea"))); … … 116 116 */ 117 117 @Test 118 publicvoid testIsSentence() {118 void testIsSentence() { 119 119 assertTrue(NmeaReader.isSentence("$GPVTG", Sentence.VTG)); 120 120 assertTrue(NmeaReader.isSentence("$GAVTG", Sentence.VTG)); … … 130 130 */ 131 131 @Test 132 publicvoid testTicket1433() throws Exception {132 void testTicket1433() throws Exception { 133 133 compareWithReference(1433, "2008-08-14-16-04-58", 1241); 134 134 } … … 139 139 */ 140 140 @Test 141 publicvoid testTicket1853() throws Exception {141 void testTicket1853() throws Exception { 142 142 compareWithReference(1853, "PosData-20081216-115434", 1285); 143 143 } … … 148 148 */ 149 149 @Test 150 publicvoid testTicket2147() throws Exception {150 void testTicket2147() throws Exception { 151 151 compareWithReference(2147, "WG20080203171807.log", 487); 152 152 } … … 157 157 */ 158 158 @Test 159 publicvoid testTicket14924() throws Exception {159 void testTicket14924() throws Exception { 160 160 compareWithReference(14924, "input", 0); 161 161 } … … 184 184 */ 185 185 @Test 186 publicvoid testTicket16496() throws Exception {186 void testTicket16496() throws Exception { 187 187 assertEquals("2018-05-30T16:28:59.400Z", iso8601.format( 188 188 readDate("$GNRMC,162859.400,A,4543.03388,N,00058.19870,W,45.252,209.07,300518,,,D,V*13"))); … … 198 198 */ 199 199 @Test 200 publicvoid testTicket16554() throws Exception {200 void testTicket16554() throws Exception { 201 201 assertEquals(63.2420959, readSpeed( 202 202 "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26"), 1e-7); -
trunk/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java
r10931 r17275 2 2 package org.openstreetmap.josm.io.protocols.data; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.IOException; … … 8 8 import java.net.URLConnection; 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.JOSMTestRules; 14 14 … … 16 16 * Unit tests of {@link Handler} class. 17 17 */ 18 publicclass HandlerTest {18 class HandlerTest { 19 19 20 20 /** 21 21 * Use the test rules to remove any layers and reset state. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 public final JOSMTestRules rules = new JOSMTestRules(); 25 25 … … 27 27 * Setup test. 28 28 */ 29 @Before 29 @BeforeEach 30 30 public void setUp() { 31 31 Handler.install(); … … 37 37 */ 38 38 @Test 39 publicvoid testBase64Image() throws IOException {39 void testBase64Image() throws IOException { 40 40 // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML 41 41 URLConnection connection = new Handler().openConnection(new URL("data:image/png;base64," + -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/AddTagsDialogTest.java
r16328 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Map; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests for class {@link AddTagsDialog}. 16 16 */ 17 publicclass AddTagsDialogTest {17 class AddTagsDialogTest { 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().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testParseUrlTagsToKeyValues() {29 void testParseUrlTagsToKeyValues() { 30 30 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("wikipedia:de=Residenzschloss Dresden|name:en=Dresden Castle"); 31 31 assertEquals(2, strings.size()); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.BufferedReader; … … 15 15 import java.util.stream.Collectors; 16 16 17 import org.junit. After;18 import org.junit. Before;19 import org.junit. Rule;20 import org.junit. Test;17 import org.junit.jupiter.api.AfterEach; 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.spi.preferences.Config; … … 32 32 * Unit tests for Remote Control 33 33 */ 34 publicclass RemoteControlTest {34 class RemoteControlTest { 35 35 36 36 private String httpBase; … … 46 46 * Setup test. 47 47 */ 48 @R ule48 @RegisterExtension 49 49 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 50 public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT(); … … 54 54 * @throws GeneralSecurityException if a security error occurs 55 55 */ 56 @Before 56 @BeforeEach 57 57 public void setUp() throws GeneralSecurityException { 58 58 if (PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR"))) { … … 69 69 * Stops Remote control after testing requests. 70 70 */ 71 @After 71 @AfterEach 72 72 public void tearDown() { 73 73 RemoteControl.stop(); … … 79 79 */ 80 80 @Test 81 publicvoid testHttpListOfCommands() throws Exception {81 void testHttpListOfCommands() throws Exception { 82 82 testListOfCommands(httpBase); 83 83 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RequestProcessorTest.java
r16825 r17275 13 13 * @author Taylor Smock 14 14 */ 15 publicclass RequestProcessorTest {15 class RequestProcessorTest { 16 16 /** 17 17 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19436">#19436</a> 18 18 */ 19 19 @Test 20 publicvoid testFeaturesDoesNotThrowNPE() {20 void testFeaturesDoesNotThrowNPE() { 21 21 assertTrue(RequestProcessor.getHandlersInfo(Arrays.asList("add_node", "/add_node", "", null)) 22 22 .noneMatch(Objects::isNull)); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.MainApplication; … … 19 19 * Unit tests of {@link AddNodeHandler} class. 20 20 */ 21 publicclass AddNodeHandlerTest {21 class AddNodeHandlerTest { 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection(); … … 38 38 */ 39 39 @Test 40 publicvoid testBadRequestNoLayer() {40 void testBadRequestNoLayer() { 41 41 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle()); 42 42 assertEquals("There is no layer opened to add node", e.getMessage()); … … 47 47 */ 48 48 @Test 49 publicvoid testBadRequestNoParam() {49 void testBadRequestNoParam() { 50 50 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 51 51 MainApplication.getLayerManager().addLayer(layer); … … 58 58 */ 59 59 @Test 60 publicvoid testBadRequestInvalidUrl() {60 void testBadRequestInvalidUrl() { 61 61 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 62 62 assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); … … 67 67 */ 68 68 @Test 69 publicvoid testBadRequestIncompleteUrl() {69 void testBadRequestIncompleteUrl() { 70 70 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 71 71 assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); … … 76 76 */ 77 77 @Test 78 publicvoid testNominalRequest() {78 void testNominalRequest() { 79 79 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 80 80 MainApplication.getLayerManager().addLayer(layer); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.MainApplication; … … 19 19 * Unit tests of {@link AddWayHandler} class. 20 20 */ 21 publicclass AddWayHandlerTest {21 class AddWayHandlerTest { 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 38 38 */ 39 39 @Test 40 publicvoid testBadRequestNoLayer() {40 void testBadRequestNoLayer() { 41 41 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?way=0,0;1,1").handle()); 42 42 assertEquals("There is no layer opened to add way", e.getMessage()); … … 47 47 */ 48 48 @Test 49 publicvoid testBadRequestNoParam() {49 void testBadRequestNoParam() { 50 50 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 51 51 try { … … 62 62 */ 63 63 @Test 64 publicvoid testBadRequestInvalidUrl() {64 void testBadRequestInvalidUrl() { 65 65 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 66 66 assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage()); … … 71 71 */ 72 72 @Test 73 publicvoid testBadRequestIncompleteUrl() {73 void testBadRequestIncompleteUrl() { 74 74 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 75 75 assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage()); … … 80 80 */ 81 81 @Test 82 publicvoid testNominalRequest() {82 void testNominalRequest() { 83 83 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 84 84 try { -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java
r16739 r17275 4 4 import static org.hamcrest.CoreMatchers.hasItem; 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 import static org.junit. Assert.assertEquals;6 import static org.junit.jupiter.api.Assertions.assertEquals; 7 7 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 8 8 import static org.junit.jupiter.api.Assertions.assertThrows; … … 11 11 import java.util.List; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.imagery.ImageryInfo; 16 16 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; … … 22 22 * Unit tests of {@link ImageryHandler} class. 23 23 */ 24 publicclass ImageryHandlerTest {24 class ImageryHandlerTest { 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(); … … 41 41 */ 42 42 @Test 43 publicvoid testBadRequestNoParam() {43 void testBadRequestNoParam() { 44 44 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 45 45 assertEquals("Parameter must not be null", e.getMessage()); … … 51 51 */ 52 52 @Test 53 publicvoid testBadRequestInvalidUrl() {53 void testBadRequestInvalidUrl() { 54 54 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 55 55 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 60 60 */ 61 61 @Test 62 publicvoid testBadRequestIncompleteUrl() {62 void testBadRequestIncompleteUrl() { 63 63 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 64 64 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 69 69 */ 70 70 @Test 71 publicvoid testNominalRequest() {71 void testNominalRequest() { 72 72 assertDoesNotThrow(() -> newHandler("https://localhost?url=foo").handle()); 73 73 } … … 78 78 */ 79 79 @Test 80 publicvoid testOptionalParams() throws Exception {80 void testOptionalParams() throws Exception { 81 81 List<String> optionalParams = Arrays.asList(newHandler("").getOptionalParams()); 82 82 assertThat(optionalParams, hasItem("type")); … … 91 91 */ 92 92 @Test 93 publicvoid testBuildImageryInfo() throws Exception {93 void testBuildImageryInfo() throws Exception { 94 94 String url = "https://localhost/imagery?title=osm" 95 95 + "&type=tms&min_zoom=3&max_zoom=23&category=osmbasedmap&country_code=XA" … … 110 110 */ 111 111 @Test 112 publicvoid testTicket19483() throws Exception {112 void testTicket19483() throws Exception { 113 113 String url = "https://localhost/imagery?url=" + 114 114 "tms[3-7]%3Ahttps%3A%2F%2Fservices.digitalglobe.com%2Fearthservice%2Ftmsaccess%2F" + -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
r16618 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; … … 8 8 import java.io.File; 9 9 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.TestUtils; 13 13 import org.openstreetmap.josm.gui.MainApplication; … … 22 22 * Unit tests of {@link ImportHandler} class. 23 23 */ 24 publicclass ImportHandlerTest {24 class ImportHandlerTest { 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(); … … 42 42 */ 43 43 @Test 44 publicvoid testTicket7434() throws Exception {44 void testTicket7434() throws Exception { 45 45 ImportHandler req = newHandler("http://localhost:8111/import?url=http://localhost:8888/relations?relations=19711&mode=recursive"); 46 46 assertEquals("http://localhost:8888/relations?relations=19711&mode=recursive", req.args.get("url")); … … 52 52 */ 53 53 @Test 54 publicvoid testBadRequestNoParam() throws Exception {54 void testBadRequestNoParam() throws Exception { 55 55 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 56 56 assertEquals("MalformedURLException: null", e.getMessage()); … … 62 62 */ 63 63 @Test 64 publicvoid testBadRequestInvalidUrl() throws Exception {64 void testBadRequestInvalidUrl() throws Exception { 65 65 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle()); 66 66 assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage()); … … 72 72 */ 73 73 @Test 74 publicvoid testBadRequestIncompleteUrl() throws Exception {74 void testBadRequestIncompleteUrl() throws Exception { 75 75 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 76 76 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 82 82 */ 83 83 @Test 84 publicvoid testNominalRequest() throws Exception {84 void testNominalRequest() throws Exception { 85 85 String url = new File(TestUtils.getRegressionDataFile(11957, "data.osm")).toURI().toURL().toExternalForm(); 86 86 try { -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link LoadAndZoomHandler} class. 17 17 */ 18 publicclass LoadAndZoomHandlerTest {18 class LoadAndZoomHandlerTest { 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 test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testBadRequestNoParam() throws Exception {38 void testBadRequestNoParam() throws Exception { 39 39 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 40 40 assertEquals("NumberFormatException (empty String)", e.getMessage()); … … 46 46 */ 47 47 @Test 48 publicvoid testBadRequestInvalidUrl() throws Exception {48 void testBadRequestInvalidUrl() throws Exception { 49 49 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 50 50 assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage()); … … 56 56 */ 57 57 @Test 58 publicvoid testBadRequestIncompleteUrl() throws Exception {58 void testBadRequestIncompleteUrl() throws Exception { 59 59 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 60 60 assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage()); … … 66 66 */ 67 67 @Test 68 publicvoid testNominalRequest() throws Exception {68 void testNominalRequest() throws Exception { 69 69 assertDoesNotThrow(() -> newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle()); 70 70 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link LoadObjectHandler} class. 17 17 */ 18 publicclass LoadObjectHandlerTest {18 class LoadObjectHandlerTest { 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 test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testBadRequestNoParam() {37 void testBadRequestNoParam() { 38 38 assertDoesNotThrow(() -> newHandler(null).handle()); 39 39 } … … 43 43 */ 44 44 @Test 45 publicvoid testBadRequestInvalidUrl() {45 void testBadRequestInvalidUrl() { 46 46 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 47 47 assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage()); … … 52 52 */ 53 53 @Test 54 publicvoid testBadRequestIncompleteUrl() {54 void testBadRequestIncompleteUrl() { 55 55 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 56 56 assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage()); … … 61 61 */ 62 62 @Test 63 publicvoid testNominalRequest() {63 void testNominalRequest() { 64 64 assertDoesNotThrow(() -> newHandler("https://localhost?objects=foo,bar").handle()); 65 65 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java
r12558 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 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.util.Collections; … … 8 9 import java.util.Map; 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.io.remotecontrol.PermissionPrefWithDefault; 13 14 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; … … 19 20 * Unit tests of {@link RequestHandler} class. 20 21 */ 21 publicclass RequestHandlerTest {22 class RequestHandlerTest { 22 23 23 24 /** 24 25 * Setup test. 25 26 */ 26 @R ule27 @RegisterExtension 27 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 29 public JOSMTestRules test = new JOSMTestRules(); … … 62 63 */ 63 64 @Test 64 publicvoid testRequestParameter1() throws RequestHandlerBadRequestException {65 void testRequestParameter1() throws RequestHandlerBadRequestException { 65 66 final Map<String, String> expected = new HashMap<>(); 66 67 expected.put("query", "a"); … … 74 75 */ 75 76 @Test 76 publicvoid testRequestParameter2() throws RequestHandlerBadRequestException {77 void testRequestParameter2() throws RequestHandlerBadRequestException { 77 78 assertEquals(Collections.singletonMap("query", "a&b==c"), 78 79 getRequestParameter("http://example.com/?query=a%26b==c")); … … 84 85 */ 85 86 @Test 86 publicvoid testRequestParameter3() throws RequestHandlerBadRequestException {87 void testRequestParameter3() throws RequestHandlerBadRequestException { 87 88 assertEquals(Collections.singleton("blue+light blue"), 88 89 getRequestParameter("http://example.com/blue+light%20blue?blue%2Blight+blue").keySet()); … … 96 97 */ 97 98 @Test 98 publicvoid testRequestParameter4() throws RequestHandlerBadRequestException {99 void testRequestParameter4() throws RequestHandlerBadRequestException { 99 100 assertEquals(Collections.singletonMap("/?:@-._~!$'()* ,;", "/?:@-._~!$'()* ,;=="), getRequestParameter( 100 101 "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$'()*+,;=/?:@-._~!$'()*+,;==#/?:@-._~!$&'()*+,;=" … … 107 108 */ 108 109 @Test 109 publicvoid testRequestParameter5() throws RequestHandlerBadRequestException {110 void testRequestParameter5() throws RequestHandlerBadRequestException { 110 111 final Map<String, String> expected = new HashMap<>(); 111 112 expected.put("space", " "); … … 119 120 */ 120 121 @Test 121 publicvoid testRequestParameter6() throws RequestHandlerBadRequestException {122 void testRequestParameter6() throws RequestHandlerBadRequestException { 122 123 final Map<String, String> expected = new HashMap<>(); 123 124 expected.put("addtags", "wikipedia:de=Weiße_Gasse|maxspeed=5"); … … 135 136 /** 136 137 * Test request parameter - invalid case 137 * @throws RequestHandlerBadRequestException always138 138 */ 139 @Test(expected = RequestHandlerBadRequestException.class) 140 public void testRequestParameterInvalid() throws RequestHandlerBadRequestException { 141 getRequestParameter("http://localhost:8111/load_and_zoom"+ 139 @Test 140 void testRequestParameterInvalid() { 141 assertThrows(RequestHandlerBadRequestException.class, 142 () -> getRequestParameter("http://localhost:8111/load_and_zoom"+ 142 143 "?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5"+ 143 144 "&select=way23071688,way23076176,way23076177,"+ 144 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325") ;145 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325")); 145 146 } 146 147 } -
trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io.rtklib; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; … … 12 12 import java.util.TimeZone; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 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; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 18 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 27 27 * Unit tests of {@link RtkLibPosReader} class. 28 28 */ 29 publicclass RtkLibPosReaderTest {29 class RtkLibPosReaderTest { 30 30 /** 31 31 * Set the timezone and timeout. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 * Forces the timezone. 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 iso8601.setTimeZone(DateUtils.UTC); … … 57 57 */ 58 58 @Test 59 publicvoid testReader() throws Exception {59 void testReader() throws Exception { 60 60 RtkLibPosReader in = read("nodist/data/rtklib_example.pos"); 61 61 assertEquals(137, in.getNumberOfCoordinates()); … … 83 83 */ 84 84 @Test 85 publicvoid testReader2() throws Exception {85 void testReader2() throws Exception { 86 86 RtkLibPosReader in = read("nodist/data/rtklib_example2.pos"); 87 87 assertEquals(6, in.getNumberOfCoordinates()); -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java
r15070 r17275 2 2 package org.openstreetmap.josm.io.session; 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.io.ByteArrayInputStream; … … 13 13 import java.util.List; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.data.coor.EastNorth; … … 33 33 * Unit tests for Session reading. 34 34 */ 35 publicclass SessionReaderTest {35 class SessionReaderTest { 36 36 37 37 /** 38 38 * Setup tests. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules().projection(); … … 60 60 */ 61 61 @Test 62 publicvoid testReadEmpty() throws IOException, IllegalDataException {62 void testReadEmpty() throws IOException, IllegalDataException { 63 63 assertTrue(testRead("empty.jos").isEmpty()); 64 64 assertTrue(testRead("empty.joz").isEmpty()); … … 71 71 */ 72 72 @Test 73 publicvoid testReadOsm() throws IOException, IllegalDataException {73 void testReadOsm() throws IOException, IllegalDataException { 74 74 for (String file : new String[]{"osm.jos", "osm.joz"}) { 75 75 List<Layer> layers = testRead(file); … … 87 87 */ 88 88 @Test 89 publicvoid testReadGpx() throws IOException, IllegalDataException {89 void testReadGpx() throws IOException, IllegalDataException { 90 90 for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) { 91 91 List<Layer> layers = testRead(file); … … 103 103 */ 104 104 @Test 105 publicvoid testReadGpxAndMarker() throws IOException, IllegalDataException {105 void testReadGpxAndMarker() throws IOException, IllegalDataException { 106 106 List<Layer> layers = testRead("gpx_markers.joz"); 107 107 assertEquals(layers.size(), 2); … … 127 127 */ 128 128 @Test 129 publicvoid testReadImage() throws IOException, IllegalDataException {129 void testReadImage() throws IOException, IllegalDataException { 130 130 final List<Layer> layers = testRead("bing.jos"); 131 131 assertEquals(layers.size(), 1); … … 144 144 */ 145 145 @Test 146 publicvoid testReadNotes() throws IOException, IllegalDataException {146 void testReadNotes() throws IOException, IllegalDataException { 147 147 if (MainApplication.isDisplayingMapView()) { 148 148 for (NoteLayer nl : MainApplication.getLayerManager().getLayersOfType(NoteLayer.class)) { … … 163 163 */ 164 164 @Test 165 publicvoid testTicket17701() throws Exception {165 void testTicket17701() throws Exception { 166 166 try (InputStream in = new ByteArrayInputStream(("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + 167 167 "<josm-session version=\"0.1\">\n" + -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r14138 r17275 10 10 import java.util.Map; 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.data.coor.LatLon; 16 16 import org.openstreetmap.josm.data.gpx.GpxData; … … 38 38 * Unit tests for Session writing. 39 39 */ 40 publicclass SessionWriterTest {40 class SessionWriterTest { 41 41 42 42 protected static final class OsmHeadlessJosExporter extends OsmDataSessionExporter { … … 87 87 * Setup tests. 88 88 */ 89 @R ule89 @RegisterExtension 90 90 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 91 91 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 94 94 * Setup tests. 95 95 */ 96 @Before 96 @BeforeEach 97 97 public void setUp() { 98 98 MainApplication.getLayerManager().addLayer(createOsmLayer()); … … 157 157 */ 158 158 @Test 159 publicvoid testWriteEmptyJos() throws IOException {159 void testWriteEmptyJos() throws IOException { 160 160 testWrite(Collections.<Layer>emptyList(), false); 161 161 } … … 166 166 */ 167 167 @Test 168 publicvoid testWriteEmptyJoz() throws IOException {168 void testWriteEmptyJoz() throws IOException { 169 169 testWrite(Collections.<Layer>emptyList(), true); 170 170 } … … 175 175 */ 176 176 @Test 177 publicvoid testWriteOsmJos() throws IOException {177 void testWriteOsmJos() throws IOException { 178 178 testWrite(Collections.<Layer>singletonList(createOsmLayer()), false); 179 179 } … … 184 184 */ 185 185 @Test 186 publicvoid testWriteOsmJoz() throws IOException {186 void testWriteOsmJoz() throws IOException { 187 187 testWrite(Collections.<Layer>singletonList(createOsmLayer()), true); 188 188 } … … 193 193 */ 194 194 @Test 195 publicvoid testWriteGpxJos() throws IOException {195 void testWriteGpxJos() throws IOException { 196 196 testWrite(Collections.<Layer>singletonList(createGpxLayer()), false); 197 197 } … … 202 202 */ 203 203 @Test 204 publicvoid testWriteGpxJoz() throws IOException {204 void testWriteGpxJoz() throws IOException { 205 205 testWrite(Collections.<Layer>singletonList(createGpxLayer()), true); 206 206 } … … 211 211 */ 212 212 @Test 213 publicvoid testWriteGpxAndMarkerJoz() throws IOException {213 void testWriteGpxAndMarkerJoz() throws IOException { 214 214 GpxLayer gpx = createGpxLayer(); 215 215 testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true); … … 221 221 */ 222 222 @Test 223 publicvoid testWriteImageryLayer() throws IOException {223 void testWriteImageryLayer() throws IOException { 224 224 final Layer layer = createImageryLayer(); 225 225 testWrite(Collections.singletonList(layer), true); … … 231 231 */ 232 232 @Test 233 publicvoid testWriteNoteLayer() throws IOException {233 void testWriteNoteLayer() throws IOException { 234 234 final Layer layer = createNoteLayer(); 235 235 testWrite(Collections.singletonList(layer), true); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginDownloadExceptionTest.java
r12754 r17275 2 2 package org.openstreetmap.josm.plugins; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link PluginDownloadException} class. 14 14 */ 15 publicclass PluginDownloadExceptionTest {15 class PluginDownloadExceptionTest { 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 testPluginDownloadException() {28 void testPluginDownloadException() { 29 29 PluginDownloadException ex = new PluginDownloadException("foo"); 30 30 assertEquals("foo", ex.getMessage()); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginExceptionTest.java
r12754 r17275 2 2 package org.openstreetmap.josm.plugins; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link PluginException} class. 14 14 */ 15 publicclass PluginExceptionTest {15 class PluginExceptionTest { 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 testPluginDownloadException() {28 void testPluginDownloadException() { 29 29 PluginException ex = new PluginException("foo"); 30 30 assertEquals("foo", ex.getMessage()); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java
r16159 r17275 2 2 package org.openstreetmap.josm.plugins; 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.ArrayList; … … 17 17 import javax.swing.JScrollPane; 18 18 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.extension.RegisterExtension; 20 import org.junit.jupiter.api.Test; 21 21 import org.openstreetmap.josm.TestUtils; 22 22 import org.openstreetmap.josm.gui.MainApplication; … … 35 35 * Unit tests of {@link PluginHandler} class. 36 36 */ 37 publicclass PluginHandlerTest {37 class PluginHandlerTest { 38 38 39 39 /** 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(); … … 48 48 */ 49 49 @Test 50 publicvoid testEqualsContract() {50 void testEqualsContract() { 51 51 TestUtils.assumeWorkingEqualsVerifier(); 52 52 EqualsVerifier.forClass(DeprecatedPlugin.class).usingGetClass().verify(); … … 57 57 */ 58 58 @Test 59 publicvoid testBuildListOfPluginsToLoad() {59 void testBuildListOfPluginsToLoad() { 60 60 TestUtils.assumeWorkingJMockit(); 61 61 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker( … … 100 100 */ 101 101 @Test 102 publicvoid testFilterDeprecatedPlugins() {102 void testFilterDeprecatedPlugins() { 103 103 TestUtils.assumeWorkingJMockit(); 104 104 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker( … … 125 125 */ 126 126 @Test 127 publicvoid testFilterUnmaintainedPlugins() {127 void testFilterUnmaintainedPlugins() { 128 128 TestUtils.assumeWorkingJMockit(); 129 129 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker( … … 152 152 */ 153 153 @Test 154 publicvoid testPluginInformationAction() throws PluginException {154 void testPluginInformationAction() throws PluginException { 155 155 TestUtils.assumeWorkingJMockit(); 156 156 final String expectedText = "Ant-Version: Apache Ant 1.9.6\n" + -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r17129 r17275 2 2 package org.openstreetmap.josm.plugins; 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.awt.GraphicsEnvironment; … … 21 21 import java.util.stream.Collectors; 22 22 23 import org.junit.BeforeClass;24 23 import org.junit.ClassRule; 25 import org.junit.Test; 24 import org.junit.jupiter.api.BeforeAll; 25 import org.junit.jupiter.api.Test; 26 26 import org.openstreetmap.josm.TestUtils; 27 27 import org.openstreetmap.josm.data.Preferences; … … 59 59 * @throws IOException in case of I/O error 60 60 */ 61 @Before Class61 @BeforeAll 62 62 public static void beforeClass() throws IOException { 63 63 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(PluginHandlerTestIT.class)); … … 68 68 */ 69 69 @Test 70 publicvoid testValidityOfAvailablePlugins() {70 void testValidityOfAvailablePlugins() { 71 71 loadAllPlugins(); 72 72 … … 109 109 Arrays.toString(layerExceptions.entrySet().toArray()) + '\n' 110 110 + Arrays.toString(noRestartExceptions.entrySet().toArray()); 111 assertTrue( msg, invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty());111 assertTrue(invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty(), msg); 112 112 } 113 113 … … 254 254 // Restore default timeout 255 255 Config.getPref().putInt("socket.timeout.read", defTimeout); 256 assertTrue(pluginDownloadTask.getFailedPlugins(). toString(), pluginDownloadTask.getFailedPlugins().isEmpty());256 assertTrue(pluginDownloadTask.getFailedPlugins().isEmpty(), pluginDownloadTask.getFailedPlugins()::toString); 257 257 assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size()); 258 258 -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginListParseExceptionTest.java
r12754 r17275 2 2 package org.openstreetmap.josm.plugins; 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.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link PluginListParseException} class. 14 14 */ 15 publicclass PluginListParseExceptionTest {15 class PluginListParseExceptionTest { 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 testPluginListParseException() {28 void testPluginListParseException() { 29 29 NullPointerException npe = new NullPointerException(); 30 30 PluginListParseException ex = new PluginListParseException(npe); -
trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.spi.lifecycle; 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 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.JOSMTestRules; 10 10 … … 14 14 * Unit tests of {@link Lifecycle} class. 15 15 */ 16 publicclass LifecycleTest {16 class LifecycleTest { 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().https().devAPI().main().projection(); … … 44 44 */ 45 45 @Test 46 publicvoid testSetInitStatusListener() {46 void testSetInitStatusListener() { 47 47 InitStatusListenerStub listener = new InitStatusListenerStub(); 48 48 Lifecycle.setInitStatusListener(listener); -
trunk/test/unit/org/openstreetmap/josm/spi/preferences/ListListSettingTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.spi.preferences; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Test {@link ListListSetting}. 14 14 */ 15 publicclass ListListSettingTest {15 class ListListSettingTest { 16 16 /** 17 17 * This is a preference test 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testEqualsContract() {27 void testEqualsContract() { 28 28 TestUtils.assumeWorkingEqualsVerifier(); 29 29 EqualsVerifier.forClass(ListListSetting.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/spi/preferences/ListSettingTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.spi.preferences; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Test {@link ListSetting}. 14 14 */ 15 publicclass ListSettingTest {15 class ListSettingTest { 16 16 /** 17 17 * This is a preference test 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testEqualsContract() {27 void testEqualsContract() { 28 28 TestUtils.assumeWorkingEqualsVerifier(); 29 29 EqualsVerifier.forClass(ListSetting.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/spi/preferences/MapListSettingTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.spi.preferences; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Test {@link MapListSetting}. 14 14 */ 15 publicclass MapListSettingTest {15 class MapListSettingTest { 16 16 /** 17 17 * This is a preference test 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testEqualsContract() {27 void testEqualsContract() { 28 28 TestUtils.assumeWorkingEqualsVerifier(); 29 29 EqualsVerifier.forClass(MapListSetting.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/spi/preferences/StringSettingTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.spi.preferences; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Test {@link StringSetting}. 14 14 */ 15 publicclass StringSettingTest {15 class StringSettingTest { 16 16 /** 17 17 * This is a preference test 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 25 25 */ 26 26 @Test 27 publicvoid testEqualsContract() {27 void testEqualsContract() { 28 28 TestUtils.assumeWorkingEqualsVerifier(); 29 29 EqualsVerifier.forClass(StringSetting.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/testutils/ImagePatternMatching.java
r13181 r17275 2 2 package org.openstreetmap.josm.testutils; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.image.BufferedImage; -
trunk/test/unit/org/openstreetmap/josm/testutils/mockers/ExtendedDialogMocker.java
r17090 r17275 2 2 package org.openstreetmap.josm.testutils.mockers; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.Component; -
trunk/test/unit/org/openstreetmap/josm/testutils/mockers/HelpAwareOptionPaneMocker.java
r14332 r17275 2 2 package org.openstreetmap.josm.testutils.mockers; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.Component; -
trunk/test/unit/org/openstreetmap/josm/testutils/mockers/JOptionPaneSimpleMocker.java
r16160 r17275 2 2 package org.openstreetmap.josm.testutils.mockers; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.Component; -
trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.java
r11405 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; … … 8 8 import java.util.List; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 12 12 /** 13 13 * Unit tests of {@link AlphanumComparator}. 14 14 */ 15 publicclass AlphanumComparatorTest {15 class AlphanumComparatorTest { 16 16 17 17 /** … … 19 19 */ 20 20 @Test 21 publicvoid testNumeric() {21 void testNumeric() { 22 22 List<String> lst = Arrays.asList("1", "20", "-1", "00999", "100"); 23 23 Collections.sort(lst, AlphanumComparator.getInstance()); … … 29 29 */ 30 30 @Test 31 publicvoid testMixed() {31 void testMixed() { 32 32 List<String> lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100"); 33 33 Collections.sort(lst, AlphanumComparator.getInstance()); -
trunk/test/unit/org/openstreetmap/josm/tools/CheckParameterUtilTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.tools; 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 … … 12 12 * Unit tests of {@link CheckParameterUtil} class. 13 13 */ 14 publicclass CheckParameterUtilTest {14 class CheckParameterUtilTest { 15 15 16 16 /** 17 17 * Setup rule. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(CheckParameterUtil.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/tools/ColorHelperTest.java
r16319 r17275 2 2 package org.openstreetmap.josm.tools; 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.awt.Color; 8 8 9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 10 11 11 /** 12 12 * Unit tests for class {@link ColorHelper}. 13 13 */ 14 publicclass ColorHelperTest {14 class ColorHelperTest { 15 15 16 16 /** … … 18 18 */ 19 19 @Test 20 publicvoid testHtml2color() {20 void testHtml2color() { 21 21 assertNull(ColorHelper.html2color("")); 22 22 assertNull(ColorHelper.html2color("xyz")); … … 33 33 */ 34 34 @Test 35 publicvoid testColor2html() {35 void testColor2html() { 36 36 assertNull(ColorHelper.color2html(null)); 37 37 assertEquals("#FF0000", ColorHelper.color2html(Color.RED)); … … 46 46 */ 47 47 @Test 48 publicvoid testGetForegroundColor() {48 void testGetForegroundColor() { 49 49 assertNull(ColorHelper.getForegroundColor(null)); 50 50 assertEquals(Color.WHITE, ColorHelper.getForegroundColor(Color.BLACK)); … … 59 59 */ 60 60 @Test 61 publicvoid testColorFloat2int() {61 void testColorFloat2int() { 62 62 assertNull(ColorHelper.float2int(null)); 63 63 assertEquals(255, (int) ColorHelper.float2int(-1.0f)); … … 74 74 */ 75 75 @Test 76 publicvoid testColorInt2float() {76 void testColorInt2float() { 77 77 assertNull(ColorHelper.int2float(null)); 78 78 assertEquals(1.0f, ColorHelper.int2float(-1), 1e-3); … … 89 89 */ 90 90 @Test 91 publicvoid testAlphaMultiply() {91 void testAlphaMultiply() { 92 92 final Color color = new Color(0x12345678, true); 93 93 assertEquals(new Color(0x12345678, true), ColorHelper.alphaMultiply(color, 1f)); … … 99 99 */ 100 100 @Test 101 publicvoid testComplement() {101 void testComplement() { 102 102 assertEquals(Color.cyan, ColorHelper.complement(Color.red)); 103 103 assertEquals(Color.red, ColorHelper.complement(Color.cyan)); -
trunk/test/unit/org/openstreetmap/josm/tools/ColorScaleTest.java
r9669 r17275 2 2 package org.openstreetmap.josm.tools; 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.awt.Color; 8 8 9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 10 11 11 /** 12 12 * Unit tests for class {@link ColorScale}. 13 13 */ 14 publicclass ColorScaleTest {14 class ColorScaleTest { 15 15 16 16 /** … … 18 18 */ 19 19 @Test 20 publicvoid testHSBScale() {20 void testHSBScale() { 21 21 final ColorScale scale = ColorScale.createHSBScale(256); 22 22 assertEquals(new Color(255, 0, 0), scale.getColor(0)); -
trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java
r16407 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; … … 11 11 import java.util.TimeZone; 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.io.ChangesetClosedException; 17 17 import org.openstreetmap.josm.io.IllegalDataException; … … 31 31 * Unit tests of {@link ExceptionUtil} class. 32 32 */ 33 publicclass ExceptionUtilTest {33 class ExceptionUtilTest { 34 34 35 35 /** 36 36 * Setup rule. 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI(); … … 49 49 * @throws Exception in case of error 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void setUp() throws Exception { 53 53 OsmApi api = OsmApi.getOsmApi(); … … 63 63 */ 64 64 @Test 65 publicvoid testExplainBadRequest() {65 void testExplainBadRequest() { 66 66 assertEquals("<html>The OSM server '"+baseUrl+"' reported a bad request.<br></html>", 67 67 ExceptionUtil.explainBadRequest(new OsmApiException(""))); … … 94 94 */ 95 95 @Test 96 publicvoid testExplainBandwidthLimitExceeded() {96 void testExplainBandwidthLimitExceeded() { 97 97 assertEquals("<html>Communication with the OSM server '"+baseUrl+"'failed. "+ 98 98 "The server replied<br>the following error code and the following error message:<br>"+ … … 105 105 */ 106 106 @Test 107 publicvoid testExplainChangesetClosedException() {107 void testExplainChangesetClosedException() { 108 108 assertEquals("<html>Failed to upload to changeset <strong>0</strong><br>because it has already been closed on ?.", 109 109 ExceptionUtil.explainChangesetClosedException(new ChangesetClosedException(""))); … … 117 117 */ 118 118 @Test 119 publicvoid testExplainClientTimeout() {119 void testExplainClientTimeout() { 120 120 assertEquals("<html>Communication with the OSM server '"+baseUrl+"' timed out. Please retry later.</html>", 121 121 ExceptionUtil.explainClientTimeout(new OsmApiException(""))); … … 126 126 */ 127 127 @Test 128 publicvoid testExplainConflict() {128 void testExplainConflict() { 129 129 int code = HttpURLConnection.HTTP_CONFLICT; 130 130 assertEquals("<html>The server reported that it has detected a conflict.</html>", … … 146 146 */ 147 147 @Test 148 publicvoid testExplainException() {148 void testExplainException() { 149 149 assertEquals("ResponseCode=0", 150 150 ExceptionUtil.explainException(new OsmApiException(""))); … … 161 161 */ 162 162 @Test 163 publicvoid testExplainFailedAuthorisation() {163 void testExplainFailedAuthorisation() { 164 164 assertEquals("<html>Authorisation at the OSM server failed.<br>The server reported the following error:<br>"+ 165 165 "'The server replied an error with code 0.'</html>", … … 183 183 */ 184 184 @Test 185 publicvoid testExplainFailedOAuthAuthorisation() {185 void testExplainFailedOAuthAuthorisation() { 186 186 assertEquals("<html>Authorisation at the OSM server with the OAuth token 'null' failed.<br>"+ 187 187 "The token is not authorised to access the protected resource<br>'unknown'.<br>"+ … … 198 198 */ 199 199 @Test 200 publicvoid testExplainFailedBasicAuthentication() {200 void testExplainFailedBasicAuthentication() { 201 201 assertEquals("<html>Authentication at the OSM server with the username '"+user+"' failed.<br>"+ 202 202 "Please check the username and the password in the JOSM preferences.</html>", … … 208 208 */ 209 209 @Test 210 publicvoid testExplainFailedOAuthAuthentication() {210 void testExplainFailedOAuthAuthentication() { 211 211 assertEquals("<html>Authentication at the OSM server with the OAuth token 'null' failed.<br>"+ 212 212 "Please launch the preferences dialog and retrieve another OAuth token.</html>", … … 218 218 */ 219 219 @Test 220 publicvoid testExplainGenericOsmApiException() {220 void testExplainGenericOsmApiException() { 221 221 assertEquals("<html>Communication with the OSM server '"+baseUrl+"'failed. The server replied<br>"+ 222 222 "the following error code and the following error message:<br><strong>Error code:<strong> 0<br>"+ … … 239 239 */ 240 240 @Test 241 publicvoid testExplainGoneForUnknownPrimitive() {241 void testExplainGoneForUnknownPrimitive() { 242 242 assertEquals("<html>The server reports that an object is deleted.<br>"+ 243 243 "<strong>Uploading failed</strong> if you tried to update or delete this object.<br> "+ … … 251 251 */ 252 252 @Test 253 publicvoid testExplainInternalServerError() {253 void testExplainInternalServerError() { 254 254 assertEquals("<html>The OSM server<br>'"+baseUrl+"'<br>reported an internal server error.<br>"+ 255 255 "This is most likely a temporary problem. Please try again later.</html>", … … 261 261 */ 262 262 @Test 263 publicvoid testExplainMissingOAuthAccessTokenException() {263 void testExplainMissingOAuthAccessTokenException() { 264 264 assertEquals("<html>Failed to authenticate at the OSM server 'http://fake.xxx/api'.<br>"+ 265 265 "You are using OAuth to authenticate but currently there is no<br>OAuth Access Token configured.<br>"+ … … 272 272 */ 273 273 @Test 274 publicvoid testExplainNestedIllegalDataException() {274 void testExplainNestedIllegalDataException() { 275 275 assertEquals("<html>Failed to download data. Its format is either unsupported, ill-formed, and/or inconsistent.<br><br>"+ 276 276 "Details (untranslated): null</html>", … … 286 286 */ 287 287 @Test 288 publicvoid testExplainNestedIOException() {288 void testExplainNestedIOException() { 289 289 assertEquals("<html>Failed to upload data to or download data from<br>'"+baseUrl+"'<br>"+ 290 290 "due to a problem with transferring data.<br>Details (untranslated): null</html>", … … 300 300 */ 301 301 @Test 302 publicvoid testExplainNestedSocketException() {302 void testExplainNestedSocketException() { 303 303 assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'.<br>"+ 304 304 "Please check your internet connection.</html>", … … 310 310 */ 311 311 @Test 312 publicvoid testExplainNestedUnknownHostException() {312 void testExplainNestedUnknownHostException() { 313 313 assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'.<br>"+ 314 314 "Host name '"+host+"' could not be resolved. <br>"+ … … 321 321 */ 322 322 @Test 323 publicvoid testExplainNotFound() {323 void testExplainNotFound() { 324 324 assertEquals("<html>The OSM server '"+baseUrl+"' does not know about an object<br>"+ 325 325 "you tried to read, update, or delete. Either the respective object<br>"+ … … 333 333 */ 334 334 @Test 335 publicvoid testExplainOfflineAccessException() {335 void testExplainOfflineAccessException() { 336 336 assertEquals("<html>Failed to download data.<br><br>Details: null</html>", 337 337 ExceptionUtil.explainOfflineAccessException(new OsmApiException(""))); … … 344 344 */ 345 345 @Test 346 publicvoid testExplainOsmApiInitializationException() {346 void testExplainOsmApiInitializationException() { 347 347 assertEquals("<html>Failed to initialize communication with the OSM server "+serverUrl+".<br>"+ 348 348 "Check the server URL in your preferences and your internet connection.</html>", … … 354 354 */ 355 355 @Test 356 publicvoid testExplainOsmTransferException() {356 void testExplainOsmTransferException() { 357 357 assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'<br>"+ 358 358 "for security reasons. This is most likely because you are running<br>"+ … … 410 410 */ 411 411 @Test 412 publicvoid testExplainPreconditionFailed() {412 void testExplainPreconditionFailed() { 413 413 int code = HttpURLConnection.HTTP_PRECON_FAILED; 414 414 assertEquals("<html>Uploading to the server <strong>failed</strong> because your current<br>dataset violates a precondition.<br>"+ -
trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.tools; 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.File; … … 12 12 import java.util.Date; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 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; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * @since 6209 28 28 */ 29 publicclass ExifReaderTest {29 class ExifReaderTest { 30 30 /** 31 31 * Set the timezone and timeout. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 * Setup test 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 directionSampleFile = new File("nodist/data/exif-example_direction.jpg"); … … 51 51 */ 52 52 @Test 53 publicvoid testReadTime() throws ParseException {53 void testReadTime() throws ParseException { 54 54 Date date = ExifReader.readTime(directionSampleFile); 55 55 doTest("2010-05-15T17:12:05.000", date); … … 61 61 */ 62 62 @Test 63 publicvoid testReadTimeSubSecond1() throws ParseException {63 void testReadTimeSubSecond1() throws ParseException { 64 64 Date date = ExifReader.readTime(new File("nodist/data/IMG_20150711_193419.jpg")); 65 65 doTest("2015-07-11T19:34:19.100", date); … … 78 78 */ 79 79 @Test 80 publicvoid testReadOrientation() {80 void testReadOrientation() { 81 81 Integer orientation = ExifReader.readOrientation(orientationSampleFile); 82 82 assertEquals(Integer.valueOf(6), orientation); … … 87 87 */ 88 88 @Test 89 publicvoid testReadLatLon() {89 void testReadLatLon() { 90 90 LatLon latlon = ExifReader.readLatLon(directionSampleFile); 91 91 assertNotNull(latlon); … … 99 99 */ 100 100 @Test 101 publicvoid testReadDirection() {101 void testReadDirection() { 102 102 assertEquals(Double.valueOf(46.5), ExifReader.readDirection(directionSampleFile)); 103 103 } … … 107 107 */ 108 108 @Test 109 publicvoid testReadSpeed() {109 void testReadSpeed() { 110 110 assertEquals(Double.valueOf(12.3), ExifReader.readSpeed(new File("nodist/data/exif-example_speed_ele.jpg"))); 111 111 } … … 115 115 */ 116 116 @Test 117 publicvoid testReadElevation() {117 void testReadElevation() { 118 118 assertEquals(Double.valueOf(23.4), ExifReader.readElevation(new File("nodist/data/exif-example_speed_ele.jpg"))); 119 119 } … … 124 124 */ 125 125 @Test 126 publicvoid testTicket11685() throws IOException {126 void testTicket11685() throws IOException { 127 127 doTestFile("2015-11-08T15:33:27.500", 11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"); 128 128 } … … 133 133 */ 134 134 @Test 135 publicvoid testTicket14209() throws IOException {135 void testTicket14209() throws IOException { 136 136 doTestFile("2017-01-16T18:27:00.000", 14209, "0MbEfj1S--.1.jpg"); 137 137 doTestFile("2016-08-13T19:51:13.000", 14209, "7VWFOryj--.1.jpg"); -
trunk/test/unit/org/openstreetmap/josm/tools/FontsManagerTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.Font; 7 7 import java.awt.GraphicsEnvironment; 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.JOSMTestRules; 12 12 … … 17 17 * Unit tests of {@link FontsManager} class. 18 18 */ 19 publicclass FontsManagerTest {19 class FontsManagerTest { 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 testFontsManager() {32 void testFontsManager() { 33 33 FontsManager.initialize(); 34 34 boolean found = false; … … 49 49 */ 50 50 @Test 51 publicvoid testUtilityClass() throws ReflectiveOperationException {51 void testUtilityClass() throws ReflectiveOperationException { 52 52 UtilityClassTestUtil.assertUtilityClassWellDefined(FontsManager.class); 53 53 } -
trunk/test/unit/org/openstreetmap/josm/tools/GeoUrlToBoundsTest.java
r16618 r17275 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 6 import static org.hamcrest.core.Is.is; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 import org.junit. Test;9 import org.junit.jupiter.api.Test; 9 10 10 11 /** 11 12 * Unit tests of {@link GeoUrlToBoundsTest} class. 12 13 */ 13 publicclass GeoUrlToBoundsTest {14 class GeoUrlToBoundsTest { 14 15 15 16 /** … … 17 18 */ 18 19 @Test 19 publicvoid testParse() {20 void testParse() { 20 21 assertThat( 21 22 GeoUrlToBounds.parse("geo:12.34,56.78?z=9"), … … 28 29 */ 29 30 @Test 30 publicvoid testParseWithoutZoom() {31 void testParseWithoutZoom() { 31 32 assertThat( 32 33 GeoUrlToBounds.parse("geo:12.34,56.78"), … … 43 44 */ 44 45 @Test 45 publicvoid testParseCrsUncertainty() {46 void testParseCrsUncertainty() { 46 47 assertThat( 47 48 GeoUrlToBounds.parse("geo:60.00000,17.000000;crs=wgs84"), … … 62 63 */ 63 64 @Test 64 publicvoid testInvalid() {65 void testInvalid() { 65 66 assertThat(GeoUrlToBounds.parse("geo:foo"), nullValue()); 66 67 assertThat(GeoUrlToBounds.parse("geo:foo,bar"), nullValue()); … … 70 71 * Tests parsing null. 71 72 */ 72 @Test (expected = IllegalArgumentException.class)73 publicvoid testNull() {74 GeoUrlToBounds.parse(null);73 @Test 74 void testNull() { 75 assertThrows(IllegalArgumentException.class, () -> GeoUrlToBounds.parse(null)); 75 76 } 76 77 } -
trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java
r15069 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotEquals;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.assertNotEquals; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.io.InputStream; … … 15 15 16 16 import org.junit.Assert; 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.coor.EastNorth; … … 35 35 * Unit tests of {@link Geometry} class. 36 36 */ 37 publicclass GeometryTest {37 class GeometryTest { 38 38 /** 39 39 * Primitives need preferences and projection. 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 47 47 */ 48 48 @Test 49 publicvoid testLineLineIntersection() {49 void testLineLineIntersection() { 50 50 EastNorth p1 = new EastNorth(-9477809.106349014, 1.5392960539974203E7); 51 51 EastNorth p2 = new EastNorth(-9477813.789091509, 1.5392954297092048E7); … … 81 81 */ 82 82 @Test 83 publicvoid testClosedWayArea() throws Exception {83 void testClosedWayArea() throws Exception { 84 84 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm"))) { 85 85 DataSet ds = OsmReader.parseDataSet(in, null); … … 97 97 */ 98 98 @Test 99 publicvoid testMultipolygonArea() throws Exception {99 void testMultipolygonArea() throws Exception { 100 100 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) { 101 101 DataSet ds = OsmReader.parseDataSet(in, null); … … 112 112 */ 113 113 @Test 114 publicvoid testAreaAndPerimeter() throws Exception {114 void testAreaAndPerimeter() throws Exception { 115 115 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm"))) { 116 116 DataSet ds = OsmReader.parseDataSet(in, null); … … 127 127 */ 128 128 @Test 129 publicvoid testRightAngle() {129 void testRightAngle() { 130 130 Node n1 = new Node(1); 131 131 Node n2 = new Node(2); … … 159 159 */ 160 160 @Test 161 publicvoid testCentroidEN() {161 void testCentroidEN() { 162 162 EastNorth en1 = new EastNorth(100, 200); 163 163 EastNorth en2 = new EastNorth(150, 400); … … 173 173 */ 174 174 @Test 175 publicvoid testPolygonIntersectionTriangles() {175 void testPolygonIntersectionTriangles() { 176 176 Node node1 = new Node(new LatLon(0.0, 1.0)); 177 177 Node node2 = new Node(new LatLon(0.0, 2.0)); … … 204 204 */ 205 205 @Test 206 publicvoid testPolygonIntersectionVShapes() {206 void testPolygonIntersectionVShapes() { 207 207 Node node1 = new Node(new LatLon(1.0, 1.0)); 208 208 Node node2 = new Node(new LatLon(2.0, 2.0)); … … 234 234 */ 235 235 @Test 236 publicvoid testIsPolygonInsideMultiPolygon() {236 void testIsPolygonInsideMultiPolygon() { 237 237 Node node1 = new Node(new LatLon(1.01, 1.0)); 238 238 Node node2 = new Node(new LatLon(1.01, 1.1)); … … 268 268 */ 269 269 @Test 270 publicvoid testFilterInsideMultiPolygon() {270 void testFilterInsideMultiPolygon() { 271 271 Node node1 = new Node(new LatLon(1.01, 1.0)); 272 272 Node node2 = new Node(new LatLon(1.01, 1.1)); … … 310 310 */ 311 311 @Test 312 publicvoid testGetDistance() {312 void testGetDistance() { 313 313 Node node1 = new Node(new LatLon(0, 0)); 314 314 Node node2 = new Node(new LatLon(0.1, 1)); … … 361 361 */ 362 362 @Test 363 publicvoid testGetClosestPrimitive() {363 void testGetClosestPrimitive() { 364 364 Node node1 = new Node(new LatLon(0, 0)); 365 365 Node node2 = new Node(new LatLon(0.1, 1)); … … 380 380 */ 381 381 @Test 382 publicvoid testGetFurthestPrimitive() {382 void testGetFurthestPrimitive() { 383 383 Node node1 = new Node(new LatLon(0, 0)); 384 384 Node node2 = new Node(new LatLon(0, 1.1)); … … 407 407 */ 408 408 @Test 409 publicvoid testGetClosestWaySegment() {409 void testGetClosestWaySegment() { 410 410 Node node1 = new Node(new LatLon(0, 0)); 411 411 Node node2 = new Node(new LatLon(0, 1)); … … 423 423 */ 424 424 @Test 425 publicvoid testGetDistanceSegmentSegment() {425 void testGetDistanceSegmentSegment() { 426 426 Node node1 = new Node(new LatLon(2.0, 2.0)); 427 427 Node node2 = new Node(new LatLon(2.0, 3.0)); -
trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.java
r11404 r17275 2 2 package org.openstreetmap.josm.tools; 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 8 8 /** 9 9 * Unit tests of {@link I18n}. 10 10 */ 11 publicclass I18nTest {11 class I18nTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testEscape() {17 void testEscape() { 18 18 String foobar = "{foo'bar}"; 19 19 assertEquals("'{'foo''bar'}'", I18n.escape(foobar)); -
trunk/test/unit/org/openstreetmap/josm/tools/ImageResizeModeTest.java
r17151 r17275 8 8 import java.awt.Dimension; 9 9 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.testutils.JOSMTestRules; 13 13 … … 17 17 * Unit tests of {@link ImageResizeMode} class. 18 18 */ 19 publicclass ImageResizeModeTest {19 class ImageResizeModeTest { 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().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testComputeDimensionAuto() {35 void testComputeDimensionAuto() { 36 36 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.AUTO.computeDimension(new Dimension(0, 0), image)); 37 37 assertEquals(new Dimension(64, 48), ImageResizeMode.AUTO.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); … … 47 47 */ 48 48 @Test 49 publicvoid testComputeDimensionBounded() {49 void testComputeDimensionBounded() { 50 50 assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); 51 51 assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(new Dimension(-1, -1), image)); … … 68 68 */ 69 69 @Test 70 publicvoid testComputeDimensionPadded() {70 void testComputeDimensionPadded() { 71 71 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(new Dimension(0, 0), image)); 72 72 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); … … 82 82 */ 83 83 @Test 84 publicvoid testCacheKey() {84 void testCacheKey() { 85 85 assertEquals(0x00180018, ImageResizeMode.AUTO.cacheKey(ImageProvider.ImageSizes.LARGEICON.getImageDimension())); 86 86 assertEquals(0x10180018, ImageResizeMode.BOUNDED.cacheKey(ImageProvider.ImageSizes.LARGEICON.getImageDimension())); -
trunk/test/unit/org/openstreetmap/josm/tools/JosmDecimalFormatSymbolsProviderTest.java
r17155 r17275 2 2 package org.openstreetmap.josm.tools; 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 import static org.junit.Assume.assumeTrue; 7 7 … … 10 10 import java.util.stream.Stream; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 … … 19 19 * Unit tests of {@link JosmDecimalFormatSymbolsProvider}. 20 20 */ 21 publicclass JosmDecimalFormatSymbolsProviderTest {21 class JosmDecimalFormatSymbolsProviderTest { 22 22 23 23 /** 24 24 * Setup rule. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules(); 29 29 30 30 @Test 31 publicvoid testGroupingSeparator() {31 void testGroupingSeparator() { 32 32 System.out.println(Locale.getDefault()); 33 33 assumeTrue(Utils.getJavaVersion() >= 9); … … 47 47 */ 48 48 @Test 49 publicvoid testParseDouble() {49 void testParseDouble() { 50 50 final Locale defLocale = Locale.getDefault(); 51 51 try { -
trunk/test/unit/org/openstreetmap/josm/tools/KeyboardUtilsTest.java
r16643 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.awt.event.KeyEvent; … … 13 13 import java.util.Map.Entry; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 18 … … 22 22 * Unit tests of {@link KeyboardUtils} class. 23 23 */ 24 publicclass KeyboardUtilsTest {24 class KeyboardUtilsTest { 25 25 /** 26 26 * Initializes test. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules rules = new JOSMTestRules(); … … 34 34 */ 35 35 @Test 36 publicvoid testExtendedCharacters() {36 void testExtendedCharacters() { 37 37 Map<Integer, Character> map = new LinkedHashMap<>(); 38 38 KeyboardUtils.addLatinCharacters(map); … … 55 55 */ 56 56 @Test 57 publicvoid testGetCharactersForKeyE00() {57 void testGetCharactersForKeyE00() { 58 58 char deadCircumflex = (char) KeyEvent.VK_DEAD_CIRCUMFLEX; 59 59 char deadCaron = (char) KeyEvent.VK_DEAD_CARON; -
trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java
r15661 r17275 9 9 10 10 import org.junit.Assert; 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.JOSMTestRules; 14 14 … … 18 18 * Unit tests of {@link LanguageInfo}. 19 19 */ 20 publicclass LanguageInfoTest {20 class LanguageInfoTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().i18n("ca@valencia"); … … 42 42 */ 43 43 @Test 44 publicvoid testWikiLanguagePrefix() {44 void testWikiLanguagePrefix() { 45 45 testGetWikiLanguagePrefixes(LanguageInfo.LocaleType.DEFAULT, 46 46 "En:", "De:", "Pt_BR:", "Ca-Valencia:", "Zh_CN:", "Zh_TW:", "Ast:", "En_GB:", "Ru:", "Nb:"); … … 66 66 */ 67 67 @Test 68 publicvoid testGetLocale() {68 void testGetLocale() { 69 69 Assert.assertEquals(RU, LanguageInfo.getLocale("ru")); 70 70 Assert.assertEquals(EN_GB, LanguageInfo.getLocale("en_GB")); … … 79 79 */ 80 80 @Test 81 publicvoid testGetJOSMLocaleCode() {81 void testGetJOSMLocaleCode() { 82 82 Assert.assertEquals("de", LanguageInfo.getJOSMLocaleCode(DE_DE)); 83 83 Assert.assertEquals("pt_BR", LanguageInfo.getJOSMLocaleCode(PT_BR)); … … 89 89 */ 90 90 @Test 91 publicvoid testGetJavaLocaleCode() {91 void testGetJavaLocaleCode() { 92 92 Assert.assertEquals("ca__valencia", LanguageInfo.getJavaLocaleCode("ca@valencia")); 93 93 } … … 97 97 */ 98 98 @Test 99 publicvoid testGetLanguageCodeXML() {99 void testGetLanguageCodeXML() { 100 100 Assert.assertEquals("ca-valencia.", LanguageInfo.getLanguageCodeXML()); 101 101 } … … 105 105 */ 106 106 @Test 107 publicvoid testGetLanguageCodeManifest() {107 void testGetLanguageCodeManifest() { 108 108 Assert.assertEquals("ca-valencia_", LanguageInfo.getLanguageCodeManifest()); 109 109 } … … 113 113 */ 114 114 @Test 115 publicvoid testGetLanguageCodes() {115 void testGetLanguageCodes() { 116 116 Assert.assertEquals(Arrays.asList("ca_ES@valencia", "ca@valencia", "ca_ES", "ca"), LanguageInfo.getLanguageCodes(CA_ES_VALENCIA)); 117 117 } -
trunk/test/unit/org/openstreetmap/josm/tools/ListenableWeakReferenceTest.java
r12181 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertSame;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 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.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 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.testutils.JOSMTestRules; 13 13 … … 19 19 * @since 12181 20 20 */ 21 publicclass ListenableWeakReferenceTest {21 class ListenableWeakReferenceTest { 22 22 /** 23 23 * Default test rules. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 34 34 */ 35 35 @Test 36 publicvoid testOnDereference() throws InterruptedException {36 void testOnDereference() throws InterruptedException { 37 37 object = new Object(); 38 38 called = false; -
trunk/test/unit/org/openstreetmap/josm/tools/LoggingTest.java
r16945 r17275 2 2 package org.openstreetmap.josm.tools; 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.assertNull;8 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.io.IOException; … … 14 14 import java.util.logging.LogRecord; 15 15 16 import org.junit. After;17 import org.junit. Before;18 import org.junit. Test;16 import org.junit.jupiter.api.AfterEach; 17 import org.junit.jupiter.api.BeforeEach; 18 import org.junit.jupiter.api.Test; 19 19 20 20 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 24 24 * 25 25 */ 26 publicclass LoggingTest {26 class LoggingTest { 27 27 28 28 private LogRecord captured; … … 46 46 * @throws SecurityException if a security error occurs 47 47 */ 48 @Before 48 @BeforeEach 49 49 public void setUp() throws SecurityException { 50 50 captured = null; … … 55 55 * @throws SecurityException if a security error occurs 56 56 */ 57 @After 57 @AfterEach 58 58 public void tearDown() throws SecurityException { 59 59 Logging.getLogger().removeHandler(handler); … … 64 64 */ 65 65 @Test 66 publicvoid testSetLogLevel() {66 void testSetLogLevel() { 67 67 Logging.setLogLevel(Logging.LEVEL_DEBUG); 68 68 assertEquals(Logging.LEVEL_DEBUG, Logging.getLogger().getLevel()); … … 95 95 */ 96 96 @Test 97 publicvoid testErrorString() {97 void testErrorString() { 98 98 testLogCaptured(Logging.LEVEL_ERROR, "test", () -> Logging.error("test")); 99 99 } … … 103 103 */ 104 104 @Test 105 publicvoid testErrorStringObjectArray() {105 void testErrorStringObjectArray() { 106 106 testLogCaptured(Logging.LEVEL_ERROR, "test x 1", () -> Logging.error("test {0} {1}", "x", 1)); 107 107 } … … 111 111 */ 112 112 @Test 113 publicvoid testWarnString() {113 void testWarnString() { 114 114 testLogCaptured(Logging.LEVEL_WARN, "test", () -> Logging.warn("test")); 115 115 } … … 119 119 */ 120 120 @Test 121 publicvoid testWarnStringObjectArray() {121 void testWarnStringObjectArray() { 122 122 testLogCaptured(Logging.LEVEL_WARN, "test x 1", () -> Logging.warn("test {0} {1}", "x", 1)); 123 123 } … … 127 127 */ 128 128 @Test 129 publicvoid testInfoString() {129 void testInfoString() { 130 130 testLogCaptured(Logging.LEVEL_INFO, "test", () -> Logging.info("test")); 131 131 } … … 135 135 */ 136 136 @Test 137 publicvoid testInfoStringObjectArray() {137 void testInfoStringObjectArray() { 138 138 testLogCaptured(Logging.LEVEL_INFO, "test x 1", () -> Logging.info("test {0} {1}", "x", 1)); 139 139 } … … 143 143 */ 144 144 @Test 145 publicvoid testDebugString() {145 void testDebugString() { 146 146 testLogCaptured(Logging.LEVEL_DEBUG, "test", () -> Logging.debug("test")); 147 147 } … … 151 151 */ 152 152 @Test 153 publicvoid testDebugStringObjectArray() {153 void testDebugStringObjectArray() { 154 154 testLogCaptured(Logging.LEVEL_DEBUG, "test x 1", () -> Logging.debug("test {0} {1}", "x", 1)); 155 155 } … … 159 159 */ 160 160 @Test 161 publicvoid testTraceString() {161 void testTraceString() { 162 162 testLogCaptured(Logging.LEVEL_TRACE, "test", () -> Logging.trace("test")); 163 163 } … … 167 167 */ 168 168 @Test 169 publicvoid testTraceStringObjectArray() {169 void testTraceStringObjectArray() { 170 170 testLogCaptured(Logging.LEVEL_TRACE, "test x 1", () -> Logging.trace("test {0} {1}", "x", 1)); 171 171 } … … 175 175 */ 176 176 @Test 177 publicvoid testLogLevelThrowable() {177 void testLogLevelThrowable() { 178 178 testLogCaptured(Logging.LEVEL_ERROR, "java.io.IOException: x", () -> Logging.log(Logging.LEVEL_ERROR, new IOException("x"))); 179 179 … … 185 185 */ 186 186 @Test 187 publicvoid testLogLevelStringThrowable() {187 void testLogLevelStringThrowable() { 188 188 testLogCaptured(Logging.LEVEL_ERROR, "y: java.io.IOException: x", () -> Logging.log(Logging.LEVEL_ERROR, "y", new IOException("x"))); 189 189 … … 195 195 */ 196 196 @Test 197 publicvoid testLogWithStackTraceLevelThrowable() {197 void testLogWithStackTraceLevelThrowable() { 198 198 Consumer<String> test = string -> { 199 199 assertTrue(string.startsWith("java.io.IOException: x")); … … 215 215 */ 216 216 @Test 217 publicvoid testLogWithStackTraceLevelStringThrowable() {217 void testLogWithStackTraceLevelStringThrowable() { 218 218 Consumer<String> test = string -> { 219 219 assertTrue(string.startsWith("y: java.io.IOException: x")); … … 228 228 */ 229 229 @Test 230 publicvoid testIsLoggingEnabled() {230 void testIsLoggingEnabled() { 231 231 Logging.setLogLevel(Logging.LEVEL_ERROR); 232 232 assertTrue(Logging.isLoggingEnabled(Logging.LEVEL_ERROR)); … … 247 247 */ 248 248 @Test 249 publicvoid testClearLastErrorAndWarnings() {249 void testClearLastErrorAndWarnings() { 250 250 Logging.setLogLevel(Logging.LEVEL_WARN); 251 251 Logging.clearLastErrorAndWarnings(); … … 261 261 */ 262 262 @Test 263 publicvoid testGetLastErrorAndWarnings() {263 void testGetLastErrorAndWarnings() { 264 264 Logging.setLogLevel(Logging.LEVEL_WARN); 265 265 Logging.clearLastErrorAndWarnings(); … … 267 267 268 268 assertEquals(1, Logging.getLastErrorAndWarnings().size()); 269 assertTrue(Logging.getLastErrorAndWarnings(). toString(), Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"));269 assertTrue(Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"), Logging.getLastErrorAndWarnings()::toString); 270 270 271 271 Logging.setLogLevel(Logging.LEVEL_ERROR); … … 277 277 278 278 assertEquals(2, Logging.getLastErrorAndWarnings().size()); 279 assertTrue(Logging.getLastErrorAndWarnings(). toString(), Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"));280 assertTrue(Logging.getLastErrorAndWarnings(). toString(), Logging.getLastErrorAndWarnings().get(1).endsWith("E: y"));279 assertTrue(Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"), Logging.getLastErrorAndWarnings()::toString); 280 assertTrue(Logging.getLastErrorAndWarnings().get(1).endsWith("E: y"), Logging.getLastErrorAndWarnings()::toString); 281 281 282 282 // limit somewhere reasonable -
trunk/test/unit/org/openstreetmap/josm/tools/MediawikiTest.java
r16988 r17275 2 2 package org.openstreetmap.josm.tools; 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 8 8 /** 9 9 * Unit tests of {@link Mediawiki}. 10 10 */ 11 publicclass MediawikiTest {11 class MediawikiTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testImageUrl() {17 void testImageUrl() { 18 18 assertEquals("https://upload.wikimedia.org/wikipedia/commons/1/18/OpenJDK_logo.svg", 19 19 Mediawiki.getImageUrl("https://upload.wikimedia.org/wikipedia/commons", "OpenJDK_logo.svg")); -
trunk/test/unit/org/openstreetmap/josm/tools/MemoryManagerTest.java
r10717 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertSame; 7 import static org.junit.Assert.assertTrue; 8 import static org.junit.Assert.fail; 4 import static org.junit.jupiter.api.Assertions.fail; 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.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 10 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.JOSMTestRules; 15 16 import org.openstreetmap.josm.tools.MemoryManager.MemoryHandle; … … 26 27 * Base test environment 27 28 */ 28 @R ule29 @RegisterExtension 29 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 31 public JOSMTestRules test = new JOSMTestRules().memoryManagerLeaks(); … … 35 36 */ 36 37 @Test 37 publicvoid testUseMemory() throws NotEnoughMemoryException {38 void testUseMemory() throws NotEnoughMemoryException { 38 39 MemoryManager manager = MemoryManager.getInstance(); 39 40 long available = manager.getAvailableMemory(); … … 59 60 * @throws NotEnoughMemoryException if there is not enough memory 60 61 */ 61 @Test (expected = IllegalStateException.class)62 publicvoid testUseAfterFree() throws NotEnoughMemoryException {62 @Test 63 void testUseAfterFree() throws NotEnoughMemoryException { 63 64 MemoryManager manager = MemoryManager.getInstance(); 64 65 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 65 66 testMemory.free(); 66 testMemory.get();67 assertThrows(IllegalStateException.class, () -> testMemory.get()); 67 68 } 68 69 … … 71 72 * @throws NotEnoughMemoryException if there is not enough memory 72 73 */ 73 @Test (expected = IllegalStateException.class)74 publicvoid testFreeAfterFree() throws NotEnoughMemoryException {74 @Test 75 void testFreeAfterFree() throws NotEnoughMemoryException { 75 76 MemoryManager manager = MemoryManager.getInstance(); 76 77 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 77 78 testMemory.free(); 78 testMemory.free();79 assertThrows(IllegalStateException.class, () -> testMemory.free()); 79 80 } 80 81 … … 83 84 * @throws NotEnoughMemoryException always 84 85 */ 85 @Test (expected = NotEnoughMemoryException.class)86 publicvoid testAllocationFails() throws NotEnoughMemoryException {86 @Test 87 void testAllocationFails() throws NotEnoughMemoryException { 87 88 MemoryManager manager = MemoryManager.getInstance(); 88 89 long available = manager.getAvailableMemory(); 89 90 90 manager.allocateMemory("test", available + 1, () -> {91 assertThrows(NotEnoughMemoryException.class, () -> manager.allocateMemory("test", available + 1, () -> { 91 92 fail("Should not reach"); 92 93 return null; 93 }) ;94 })); 94 95 } 95 96 … … 98 99 * @throws NotEnoughMemoryException never 99 100 */ 100 @Test (expected = IllegalArgumentException.class)101 publicvoid testSupplierFails() throws NotEnoughMemoryException {101 @Test 102 void testSupplierFails() throws NotEnoughMemoryException { 102 103 MemoryManager manager = MemoryManager.getInstance(); 103 104 104 manager.allocateMemory("test", 1, () -> null);105 assertThrows(IllegalArgumentException.class, () -> manager.allocateMemory("test", 1, () -> null)); 105 106 } 106 107 … … 109 110 */ 110 111 @Test 111 publicvoid testIsAvailable() {112 void testIsAvailable() { 112 113 MemoryManager manager = MemoryManager.getInstance(); 113 114 assertTrue(manager.isAvailable(10)); … … 120 121 * @throws NotEnoughMemoryException never 121 122 */ 122 @Test (expected = IllegalArgumentException.class)123 publicvoid testIsAvailableFails() throws NotEnoughMemoryException {123 @Test 124 void testIsAvailableFails() throws NotEnoughMemoryException { 124 125 MemoryManager manager = MemoryManager.getInstance(); 125 126 126 manager.isAvailable(-10);127 assertThrows(IllegalArgumentException.class, () -> manager.isAvailable(-10)); 127 128 } 128 129 … … 132 133 */ 133 134 @Test 134 publicvoid testResetState() throws NotEnoughMemoryException {135 void testResetState() throws NotEnoughMemoryException { 135 136 MemoryManager manager = MemoryManager.getInstance(); 136 137 assertTrue(manager.resetState().isEmpty()); … … 147 148 * @throws NotEnoughMemoryException if there is not enough memory 148 149 */ 149 @Test (expected = IllegalStateException.class)150 publicvoid testResetStateUseAfterFree() throws NotEnoughMemoryException {150 @Test 151 void testResetStateUseAfterFree() throws NotEnoughMemoryException { 151 152 MemoryManager manager = MemoryManager.getInstance(); 152 153 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 153 154 154 155 assertFalse(manager.resetState().isEmpty()); 155 testMemory.get();156 assertThrows(IllegalStateException.class, () -> testMemory.get()); 156 157 } 157 158 … … 163 164 List<MemoryHandle<?>> hadLeaks = MemoryManager.getInstance().resetState(); 164 165 if (!allowMemoryManagerLeaks) { 165 assertTrue( "Memory manager had leaking memory: " + hadLeaks, hadLeaks.isEmpty());166 assertTrue(hadLeaks.isEmpty(), "Memory manager had leaking memory: " + hadLeaks); 166 167 } 167 168 } -
trunk/test/unit/org/openstreetmap/josm/tools/MultiMapTest.java
r15870 r17275 2 2 package org.openstreetmap.josm.tools; 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.Arrays; … … 13 13 import java.util.Set; 14 14 15 import org.junit. Test;15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 … … 21 21 * Unit tests of {@link MultiMap} class. 22 22 */ 23 publicclass MultiMapTest {23 class MultiMapTest { 24 24 25 25 /** … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 EqualsVerifier.forClass(MultiMap.class).usingGetClass().verify(); … … 36 36 */ 37 37 @Test 38 publicvoid testMultiMap() {38 void testMultiMap() { 39 39 final MultiMap<String, String> map = new MultiMap<>(); 40 40 assertTrue(map.isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/tools/OptionParserTest.java
r16618 r17275 2 2 package org.openstreetmap.josm.tools; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 8 … … 13 13 import java.util.concurrent.atomic.AtomicReference; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 18 import org.openstreetmap.josm.tools.OptionParser.OptionCount; … … 25 25 * @author Michael Zangl 26 26 */ 27 publicclass OptionParserTest {27 class OptionParserTest { 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().i18n(); … … 35 35 // A reason for moving to jupiter... 36 36 @Test 37 publicvoid testEmptyParserRejectsLongopt() {37 void testEmptyParserRejectsLongopt() { 38 38 Exception e = assertThrows(OptionParseException.class, () -> 39 39 new OptionParser("test").parseOptions(Arrays.asList("--long"))); … … 42 42 43 43 @Test 44 publicvoid testEmptyParserRejectsShortopt() {44 void testEmptyParserRejectsShortopt() { 45 45 Exception e = assertThrows(OptionParseException.class, () -> 46 46 new OptionParser("test").parseOptions(Arrays.asList("-s"))); … … 49 49 50 50 @Test 51 publicvoid testParserRejectsWrongShortopt() {51 void testParserRejectsWrongShortopt() { 52 52 Exception e = assertThrows(OptionParseException.class, () -> 53 53 new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "t") … … 57 57 58 58 @Test 59 publicvoid testParserRejectsWrongLongopt() {59 void testParserRejectsWrongLongopt() { 60 60 Exception e = assertThrows(OptionParseException.class, () -> 61 61 new OptionParser("test").addFlagParameter("test", this::nop).parseOptions(Arrays.asList("--wrong"))); … … 64 64 65 65 @Test 66 publicvoid testParserOption() {66 void testParserOption() { 67 67 AtomicReference<String> argFound = new AtomicReference<>(); 68 68 OptionParser parser = new OptionParser("test") … … 74 74 75 75 @Test 76 publicvoid testParserOptionFailsIfMissing() {76 void testParserOptionFailsIfMissing() { 77 77 AtomicReference<String> argFound = new AtomicReference<>(); 78 78 OptionParser parser = new OptionParser("test") … … 84 84 85 85 @Test 86 publicvoid testParserOptionFailsIfMissingArgument() {86 void testParserOptionFailsIfMissingArgument() { 87 87 AtomicReference<String> argFound = new AtomicReference<>(); 88 88 OptionParser parser = new OptionParser("test") … … 94 94 95 95 @Test 96 publicvoid testParserOptionFailsIfMissing2() {96 void testParserOptionFailsIfMissing2() { 97 97 AtomicReference<String> argFound = new AtomicReference<>(); 98 98 OptionParser parser = new OptionParser("test") … … 104 104 105 105 @Test 106 publicvoid testParserOptionFailsIfTwice() {106 void testParserOptionFailsIfTwice() { 107 107 AtomicReference<String> argFound = new AtomicReference<>(); 108 108 OptionParser parser = new OptionParser("test") … … 114 114 115 115 @Test 116 publicvoid testParserOptionFailsIfTwiceForAlias() {116 void testParserOptionFailsIfTwiceForAlias() { 117 117 AtomicReference<String> argFound = new AtomicReference<>(); 118 118 OptionParser parser = new OptionParser("test") … … 125 125 126 126 @Test 127 publicvoid testOptionalOptionFailsIfTwice() {127 void testOptionalOptionFailsIfTwice() { 128 128 OptionParser parser = new OptionParser("test") 129 129 .addFlagParameter("test", this::nop); … … 133 133 134 134 @Test 135 publicvoid testOptionalOptionFailsIfTwiceForAlias() {135 void testOptionalOptionFailsIfTwiceForAlias() { 136 136 OptionParser parser = new OptionParser("test") 137 137 .addFlagParameter("test", this::nop) … … 142 142 143 143 @Test 144 publicvoid testOptionalOptionFailsIfTwiceForAlias2() {144 void testOptionalOptionFailsIfTwiceForAlias2() { 145 145 OptionParser parser = new OptionParser("test") 146 146 .addFlagParameter("test", this::nop) … … 151 151 152 152 @Test 153 publicvoid testLongArgumentsUsingEqualSign() {153 void testLongArgumentsUsingEqualSign() { 154 154 AtomicReference<String> argFound = new AtomicReference<>(); 155 155 OptionParser parser = new OptionParser("test") … … 173 173 174 174 @Test 175 publicvoid testLongArgumentsMissingOption() {175 void testLongArgumentsMissingOption() { 176 176 OptionParser parser = new OptionParser("test") 177 177 .addArgumentParameter("test", OptionCount.REQUIRED, this::nop); … … 182 182 183 183 @Test 184 publicvoid testLongArgumentsMissingOption2() {184 void testLongArgumentsMissingOption2() { 185 185 OptionParser parser = new OptionParser("test") 186 186 .addArgumentParameter("test", OptionCount.REQUIRED, this::nop); … … 191 191 192 192 @Test 193 publicvoid testShortArgumentsMissingOption() {193 void testShortArgumentsMissingOption() { 194 194 OptionParser parser = new OptionParser("test") 195 195 .addArgumentParameter("test", OptionCount.REQUIRED, this::nop) … … 201 201 202 202 @Test 203 publicvoid testShortArgumentsMissingOption2() {203 void testShortArgumentsMissingOption2() { 204 204 OptionParser parser = new OptionParser("test") 205 205 .addArgumentParameter("test", OptionCount.REQUIRED, this::nop) … … 211 211 212 212 @Test 213 publicvoid testLongFlagHasOption() {213 void testLongFlagHasOption() { 214 214 OptionParser parser = new OptionParser("test") 215 215 .addFlagParameter("test", this::nop); … … 220 220 221 221 @Test 222 publicvoid testShortFlagHasOption() {222 void testShortFlagHasOption() { 223 223 OptionParser parser = new OptionParser("test") 224 224 .addFlagParameter("test", this::nop) … … 230 230 231 231 @Test 232 publicvoid testShortArgumentsUsingEqualSign() {232 void testShortArgumentsUsingEqualSign() { 233 233 AtomicReference<String> argFound = new AtomicReference<>(); 234 234 OptionParser parser = new OptionParser("test") … … 243 243 244 244 @Test 245 publicvoid testMultipleArguments() {245 void testMultipleArguments() { 246 246 AtomicReference<String> argFound = new AtomicReference<>(); 247 247 List<String> multiFound = new ArrayList<>(); … … 266 266 267 267 @Test 268 publicvoid testUseAlternatives() {268 void testUseAlternatives() { 269 269 AtomicReference<String> argFound = new AtomicReference<>(); 270 270 AtomicBoolean usedFlag = new AtomicBoolean(); … … 285 285 286 286 @Test 287 publicvoid testAmbiguousAlternatives() {287 void testAmbiguousAlternatives() { 288 288 AtomicReference<String> argFound = new AtomicReference<>(); 289 289 AtomicBoolean usedFlag = new AtomicBoolean(); … … 300 300 301 301 @Test 302 publicvoid testMultipleShort() {302 void testMultipleShort() { 303 303 AtomicReference<String> argFound = new AtomicReference<>(); 304 304 AtomicBoolean usedFlag = new AtomicBoolean(); … … 328 328 329 329 @Test 330 publicvoid testIllegalOptionName() {330 void testIllegalOptionName() { 331 331 Exception e = assertThrows(IllegalArgumentException.class, () -> 332 332 new OptionParser("test").addFlagParameter("", this::nop)); … … 335 335 336 336 @Test 337 publicvoid testIllegalOptionName2() {337 void testIllegalOptionName2() { 338 338 Exception e = assertThrows(IllegalArgumentException.class, () -> 339 339 new OptionParser("test").addFlagParameter("-", this::nop)); … … 342 342 343 343 @Test 344 publicvoid testIllegalOptionName3() {344 void testIllegalOptionName3() { 345 345 Exception e = assertThrows(IllegalArgumentException.class, () -> 346 346 new OptionParser("test").addFlagParameter("-test", this::nop)); … … 349 349 350 350 @Test 351 publicvoid testIllegalOptionName4() {351 void testIllegalOptionName4() { 352 352 Exception e = assertThrows(IllegalArgumentException.class, () -> 353 353 new OptionParser("test").addFlagParameter("$", this::nop)); … … 356 356 357 357 @Test 358 publicvoid testDuplicateOptionName() {358 void testDuplicateOptionName() { 359 359 Exception e = assertThrows(IllegalArgumentException.class, () -> 360 360 new OptionParser("test").addFlagParameter("test", this::nop).addFlagParameter("test", this::nop)); … … 363 363 364 364 @Test 365 publicvoid testDuplicateOptionName2() {365 void testDuplicateOptionName2() { 366 366 Exception e = assertThrows(IllegalArgumentException.class, () -> 367 367 new OptionParser("test").addFlagParameter("test", this::nop) … … 371 371 372 372 @Test 373 publicvoid testInvalidShortAlias() {373 void testInvalidShortAlias() { 374 374 Exception e = assertThrows(IllegalArgumentException.class, () -> 375 375 new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "$")); … … 378 378 379 379 @Test 380 publicvoid testInvalidShortAlias2() {380 void testInvalidShortAlias2() { 381 381 Exception e = assertThrows(IllegalArgumentException.class, () -> 382 382 new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "")); … … 385 385 386 386 @Test 387 publicvoid testInvalidShortAlias3() {387 void testInvalidShortAlias3() { 388 388 Exception e = assertThrows(IllegalArgumentException.class, () -> 389 389 new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "xx")); … … 392 392 393 393 @Test 394 publicvoid testDuplicateShortAlias() {394 void testDuplicateShortAlias() { 395 395 Exception e = assertThrows(IllegalArgumentException.class, () -> 396 396 new OptionParser("test").addFlagParameter("test", this::nop) … … 402 402 403 403 @Test 404 publicvoid testInvalidShortNoLong() {404 void testInvalidShortNoLong() { 405 405 Exception e = assertThrows(IllegalArgumentException.class, () -> 406 406 new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test2", "t")); -
trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java
r16946 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 5 import org.junit.BeforeClass; 6 import org.junit.Rule; 7 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 8 import java.awt.Dimension; 9 import java.util.EnumSet; 10 11 import javax.swing.ImageIcon; 12 13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 8 16 import org.openstreetmap.josm.JOSMFixture; 9 17 import org.openstreetmap.josm.data.osm.Node; … … 14 22 import org.openstreetmap.josm.tools.OsmPrimitiveImageProvider.Options; 15 23 16 import java.awt.Dimension; 17 import java.util.EnumSet; 18 19 import static org.junit.Assert.assertEquals; 20 import static org.junit.Assert.assertNotNull; 21 import static org.junit.Assert.assertNull; 22 23 import javax.swing.ImageIcon; 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 24 25 25 26 /** 26 27 * Unit tests of {@link OsmPrimitiveImageProvider} 27 28 */ 28 publicclass OsmPrimitiveImageProviderTest {29 class OsmPrimitiveImageProviderTest { 29 30 30 31 /** 31 32 * Setup test. 32 33 */ 33 @R ule34 @RegisterExtension 34 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 36 public JOSMTestRules test = new JOSMTestRules().mapStyles().presets(); … … 38 39 * Setup test. 39 40 */ 40 @Before Class41 @BeforeAll 41 42 public static void setUp() { 42 43 JOSMFixture.createUnitTestFixture().init(); … … 47 48 */ 48 49 @Test 49 publicvoid testGetResource() {50 void testGetResource() { 50 51 TaggingPresetsTest.waitForIconLoading(TaggingPresets.getTaggingPresets()); 51 52 … … 67 68 */ 68 69 @Test 69 publicvoid testGetResourceNonSquare() {70 void testGetResourceNonSquare() { 70 71 final ImageIcon bankIcon = OsmPrimitiveImageProvider 71 72 .getResource(OsmUtils.createPrimitive("node amenity=bank"), Options.DEFAULT) -
trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java
r12802 r17275 3 3 4 4 import org.junit.Assert; 5 import org.junit. Rule;6 import org.junit. Test;5 import org.junit.jupiter.api.extension.RegisterExtension; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.data.Bounds; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Unit tests of {@link OsmUrlToBounds} class. 14 14 */ 15 publicclass OsmUrlToBoundsTest {15 class OsmUrlToBoundsTest { 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 testPositionToBounds() {28 void testPositionToBounds() { 29 29 Assert.assertEquals(new Bounds(51.7167359, 8.7573485, 51.720724, 8.7659315), 30 30 OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)); … … 91 91 */ 92 92 @Test 93 publicvoid testParse() {93 void testParse() { 94 94 for (ParseTestItem item : parseTestData) { 95 95 Bounds bounds = null; … … 108 108 */ 109 109 @Test 110 publicvoid testGetZoom() {110 void testGetZoom() { 111 111 Assert.assertEquals(4, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(0, 0, 4))); 112 112 Assert.assertEquals(10, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(5, 5, 10))); -
trunk/test/unit/org/openstreetmap/josm/tools/PairTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import org.junit. Test;4 import org.junit.jupiter.api.Test; 5 5 import org.openstreetmap.josm.TestUtils; 6 6 … … 11 11 * Unit tests of {@link Pair} class. 12 12 */ 13 publicclass PairTest {13 class PairTest { 14 14 15 15 /** … … 17 17 */ 18 18 @Test 19 publicvoid testEqualsContract() {19 void testEqualsContract() { 20 20 TestUtils.assumeWorkingEqualsVerifier(); 21 21 EqualsVerifier.forClass(Pair.class).suppress(Warning.NONFINAL_FIELDS).verify(); -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java
r15469 r17275 2 2 package org.openstreetmap.josm.tools; 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 import static org.junit.jupiter.api.Assumptions.assumeTrue; 8 9 9 10 import java.io.File; 10 11 import java.io.IOException; 11 12 12 import org.junit.Assume; 13 import org.junit.BeforeClass; 14 import org.junit.Test; 13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.JOSMFixture; 16 16 import org.openstreetmap.josm.spi.preferences.Config; … … 19 19 * Unit tests of {@link PlatformHookOsx} class. 20 20 */ 21 publicclass PlatformHookOsxTest {21 class PlatformHookOsxTest { 22 22 23 23 static PlatformHookOsx hook; … … 26 26 * Setup test. 27 27 */ 28 @Before Class28 @BeforeAll 29 29 public static void setUp() { 30 30 JOSMFixture.createUnitTestFixture().init(); … … 36 36 */ 37 37 @Test 38 publicvoid testStartupHook() {38 void testStartupHook() { 39 39 hook.startupHook((a, b, c, d) -> System.out.println("callback")); 40 40 } … … 44 44 */ 45 45 @Test 46 publicvoid testAfterPrefStartupHook() {46 void testAfterPrefStartupHook() { 47 47 hook.afterPrefStartupHook(); 48 48 } … … 53 53 */ 54 54 @Test 55 publicvoid testOpenUrl() throws IOException {56 Assume.assumeTrue(PlatformManager.isPlatformOsx());55 void testOpenUrl() throws IOException { 56 assumeTrue(PlatformManager.isPlatformOsx()); 57 57 hook.openUrl(Config.getUrls().getJOSMWebsite()); 58 58 } … … 62 62 */ 63 63 @Test 64 publicvoid testGetDefaultCacheDirectory() {64 void testGetDefaultCacheDirectory() { 65 65 File cache = hook.getDefaultCacheDirectory(); 66 66 assertNotNull(cache); … … 74 74 */ 75 75 @Test 76 publicvoid testGetDefaultPrefDirectory() {76 void testGetDefaultPrefDirectory() { 77 77 File cache = hook.getDefaultPrefDirectory(); 78 78 assertNotNull(cache); … … 86 86 */ 87 87 @Test 88 publicvoid testGetDefaultStyle() {88 void testGetDefaultStyle() { 89 89 assertEquals("com.apple.laf.AquaLookAndFeel", hook.getDefaultStyle()); 90 90 } … … 94 94 */ 95 95 @Test 96 publicvoid testGetOSDescription() {96 void testGetOSDescription() { 97 97 String os = hook.getOSDescription(); 98 98 if (PlatformManager.isPlatformOsx()) { … … 107 107 */ 108 108 @Test 109 publicvoid testInitSystemShortcuts() {109 void testInitSystemShortcuts() { 110 110 hook.initSystemShortcuts(); 111 111 } -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java
r15480 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.StringReader; … … 10 10 import javax.json.Json; 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.testutils.JOSMTestRules; 15 15 … … 19 19 * Integration tests of {@link PlatformHook} class. 20 20 */ 21 publicclass PlatformHookTestIT {21 class PlatformHookTestIT { 22 22 23 23 /** 24 24 * Setup rule 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testLatestUbuntuVersion() throws Exception {35 void testLatestUbuntuVersion() throws Exception { 36 36 String latestUbuntuVersion = Json.createReader(new StringReader(HttpClient.create( 37 37 new URL("https://api.launchpad.net/devel/ubuntu/series")).connect().fetchContent())) 38 38 .readObject().getJsonArray("entries").getJsonObject(0).getString("name"); 39 assertEquals(latestUbuntuVersion, HttpURLConnection.HTTP_OK, HttpClient.create( 40 new URL("https://josm.openstreetmap.de/apt/dists/" + latestUbuntuVersion + '/')).connect().getResponseCode()); 39 assertEquals(HttpURLConnection.HTTP_OK, HttpClient.create( 40 new URL("https://josm.openstreetmap.de/apt/dists/" + latestUbuntuVersion + '/')).connect().getResponseCode(), 41 latestUbuntuVersion); 41 42 } 42 43 } -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookWindowsTest.java
r17126 r17275 30 30 * Unit tests of {@link PlatformHookWindows} class. 31 31 */ 32 publicclass PlatformHookWindowsTest {32 class PlatformHookWindowsTest { 33 33 34 34 /** … … 53 53 */ 54 54 @Test 55 publicvoid testStartupHook() {55 void testStartupHook() { 56 56 hook.startupHook((a, b, c, d) -> System.out.println("callback")); 57 57 } … … 62 62 */ 63 63 @Test 64 publicvoid testGetRootKeystore() throws Exception {64 void testGetRootKeystore() throws Exception { 65 65 if (PlatformManager.isPlatformWindows()) { 66 66 assertNotNull(PlatformHookWindows.getRootKeystore()); … … 79 79 */ 80 80 @Test 81 publicvoid testAfterPrefStartupHook() {81 void testAfterPrefStartupHook() { 82 82 hook.afterPrefStartupHook(); 83 83 } … … 89 89 */ 90 90 @Test 91 publicvoid testOpenUrlSuccess(@Mocked final Desktop mockDesktop) throws IOException {91 void testOpenUrlSuccess(@Mocked final Desktop mockDesktop) throws IOException { 92 92 TestUtils.assumeWorkingJMockit(); 93 93 new Expectations() {{ … … 107 107 */ 108 108 @Test 109 publicvoid testOpenUrlFallback(@Mocked final Desktop mockDesktop, @Mocked Runtime anyRuntime) throws IOException {109 void testOpenUrlFallback(@Mocked final Desktop mockDesktop, @Mocked Runtime anyRuntime) throws IOException { 110 110 TestUtils.assumeWorkingJMockit(); 111 111 new Expectations() {{ … … 130 130 */ 131 131 @Test 132 publicvoid testGetAdditionalFonts() {132 void testGetAdditionalFonts() { 133 133 assertFalse(hook.getAdditionalFonts().isEmpty()); 134 134 } … … 138 138 */ 139 139 @Test 140 publicvoid testGetDefaultCacheDirectory() {140 void testGetDefaultCacheDirectory() { 141 141 File cache = hook.getDefaultCacheDirectory(); 142 142 assertNotNull(cache); … … 150 150 */ 151 151 @Test 152 publicvoid testGetDefaultPrefDirectory() {152 void testGetDefaultPrefDirectory() { 153 153 File cache = hook.getDefaultPrefDirectory(); 154 154 assertNotNull(cache); … … 162 162 */ 163 163 @Test 164 publicvoid testGetDefaultStyle() {164 void testGetDefaultStyle() { 165 165 assertEquals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel", hook.getDefaultStyle()); 166 166 } … … 170 170 */ 171 171 @Test 172 publicvoid testGetInstalledFonts() {172 void testGetInstalledFonts() { 173 173 Collection<String> fonts = hook.getInstalledFonts(); 174 174 if (PlatformManager.isPlatformWindows()) { … … 183 183 */ 184 184 @Test 185 publicvoid testGetOSDescription() {185 void testGetOSDescription() { 186 186 String os = hook.getOSDescription(); 187 187 if (PlatformManager.isPlatformWindows()) { … … 196 196 */ 197 197 @Test 198 publicvoid testInitSystemShortcuts() {198 void testInitSystemShortcuts() { 199 199 hook.initSystemShortcuts(); 200 200 } -
trunk/test/unit/org/openstreetmap/josm/tools/RightAndLefthandTrafficTest.java
r16321 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 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.coor.LatLon; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 15 15 * Unit tests of {@link RightAndLefthandTraffic} class. 16 16 */ 17 publicclass RightAndLefthandTrafficTest {17 class RightAndLefthandTrafficTest { 18 18 /** 19 19 * Test rules. 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules rules = new JOSMTestRules().projection().territories(); … … 28 28 */ 29 29 @Test 30 publicvoid testUtilityClass() throws ReflectiveOperationException {30 void testUtilityClass() throws ReflectiveOperationException { 31 31 UtilityClassTestUtil.assertUtilityClassWellDefined(RightAndLefthandTraffic.class); 32 32 } … … 36 36 */ 37 37 @Test 38 publicvoid testIsRightHandTraffic() {38 void testIsRightHandTraffic() { 39 39 check(true, "Paris", 48.8567, 2.3508); 40 40 check(true, "Berlin", 52.5167, 13.383); -
trunk/test/unit/org/openstreetmap/josm/tools/RotationAngleTest.java
r12802 r17275 2 2 package org.openstreetmap.josm.tools; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 7 8 8 9 /** 9 10 * Unit tests of {@link RotationAngle} class. 10 11 */ 11 publicclass RotationAngleTest {12 class RotationAngleTest { 12 13 13 14 private static final double EPSILON = 1e-11; … … 17 18 */ 18 19 @Test 19 publicvoid testParseCardinal() {20 void testParseCardinal() { 20 21 assertEquals(Math.PI, RotationAngle.buildStaticRotation("south").getRotationAngle(null), EPSILON); 21 22 assertEquals(Math.PI, RotationAngle.buildStaticRotation("s").getRotationAngle(null), EPSILON); … … 26 27 * Unit test of method {@link RotationAngle#buildStaticRotation} - wrong parameter. 27 28 */ 28 @Test (expected = IllegalArgumentException.class)29 publicvoid testParseFail() {30 RotationAngle.buildStaticRotation("bad");29 @Test 30 void testParseFail() { 31 assertThrows(IllegalArgumentException.class, () -> RotationAngle.buildStaticRotation("bad")); 31 32 } 32 33 … … 34 35 * Unit test of method {@link RotationAngle#buildStaticRotation} - null handling. 35 36 */ 36 @Test (expected = NullPointerException.class)37 publicvoid testParseNull() {38 RotationAngle.buildStaticRotation(null);37 @Test 38 void testParseNull() { 39 assertThrows(NullPointerException.class, () -> RotationAngle.buildStaticRotation(null)); 39 40 } 40 41 } -
trunk/test/unit/org/openstreetmap/josm/tools/SearchCompilerQueryWizardTest.java
r16413 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit.Assert.assertEquals; 5 6 import org.junit.Ignore; 7 import org.junit.Rule; 8 import org.junit.Test; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 6 7 import org.junit.jupiter.api.Disabled; 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 9 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 11 … … 14 15 * Unit tests of {@link SearchCompilerQueryWizard} class. 15 16 */ 16 publicclass SearchCompilerQueryWizardTest {17 class SearchCompilerQueryWizardTest { 17 18 /** 18 19 * Base test environment is enough 19 20 */ 20 @R ule21 @RegisterExtension 21 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 23 public JOSMTestRules test = new JOSMTestRules().i18n("de"); … … 41 42 */ 42 43 @Test 43 publicvoid testKeyValue() {44 void testKeyValue() { 44 45 assertQueryEquals(" nwr[\"amenity\"=\"drinking_water\"];\n", "amenity=drinking_water"); 45 46 assertQueryEquals(" nwr[\"amenity\"];\n", "amenity=*"); … … 50 51 */ 51 52 @Test 52 publicvoid testKeyNotValue() {53 void testKeyNotValue() { 53 54 assertQueryEquals(" nwr[\"amenity\"!=\"drinking_water\"];\n", "-amenity=drinking_water"); 54 55 assertQueryEquals(" nwr[!\"amenity\"];\n", "-amenity=*"); … … 59 60 */ 60 61 @Test 61 publicvoid testKeyLikeValue() {62 void testKeyLikeValue() { 62 63 assertQueryEquals(" nwr[\"foo\"~\"bar\"];\n", "foo~bar"); 63 64 assertQueryEquals(" nwr[\"foo\"~\"bar\"];\n", "foo~/bar/"); … … 73 74 */ 74 75 @Test 75 publicvoid testOsmBoolean() {76 void testOsmBoolean() { 76 77 assertQueryEquals(" nwr[\"highway\"][\"oneway\"~\"true|yes|1|on\"];\n", "highway=* AND oneway?"); 77 78 assertQueryEquals(" nwr[\"highway\"][\"oneway\"~\"false|no|0|off\"];\n", "highway=* AND -oneway?"); … … 82 83 */ 83 84 @Test 84 publicvoid testBooleanAnd() {85 void testBooleanAnd() { 85 86 assertQueryEquals(" nwr[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n", "foo=bar and baz=42"); 86 87 assertQueryEquals(" nwr[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n", "foo=bar && baz=42"); … … 92 93 */ 93 94 @Test 94 publicvoid testBooleanOr() {95 void testBooleanOr() { 95 96 assertQueryEquals(" nwr[\"foo\"=\"bar\"];\n nwr[\"baz\"=\"42\"];\n", "foo=bar or baz=42"); 96 97 assertQueryEquals(" nwr[\"foo\"=\"bar\"];\n nwr[\"baz\"=\"42\"];\n", "foo=bar | baz=42"); … … 101 102 */ 102 103 @Test 103 publicvoid testBoolean() {104 void testBoolean() { 104 105 assertQueryEquals("" + 105 106 " nwr[\"foo\"][\"baz1\"];\n" + … … 118 119 */ 119 120 @Test 120 publicvoid testType() {121 void testType() { 121 122 assertQueryEquals(" node[\"foo\"=\"bar\"];\n way[\"foo\"=\"bar\"];\n", "foo=bar and (type:node or type:way)"); 122 123 } … … 126 127 */ 127 128 @Test 128 publicvoid testUser() {129 void testUser() { 129 130 assertQueryEquals(" nwr(user:\"foo\");\n nwr(uid:42);\n", "user:foo or user:42"); 130 131 } … … 134 135 */ 135 136 @Test 136 publicvoid testEmpty() {137 void testEmpty() { 137 138 assertQueryEquals(" way[\"foo\"~\"^$\"];\n", "foo=\"\" and type:way"); 138 139 } … … 142 143 */ 143 144 @Test 144 publicvoid testInArea() {145 void testInArea() { 145 146 String query = constructQuery("foo=bar | foo=baz in Innsbruck"); 146 147 assertEquals("" + … … 179 180 */ 180 181 @Test 181 publicvoid testAroundArea() {182 void testAroundArea() { 182 183 final String query = constructQuery("foo=bar | foo=baz around \"Sankt Sigmund im Sellrain\""); 183 184 assertEquals("" + … … 196 197 */ 197 198 @Test 198 publicvoid testGlobal() {199 void testGlobal() { 199 200 final String query = constructQuery("foo=bar global"); 200 201 assertEquals("" + … … 211 212 */ 212 213 @Test 213 publicvoid testInBbox() {214 void testInBbox() { 214 215 assertQueryEquals(" nwr[\"foo\"=\"bar\"];\n", "foo=bar IN BBOX"); 215 216 } … … 219 220 */ 220 221 @Test 221 @ Ignore("preset handling not implemented")222 publicvoid testPreset() {222 @Disabled("preset handling not implemented") 223 void testPreset() { 223 224 assertQueryEquals(" nwr[\"amenity\"=\"hospital\"];\n", "Hospital"); 224 225 } … … 227 228 * Test erroneous value. 228 229 */ 229 @Test (expected = UncheckedParseException.class)230 publicvoid testErroneous() {231 constructQuery("-(foo or bar)");230 @Test 231 void testErroneous() { 232 assertThrows(UncheckedParseException.class, () -> constructQuery("-(foo or bar)")); 232 233 } 233 234 … … 236 237 */ 237 238 @Test 238 publicvoid testTicket19151() {239 void testTicket19151() { 239 240 assertQueryEquals(" relation[\"type\"=\"multipolygon\"][!\"landuse\"][!\"area:highway\"];\n", 240 241 "type:relation and type=multipolygon and -landuse=* and -\"area:highway\"=*"); -
trunk/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java
r17180 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.awt.event.InputEvent; … … 9 9 import javax.swing.KeyStroke; 10 10 11 import org.junit. BeforeClass;12 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.JOSMFixture; 14 14 … … 16 16 * Unit tests of {@link Shortcut} class. 17 17 */ 18 publicclass ShortcutTest {18 class ShortcutTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @Before Class23 @BeforeAll 24 24 public static void setUp() { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 30 30 */ 31 31 @Test 32 publicvoid testMakeTooltip() {32 void testMakeTooltip() { 33 33 final String tooltip = Shortcut.makeTooltip("Foo Bar", KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.SHIFT_DOWN_MASK)); 34 34 if (Platform.determinePlatform() == Platform.OSX) { -
trunk/test/unit/org/openstreetmap/josm/tools/StreamUtilsTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.tools; 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 8 import static org.junit. Assert.assertEquals;8 import static org.junit.jupiter.api.Assertions.assertEquals; 9 9 10 10 import java.util.Arrays; … … 17 17 * Unit tests of {@link StreamUtils} class. 18 18 */ 19 publicclass StreamUtilsTest {19 class StreamUtilsTest { 20 20 21 21 /** 22 22 * Setup rule. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 31 31 */ 32 32 @Test 33 publicvoid testUtilityClass() throws ReflectiveOperationException {33 void testUtilityClass() throws ReflectiveOperationException { 34 34 UtilityClassTestUtil.assertUtilityClassWellDefined(StreamUtils.class); 35 35 } … … 39 39 */ 40 40 @Test 41 publicvoid testReverseStream() {41 void testReverseStream() { 42 42 assertEquals("baz/bar/foo", 43 43 StreamUtils.reversedStream(Arrays.asList("foo", "bar", "baz")).collect(Collectors.joining("/"))); -
trunk/test/unit/org/openstreetmap/josm/tools/StringParserTest.java
r16618 r17275 4 4 import static org.hamcrest.CoreMatchers.is; 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertTrue; 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.Optional; 10 11 11 import org.junit. Test;12 import org.junit.jupiter.api.Test; 12 13 13 14 import net.trajano.commons.testing.UtilityClassTestUtil; … … 16 17 * Unit tests of {@link StringParser} class. 17 18 */ 18 publicclass StringParserTest {19 class StringParserTest { 19 20 20 21 /** … … 24 25 */ 25 26 @Test 26 publicvoid testUtilityClass() throws ReflectiveOperationException {27 void testUtilityClass() throws ReflectiveOperationException { 27 28 UtilityClassTestUtil.assertUtilityClassWellDefined(Utils.class); 28 29 } … … 32 33 */ 33 34 @Test 34 publicvoid testParse() {35 void testParse() { 35 36 assertThat(StringParser.DEFAULT.parse(char.class, "josm"), is('j')); 36 37 assertThat(StringParser.DEFAULT.parse(short.class, "123"), is((short) 123)); … … 44 45 * Tests that {@link StringParser#DEFAULT} is immutable. 45 46 */ 46 @Test (expected = UnsupportedOperationException.class)47 publicvoid testDefaultImmutable() {48 StringParser.DEFAULT.registerParser(String.class, String::valueOf);47 @Test 48 void testDefaultImmutable() { 49 assertThrows(UnsupportedOperationException.class, () -> StringParser.DEFAULT.registerParser(String.class, String::valueOf)); 49 50 } 50 51 … … 53 54 */ 54 55 @Test 55 publicvoid testCopyConstructor() {56 void testCopyConstructor() { 56 57 final StringParser parser = new StringParser(StringParser.DEFAULT).registerParser(boolean.class, "JOSM"::equals); 57 58 assertTrue(StringParser.DEFAULT.parse(boolean.class, "true")); -
trunk/test/unit/org/openstreetmap/josm/tools/Tag2LinkTest.java
r17006 r17275 7 7 8 8 import org.junit.Assert; 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.JOSMTestRules; 12 12 … … 16 16 * Test {@link Tag2Link} 17 17 */ 18 publicclass Tag2LinkTest {18 class Tag2LinkTest { 19 19 20 20 List<String> links = new ArrayList<>(); … … 31 31 * Setup test. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 39 39 */ 40 40 @Test 41 publicvoid testInitialize() {41 void testInitialize() { 42 42 Tag2Link.initialize(); 43 43 Assert.assertTrue("obtains at least 40 rules", Tag2Link.wikidataRules.size() > 40); … … 48 48 */ 49 49 @Test 50 publicvoid testName() {50 void testName() { 51 51 Tag2Link.getLinksForTag("name", "foobar", this::addLink); 52 52 checkLinks("Search on duckduckgo.com // https://duckduckgo.com/?q=foobar", … … 58 58 */ 59 59 @Test 60 publicvoid testWebsite() {60 void testWebsite() { 61 61 Tag2Link.getLinksForTag("website", "http://www.openstreetmap.org/", this::addLink); 62 62 checkLinks("Open openstreetmap.org // http://www.openstreetmap.org/"); … … 73 73 */ 74 74 @Test 75 publicvoid testWikipedia() {75 void testWikipedia() { 76 76 Tag2Link.getLinksForTag("wikipedia", "de:Wohnhausgruppe Herderstraße", this::addLink); 77 77 checkLinks("View Wikipedia article // https://de.wikipedia.org/wiki/Wohnhausgruppe_Herderstraße"); … … 85 85 */ 86 86 @Test 87 publicvoid testImageCommonsImage() {87 void testImageCommonsImage() { 88 88 Tag2Link.getLinksForTag("image", "File:Witten Brücke Gasstraße.jpg", this::addLink); 89 89 checkLinks("View image on Wikimedia Commons // https://commons.wikimedia.org/wiki/File:Witten Brücke Gasstraße.jpg"); … … 99 99 */ 100 100 @Test 101 publicvoid testImageCommonsCategory() {101 void testImageCommonsCategory() { 102 102 Tag2Link.getLinksForTag("image", "category:JOSM", this::addLink); 103 103 checkLinks("View category on Wikimedia Commons // https://commons.wikimedia.org/wiki/category:JOSM"); … … 108 108 */ 109 109 @Test 110 publicvoid testBrandWikidata() {110 void testBrandWikidata() { 111 111 Tag2Link.getLinksForTag("brand:wikidata", "Q259340", this::addLink); 112 112 checkLinks("View Wikidata item // https://www.wikidata.org/wiki/Q259340"); … … 117 117 */ 118 118 @Test 119 publicvoid testArchipelagoWikidata() {119 void testArchipelagoWikidata() { 120 120 Tag2Link.getLinksForTag("archipelago:wikidata", "Q756987;Q756988", this::addLink); 121 121 checkLinks("View Wikidata item // https://www.wikidata.org/wiki/Q756987", -
trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTest.java
r16945 r17275 3 3 4 4 import static java.util.Collections.singleton; 5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertTrue;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 8 9 9 import java.util.Arrays; … … 13 13 import java.util.Set; 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.TestUtils; 18 18 import org.openstreetmap.josm.data.coor.LatLon; … … 25 25 * Unit tests of {@link Territories} class. 26 26 */ 27 publicclass TerritoriesTest {27 class TerritoriesTest { 28 28 /** 29 29 * Test rules. 30 30 */ 31 @R ule31 @RegisterExtension 32 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 33 public JOSMTestRules rules = new JOSMTestRules().projection().territories(); … … 39 39 */ 40 40 @Test 41 publicvoid testUtilityClass() throws ReflectiveOperationException {41 void testUtilityClass() throws ReflectiveOperationException { 42 42 UtilityClassTestUtil.assertUtilityClassWellDefined(Territories.class); 43 43 } … … 47 47 */ 48 48 @Test 49 publicvoid testIsIso3166Code() {49 void testIsIso3166Code() { 50 50 check("Paris", new LatLon(48.8567, 2.3508), "EU", "FR", "FX"); 51 51 } … … 53 53 private static void check(String name, LatLon ll, String... expectedCodes) { 54 54 for (String e : expectedCodes) { 55 assertTrue( name + " " + e, Territories.isIso3166Code(e, ll));55 assertTrue(Territories.isIso3166Code(e, ll), name + " " + e); 56 56 } 57 57 } … … 61 61 */ 62 62 @Test 63 publicvoid testTaginfoGeofabrik_nominal() {63 void testTaginfoGeofabrik_nominal() { 64 64 Territories.initializeExternalData("foo", TestUtils.getTestDataRoot() + "/taginfo/geofabrik-index-v1-nogeom.json"); 65 65 Map<String, TaginfoRegionalInstance> cache = Territories.taginfoGeofabrikCache; … … 86 86 */ 87 87 @Test 88 publicvoid testTaginfoGeofabrik_broken() {88 void testTaginfoGeofabrik_broken() { 89 89 Logging.clearLastErrorAndWarnings(); 90 90 Territories.initializeExternalData("foo", TestUtils.getTestDataRoot() + "taginfo/geofabrik-index-v1-nogeom-broken.json"); … … 92 92 assertTrue(cache.isEmpty()); 93 93 String error = Logging.getLastErrorAndWarnings().get(0); 94 assertTrue(error , error.contains("W: Failed to parse external taginfo data at "));95 assertTrue(error , error.contains(": Invalid token=EOF at (line no=3,"));94 assertTrue(error.contains("W: Failed to parse external taginfo data at "), error); 95 assertTrue(error.contains(": Invalid token=EOF at (line no=3,"), error); 96 96 } 97 97 … … 100 100 */ 101 101 @Test 102 publicvoid testGetCustomTags() {102 void testGetCustomTags() { 103 103 assertNull(Territories.getCustomTags(null)); 104 104 assertNull(Territories.getCustomTags("foo")); -
trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java
r16602 r17275 2 2 package org.openstreetmap.josm.tools; 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.util.Collections; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 12 … … 16 16 * Integration tests of {@link Territories} class. 17 17 */ 18 publicclass TerritoriesTestIT {18 class TerritoriesTestIT { 19 19 20 20 /** 21 21 * Test rules. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules rules = new JOSMTestRules().projection(); … … 30 30 */ 31 31 @Test 32 publicvoid testUtilityClass() {32 void testUtilityClass() { 33 33 Logging.clearLastErrorAndWarnings(); 34 34 Territories.initialize(); 35 assertEquals( "no errors or warnings", Collections.emptyList(), Logging.getLastErrorAndWarnings());36 assertFalse( "customTagsCache is non empty", Territories.customTagsCache.isEmpty());37 assertFalse( "iso3166Cache is non empty", Territories.iso3166Cache.isEmpty());38 assertFalse( "taginfoCache is non empty", Territories.taginfoCache.isEmpty());39 assertFalse( "taginfoGeofabrikCache is non empty", Territories.taginfoGeofabrikCache.isEmpty());35 assertEquals(Collections.emptyList(), Logging.getLastErrorAndWarnings(), "no errors or warnings"); 36 assertFalse(Territories.customTagsCache.isEmpty(), "customTagsCache is non empty"); 37 assertFalse(Territories.iso3166Cache.isEmpty(), "iso3166Cache is non empty"); 38 assertFalse(Territories.taginfoCache.isEmpty(), "taginfoCache is non empty"); 39 assertFalse(Territories.taginfoGeofabrikCache.isEmpty(), "taginfoGeofabrikCache is non empty"); 40 40 } 41 41 } -
trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java
r16472 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.ArrayList; … … 11 11 import java.util.Map; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; 16 16 … … 20 20 * Unit tests of {@link TextTagParser} class. 21 21 */ 22 publicclass TextTagParserTest {22 class TextTagParserTest { 23 23 /** 24 24 * Some of this depends on preferences. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 32 32 */ 33 33 @Test 34 publicvoid testUnescape() {34 void testUnescape() { 35 35 String s, s1; 36 36 s = "\"2 3 4\""; … … 55 55 */ 56 56 @Test 57 publicvoid testTNformat() {57 void testTNformat() { 58 58 String txt = " a \t 1 \n\n\n b\t2 \n c \t the value with \"quotes\""; 59 59 Map<String, String> correctTags = new HashMap<String, String>() { { … … 68 68 */ 69 69 @Test 70 publicvoid testEQformat() {70 void testEQformat() { 71 71 String txt = "key1=value key2=\"long value\" tag3=\"hotel \\\"Quote\\\"\""; 72 72 Map<String, String> correctTags = new HashMap<String, String>() { { … … 82 82 */ 83 83 @Test 84 publicvoid testJSONformat() {84 void testJSONformat() { 85 85 String txt; 86 86 Map<String, String> tags, correctTags; … … 105 105 */ 106 106 @Test 107 publicvoid testFreeformat() {107 void testFreeformat() { 108 108 String txt = "a 1 b=2 c=\"hello === \\\"\\\"world\""; 109 109 Map<String, String> correctTags = new HashMap<String, String>() { { … … 118 118 */ 119 119 @Test 120 publicvoid testErrorDetect() {120 void testErrorDetect() { 121 121 String txt = "a=2 b=3 4"; 122 122 Map<String, String> tags = TextTagParser.readTagsFromText(txt); … … 128 128 */ 129 129 @Test 130 publicvoid testTab() {130 void testTab() { 131 131 assertEquals(Collections.singletonMap("shop", "jewelry"), TextTagParser.readTagsFromText("shop\tjewelry")); 132 132 assertEquals(Collections.singletonMap("shop", "jewelry"), TextTagParser.readTagsFromText("!shop\tjewelry")); … … 139 139 */ 140 140 @Test 141 publicvoid testTicket16104() {141 void testTicket16104() { 142 142 Map<String, String> expected = new HashMap<>(); 143 143 expected.put("boundary", "national_park"); … … 170 170 */ 171 171 @Test 172 publicvoid testTicket8384Comment58() {172 void testTicket8384Comment58() { 173 173 Map<String, String> expected = new HashMap<>(); 174 174 expected.put("name", "Main street"); … … 181 181 */ 182 182 @Test 183 publicvoid testStableOrder() {183 void testStableOrder() { 184 184 List<String> expected = Arrays.asList("foo4", "foo3", "foo2", "foo1"); 185 185 ArrayList<String> actual = new ArrayList<>(TextTagParser.readTagsByRegexp( -
trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
r17133 r17275 2 2 package org.openstreetmap.josm.tools; 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.assertSame; 8 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.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 10 10 11 import java.io.File; … … 21 22 import java.util.regex.Pattern; 22 23 23 import org.junit. Rule;24 import org.junit. Test;24 import org.junit.jupiter.api.Test; 25 import org.junit.jupiter.api.extension.RegisterExtension; 25 26 import org.openstreetmap.josm.testutils.JOSMTestRules; 26 27 … … 31 32 * Unit tests of {@link Utils} class. 32 33 */ 33 publicclass UtilsTest {34 class UtilsTest { 34 35 /** 35 36 * Use default, basic test rules. 36 37 */ 37 @R ule38 @RegisterExtension 38 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 40 public JOSMTestRules rules = new JOSMTestRules(); … … 44 45 */ 45 46 @Test 46 publicvoid testUtilityClass() throws ReflectiveOperationException {47 void testUtilityClass() throws ReflectiveOperationException { 47 48 UtilityClassTestUtil.assertUtilityClassWellDefined(Utils.class); 48 49 } … … 52 53 */ 53 54 @Test 54 publicvoid testStrip() {55 void testStrip() { 55 56 // CHECKSTYLE.OFF: SingleSpaceSeparator 56 57 final String someWhite = … … 107 108 */ 108 109 @Test 109 publicvoid testIsStripEmpty() {110 void testIsStripEmpty() { 110 111 assertTrue(Utils.isStripEmpty(null)); 111 112 assertTrue(Utils.isStripEmpty("")); … … 123 124 */ 124 125 @Test 125 publicvoid testToHexString() {126 void testToHexString() { 126 127 assertEquals("", Utils.toHexString(null)); 127 128 assertEquals("", Utils.toHexString(new byte[0])); … … 137 138 */ 138 139 @Test 139 publicvoid testPositionListString() {140 void testPositionListString() { 140 141 assertEquals("1", Utils.getPositionListString(Arrays.asList(1))); 141 142 assertEquals("1-2", Utils.getPositionListString(Arrays.asList(1, 2))); … … 150 151 */ 151 152 @Test 152 publicvoid testDurationString() {153 void testDurationString() { 153 154 I18n.set("en"); 154 155 assertEquals("0 ms", Utils.getDurationString(0)); … … 169 170 * Test of {@link Utils#getDurationString} method. 170 171 */ 171 @Test (expected = IllegalArgumentException.class)172 publicvoid testDurationStringNegative() {173 Utils.getDurationString(-1);172 @Test 173 void testDurationStringNegative() { 174 assertThrows(IllegalArgumentException.class, () -> Utils.getDurationString(-1)); 174 175 } 175 176 … … 178 179 */ 179 180 @Test 180 publicvoid testEscapeReservedCharactersHTML() {181 void testEscapeReservedCharactersHTML() { 181 182 assertEquals("foo -> bar -> '&'", Utils.escapeReservedCharactersHTML("foo -> bar -> '&'")); 182 183 } … … 186 187 */ 187 188 @Test 188 publicvoid testShortenString() {189 void testShortenString() { 189 190 assertNull(Utils.shortenString(null, 3)); 190 191 assertEquals("...", Utils.shortenString("123456789", 3)); … … 200 201 * Test of {@link Utils#shortenString} method. 201 202 */ 202 @Test (expected = IllegalArgumentException.class)203 publicvoid testShortenStringTooShort() {204 Utils.shortenString("123456789", 2);203 @Test 204 void testShortenStringTooShort() { 205 assertThrows(IllegalArgumentException.class, () -> Utils.shortenString("123456789", 2)); 205 206 } 206 207 … … 209 210 */ 210 211 @Test 211 publicvoid testRestrictStringLines() {212 void testRestrictStringLines() { 212 213 assertNull(Utils.restrictStringLines(null, 2)); 213 214 assertEquals("1\n...", Utils.restrictStringLines("1\n2\n3", 2)); … … 220 221 */ 221 222 @Test 222 publicvoid testLimit() {223 void testLimit() { 223 224 assertNull(Utils.limit(null, 2, "...")); 224 225 assertEquals(Arrays.asList("1", "..."), Utils.limit(Arrays.asList("1", "2", "3"), 2, "...")); … … 231 232 */ 232 233 @Test 233 publicvoid testSizeString() {234 void testSizeString() { 234 235 assertEquals("0 B", Utils.getSizeString(0, Locale.ENGLISH)); 235 236 assertEquals("123 B", Utils.getSizeString(123, Locale.ENGLISH)); … … 251 252 * Test of {@link Utils#getSizeString} method. 252 253 */ 253 @Test (expected = IllegalArgumentException.class)254 publicvoid testSizeStringNegative() {255 Utils.getSizeString(-1, Locale.ENGLISH);254 @Test 255 void testSizeStringNegative() { 256 assertThrows(IllegalArgumentException.class, () -> Utils.getSizeString(-1, Locale.ENGLISH)); 256 257 } 257 258 … … 260 261 */ 261 262 @Test 262 publicvoid testJoinAsHtmlUnorderedList() {263 void testJoinAsHtmlUnorderedList() { 263 264 List<? extends Object> items = Arrays.asList("1", Integer.valueOf(2)); 264 265 assertEquals("<ul><li>1</li><li>2</li></ul>", Utils.joinAsHtmlUnorderedList(items)); … … 270 271 */ 271 272 @Test 272 publicvoid testGetJavaVersion() {273 void testGetJavaVersion() { 273 274 String javaVersion = System.getProperty("java.version"); 274 275 try { … … 302 303 */ 303 304 @Test 304 publicvoid testGetJavaUpdate() {305 void testGetJavaUpdate() { 305 306 String javaVersion = System.getProperty("java.version"); 306 307 try { … … 331 332 */ 332 333 @Test 333 publicvoid testGetJavaBuild() {334 void testGetJavaBuild() { 334 335 String javaVersion = System.getProperty("java.runtime.version"); 335 336 try { … … 363 364 */ 364 365 @Test 365 publicvoid testNullStreamForReadBytesFromStream() throws IOException {366 assertEquals( "Empty on null stream", 0, Utils.readBytesFromStream(null).length);366 void testNullStreamForReadBytesFromStream() throws IOException { 367 assertEquals(0, Utils.readBytesFromStream(null).length, "Empty on null stream"); 367 368 } 368 369 … … 371 372 */ 372 373 @Test 373 publicvoid testLevenshteinDistance() {374 void testLevenshteinDistance() { 374 375 assertEquals(0, Utils.getLevenshteinDistance("foo", "foo")); 375 376 assertEquals(3, Utils.getLevenshteinDistance("foo", "bar")); … … 384 385 */ 385 386 @Test 386 publicvoid testIsSimilar() {387 void testIsSimilar() { 387 388 assertFalse(Utils.isSimilar("foo", "foo")); 388 389 assertFalse(Utils.isSimilar("foo", "bar")); … … 396 397 */ 397 398 @Test 398 publicvoid testStripHtml() {399 void testStripHtml() { 399 400 assertEquals("Hoogte 55 m", Utils.stripHtml( 400 401 "<table width=\"100%\"><tr>" + … … 407 408 */ 408 409 @Test 409 publicvoid testFirstNonNull() {410 void testFirstNonNull() { 410 411 assertNull(Utils.firstNonNull()); 411 412 assertNull(Utils.firstNonNull(null, null)); … … 417 418 */ 418 419 @Test 419 publicvoid testGetMatches() {420 void testGetMatches() { 420 421 final Pattern pattern = Pattern.compile("(foo)x(bar)y(baz)"); 421 422 assertNull(Utils.getMatches(pattern.matcher(""))); … … 427 428 */ 428 429 @Test 429 publicvoid testEncodeUrl() {430 void testEncodeUrl() { 430 431 assertEquals("%C3%A4%C3%B6%C3%BC%C3%9F", Utils.encodeUrl("äöüß")); 431 432 } … … 434 435 * Test of {@link Utils#encodeUrl} 435 436 */ 436 @Test (expected = NullPointerException.class)437 publicvoid testEncodeUrlNull() {438 Utils.encodeUrl(null);437 @Test 438 void testEncodeUrlNull() { 439 assertThrows(NullPointerException.class, () -> Utils.encodeUrl(null)); 439 440 } 440 441 … … 443 444 */ 444 445 @Test 445 publicvoid testDecodeUrl() {446 void testDecodeUrl() { 446 447 assertEquals("äöüß", Utils.decodeUrl("%C3%A4%C3%B6%C3%BC%C3%9F")); 447 448 } … … 450 451 * Test of {@link Utils#decodeUrl} 451 452 */ 452 @Test (expected = NullPointerException.class)453 publicvoid testDecodeUrlNull() {454 Utils.decodeUrl(null);453 @Test 454 void testDecodeUrlNull() { 455 assertThrows(NullPointerException.class, () -> Utils.decodeUrl(null)); 455 456 } 456 457 … … 459 460 */ 460 461 @Test 461 publicvoid testClamp() {462 void testClamp() { 462 463 assertEquals(3, Utils.clamp(2, 3, 5)); 463 464 assertEquals(3, Utils.clamp(3, 3, 5)); … … 475 476 * Test of {@link Utils#clamp} 476 477 */ 477 @Test (expected = IllegalArgumentException.class)478 publicvoid testClampIAE1() {479 Utils.clamp(0, 5, 4);478 @Test 479 void testClampIAE1() { 480 assertThrows(IllegalArgumentException.class, () -> Utils.clamp(0, 5, 4)); 480 481 } 481 482 … … 483 484 * Test of {@link Utils#clamp} 484 485 */ 485 @Test (expected = IllegalArgumentException.class)486 publicvoid testClampIAE2() {487 Utils.clamp(0., 5., 4.);486 @Test 487 void testClampIAE2() { 488 assertThrows(IllegalArgumentException.class, () -> Utils.clamp(0., 5., 4.)); 488 489 } 489 490 … … 492 493 */ 493 494 @Test 494 publicvoid testHasExtension() {495 void testHasExtension() { 495 496 assertFalse(Utils.hasExtension("JOSM.txt")); 496 497 assertFalse(Utils.hasExtension("JOSM.txt", "jpg")); … … 504 505 */ 505 506 @Test 506 publicvoid testToUnmodifiableList() {507 void testToUnmodifiableList() { 507 508 assertSame(Collections.emptyList(), Utils.toUnmodifiableList(null)); 508 509 assertSame(Collections.emptyList(), Utils.toUnmodifiableList(Collections.emptyList())); … … 518 519 */ 519 520 @Test 520 publicvoid testToUnmodifiableMap() {521 void testToUnmodifiableMap() { 521 522 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(null)); 522 523 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(Collections.emptyMap())); … … 538 539 */ 539 540 @Test 540 publicvoid testExecOutput() throws Exception {541 void testExecOutput() throws Exception { 541 542 final String output = Utils.execOutput(Arrays.asList("echo", "Hello", "World")); 542 543 assertEquals("Hello World", output); -
trunk/test/unit/org/openstreetmap/josm/tools/XmlUtilsTest.java
r16560 r17275 3 3 4 4 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 5 import org.junit. Rule;6 import org.junit. Test;5 import org.junit.jupiter.api.extension.RegisterExtension; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.TestUtils; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 20 20 import java.io.StringWriter; 21 21 22 import static org.junit. Assert.assertEquals;23 import static org.junit. Assert.assertNotNull;24 import static org.junit. Assert.fail;22 import static org.junit.jupiter.api.Assertions.assertEquals; 23 import static org.junit.jupiter.api.Assertions.assertNotNull; 24 import static org.junit.jupiter.api.Assertions.fail; 25 25 26 26 /** 27 27 * Unit tests of {@link XmlUtils} class. 28 28 */ 29 publicclass XmlUtilsTest {29 class XmlUtilsTest { 30 30 31 31 /** 32 32 * Use default, basic test rules. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules rules = new JOSMTestRules(); … … 40 40 41 41 @Test 42 publicvoid testExternalEntitiesParsingDom() throws IOException, ParserConfigurationException {42 void testExternalEntitiesParsingDom() throws IOException, ParserConfigurationException { 43 43 try { 44 44 final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml"; … … 52 52 53 53 @Test 54 publicvoid testExternalEntitiesTransformer() throws IOException {54 void testExternalEntitiesTransformer() throws IOException { 55 55 try { 56 56 final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml"; … … 65 65 66 66 @Test 67 publicvoid testExternalEntitiesSaxParser() throws IOException, ParserConfigurationException {67 void testExternalEntitiesSaxParser() throws IOException, ParserConfigurationException { 68 68 try { 69 69 final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml"; -
trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java
r12802 r17275 4 4 import java.util.concurrent.CountDownLatch; 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 of {@link BugReportExceptionHandler} class. 14 14 */ 15 publicclass BugReportExceptionHandlerTest {15 class BugReportExceptionHandlerTest { 16 16 /** 17 17 * No dependencies 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testHandleException() throws InterruptedException {28 void testHandleException() throws InterruptedException { 29 29 CountDownLatch latch = new CountDownLatch(1); 30 30 BugReportQueue.getInstance().addBugReportHandler(e -> { -
trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.tools.bugreport; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertSame;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.IOException; … … 10 10 import java.io.StringWriter; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.actions.ShowStatusReportAction; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 21 21 * @author Michael Zangl 22 22 */ 23 publicclass BugReportTest {23 class BugReportTest { 24 24 /** 25 25 * Preferences for the report text 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testReportText() {35 void testReportText() { 36 36 ReportedException e = interceptInChildMethod(new IOException("test-exception-message")); 37 37 e.put("test-key", "test-value"); … … 48 48 */ 49 49 @Test 50 publicvoid testIntercept() {50 void testIntercept() { 51 51 IOException base = new IOException("test"); 52 52 ReportedException intercepted = interceptInChildMethod(base); … … 69 69 */ 70 70 @Test 71 publicvoid testGetCallingMethod() {71 void testGetCallingMethod() { 72 72 assertEquals("BugReportTest#testGetCallingMethod", BugReport.getCallingMethod(1)); 73 73 assertEquals("BugReportTest#testGetCallingMethod", testGetCallingMethod2()); -
trunk/test/unit/org/openstreetmap/josm/tools/bugreport/ReportedExceptionTest.java
r10285 r17275 2 2 package org.openstreetmap.josm.tools.bugreport; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 10 10 /** … … 13 13 * @since 10285 14 14 */ 15 publicclass ReportedExceptionTest {15 class ReportedExceptionTest { 16 16 private static final class CauseOverwriteException extends RuntimeException { 17 17 private Throwable myCause; … … 31 31 */ 32 32 @Test 33 publicvoid testPutDoesHandleNull() {33 void testPutDoesHandleNull() { 34 34 ReportedException e = new ReportedException(new RuntimeException()); 35 35 e.startSection("test"); … … 45 45 */ 46 46 @Test 47 publicvoid testPutDoesNotThrow() {47 void testPutDoesNotThrow() { 48 48 ReportedException e = new ReportedException(new RuntimeException()); 49 49 e.startSection("test"); … … 65 65 */ 66 66 @Test 67 publicvoid testIsSame() {67 void testIsSame() { 68 68 // Do not break this line! All exceptions need to be created in the same line. 69 69 // CHECKSTYLE.OFF: LineLength … … 78 78 boolean is01 = (i == 0 || i == 1) && (j == 0 || j == 1); 79 79 boolean is23 = (i == 2 || i == 3) && (j == 2 || j == 3); 80 assertEquals(i + ", " + j, is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]));80 assertEquals(is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]), i + ", " + j); 81 81 } 82 82 } -
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r17114 r17275 2 2 package org.openstreetmap.josm.tools.date; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotEquals; 6 import static org.junit.Assert.assertNotNull; 7 import static org.junit.Assert.assertNotSame; 8 import static org.junit.Assert.assertNull; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNotSame; 8 import static org.junit.jupiter.api.Assertions.assertNull; 9 import static org.junit.jupiter.api.Assertions.assertThrows; 9 10 10 11 import java.text.DateFormat; … … 14 15 import java.util.concurrent.ForkJoinPool; 15 16 16 import org.junit. Ignore;17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.Disabled; 18 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension; 19 20 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 21 import org.openstreetmap.josm.tools.UncheckedParseException; … … 33 34 * Timeouts need to be disabled because we change the time zone. 34 35 */ 35 @R ule36 @RegisterExtension 36 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 38 public JOSMTestRules test = new JOSMTestRules().i18n().preferences(); … … 42 43 */ 43 44 @Test 44 publicvoid testUtilityClass() throws ReflectiveOperationException {45 void testUtilityClass() throws ReflectiveOperationException { 45 46 UtilityClassTestUtil.assertUtilityClassWellDefined(DateUtils.class); 46 47 } … … 58 59 */ 59 60 @Test 60 publicvoid testMapDate() {61 void testMapDate() { 61 62 assertEquals(1344870637000L, DateUtils.fromString("2012-08-13T15:10:37Z").getTime()); 62 63 } … … 66 67 */ 67 68 @Test 68 publicvoid testNoteDate() {69 void testNoteDate() { 69 70 assertEquals(1417298930000L, DateUtils.fromString("2014-11-29 22:08:50 UTC").getTime()); 70 71 } … … 74 75 */ 75 76 @Test 76 publicvoid testExifDate() {77 void testExifDate() { 77 78 assertEquals(1443038712000L, DateUtils.fromString("2015:09:23 20:05:12").getTime()); 78 79 assertEquals(1443038712888L, DateUtils.fromString("2015:09:23 20:05:12.888").getTime()); … … 83 84 */ 84 85 @Test 85 publicvoid testGPXDate() {86 void testGPXDate() { 86 87 assertEquals(1277465405000L, DateUtils.fromString("2010-06-25T11:30:05.000Z").getTime()); 87 88 } … … 91 92 */ 92 93 @Test 93 publicvoid testRfc3339() {94 void testRfc3339() { 94 95 // examples taken from RFC 95 96 assertEquals(482196050520L, DateUtils.fromString("1985-04-12T23:20:50.52Z").getTime()); … … 105 106 * Verifies that parsing an illegal date throws a {@link UncheckedParseException} 106 107 */ 107 @Test (expected = UncheckedParseException.class)108 publicvoid testIllegalDate() {109 DateUtils.fromString("2014-");108 @Test 109 void testIllegalDate() { 110 assertThrows(UncheckedParseException.class, () -> DateUtils.fromString("2014-")); 110 111 } 111 112 … … 114 115 */ 115 116 @Test 116 publicvoid testFormattingMillisecondsDoesNotCauseIncorrectParsing() {117 void testFormattingMillisecondsDoesNotCauseIncorrectParsing() { 117 118 DateUtils.fromDate(new Date(123)); 118 119 assertEquals(1453694709000L, DateUtils.fromString("2016-01-25T04:05:09.000Z").getTime()); … … 125 126 */ 126 127 @Test 127 publicvoid testFromTimestamp() {128 void testFromTimestamp() { 128 129 assertEquals("1970-01-01T00:00:00Z", DateUtils.fromTimestamp(0)); 129 130 assertEquals("2001-09-09T01:46:40Z", DateUtils.fromTimestamp(1000000000)); … … 135 136 */ 136 137 @Test 137 publicvoid testFromDate() {138 void testFromDate() { 138 139 assertEquals("1970-01-01T00:00:00Z", DateUtils.fromDate(new Date(0))); 139 140 assertEquals("1970-01-01T00:00:00.1Z", DateUtils.fromDate(new Date(100))); … … 147 148 */ 148 149 @Test 149 publicvoid testFormatTime() {150 void testFormatTime() { 150 151 assertEquals("12:00 AM", DateUtils.formatTime(new Date(0), DateFormat.SHORT)); 151 152 assertEquals("1:00 AM", DateUtils.formatTime(new Date(60 * 60 * 1000), DateFormat.SHORT)); … … 162 163 */ 163 164 @Test 164 publicvoid testFormatDate() {165 void testFormatDate() { 165 166 assertEquals("1/1/70", DateUtils.formatDate(new Date(123), DateFormat.SHORT)); 166 167 assertEquals("January 1, 1970", DateUtils.formatDate(new Date(123), DateFormat.LONG)); … … 171 172 */ 172 173 @Test 173 publicvoid testTsFromString() {174 void testTsFromString() { 174 175 // UTC times 175 176 assertEquals(1459641600000L, DateUtils.tsFromString("2016-04-03")); … … 204 205 205 206 @Test 206 @ Ignore("slow; use for thread safety testing")207 publicvoid testTsFromString800k() throws Exception {207 @Disabled("slow; use for thread safety testing") 208 void testTsFromString800k() throws Exception { 208 209 new ForkJoinPool(64).submit(() -> new Random() 209 210 .longs(800_000) … … 215 216 * Unit test of {@link DateUtils#tsFromString} method. 216 217 */ 217 @Test (expected = UncheckedParseException.class)218 publicvoid testTsFromStringInvalid1() {219 DateUtils.tsFromString("foobar");218 @Test 219 void testTsFromStringInvalid1() { 220 assertThrows(UncheckedParseException.class, () -> DateUtils.tsFromString("foobar")); 220 221 } 221 222 … … 223 224 * Unit test of {@link DateUtils#tsFromString} method. 224 225 */ 225 @Test (expected = UncheckedParseException.class)226 publicvoid testTsFromStringInvalid2() {227 DateUtils.tsFromString("2016/04/03");226 @Test 227 void testTsFromStringInvalid2() { 228 assertThrows(UncheckedParseException.class, () -> DateUtils.tsFromString("2016/04/03")); 228 229 } 229 230 … … 232 233 */ 233 234 @Test 234 publicvoid testGetDateFormat() {235 void testGetDateFormat() { 235 236 Boolean iso = DateUtils.PROP_ISO_DATES.get(); 236 237 try { … … 250 251 */ 251 252 @Test 252 publicvoid testTimeFormat() {253 void testTimeFormat() { 253 254 Boolean iso = DateUtils.PROP_ISO_DATES.get(); 254 255 try { … … 265 266 266 267 @Test 267 publicvoid testCloneDate() {268 void testCloneDate() { 268 269 assertNull(DateUtils.cloneDate(null)); 269 270 final Date date = new Date(1453694709000L); -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java
r14100 r17275 5 5 6 6 import org.junit.Assert; 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.testutils.JOSMTestRules; … … 18 18 * Unit tests of {@link TemplateEntry} class. 19 19 */ 20 publicclass TemplateEntryTest {20 class TemplateEntryTest { 21 21 22 22 /** 23 23 * Setup rule. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 31 31 */ 32 32 @Test 33 publicvoid testEqualsContract() {33 void testEqualsContract() { 34 34 TestUtils.assumeWorkingEqualsVerifier(); 35 35 Set<Class<? extends TemplateEntry>> templates = TestUtils.getJosmSubtypes(TemplateEntry.class); -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java
r14093 r17275 2 2 package org.openstreetmap.josm.tools.template_engine; 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.util.Arrays; … … 8 9 9 10 import org.junit.Assert; 10 import org.junit. BeforeClass;11 import org.junit. Test;11 import org.junit.jupiter.api.BeforeAll; 12 import org.junit.jupiter.api.Test; 12 13 import org.openstreetmap.josm.JOSMFixture; 13 14 import org.openstreetmap.josm.data.osm.Node; … … 22 23 * Unit tests of {@link TemplateParser} class. 23 24 */ 24 publicclass TemplateParserTest {25 class TemplateParserTest { 25 26 26 27 /** 27 28 * Setup test. 28 29 */ 29 @Before Class30 @BeforeAll 30 31 public static void setUp() { 31 32 JOSMFixture.createUnitTestFixture().init(); … … 37 38 */ 38 39 @Test 39 publicvoid testEmpty() throws ParseError {40 void testEmpty() throws ParseError { 40 41 TemplateParser parser = new TemplateParser(""); 41 42 assertEquals(new StaticText(""), parser.parse()); … … 47 48 */ 48 49 @Test 49 publicvoid testVariable() throws ParseError {50 void testVariable() throws ParseError { 50 51 TemplateParser parser = new TemplateParser("abc{var}\\{ef\\$\\{g"); 51 52 assertEquals(CompoundTemplateEntry.fromArray(new StaticText("abc"), … … 58 59 */ 59 60 @Test 60 publicvoid testConditionWhitespace() throws ParseError {61 void testConditionWhitespace() throws ParseError { 61 62 TemplateParser parser = new TemplateParser("?{ '{name} {desc}' | '{name}' | '{desc}' }"); 62 63 Condition condition = new Condition(Arrays.asList( … … 72 73 */ 73 74 @Test 74 publicvoid testConditionNoWhitespace() throws ParseError {75 void testConditionNoWhitespace() throws ParseError { 75 76 TemplateParser parser = new TemplateParser("?{'{name} {desc}'|'{name}'|'{desc}'}"); 76 77 Condition condition = new Condition(Arrays.asList( … … 91 92 */ 92 93 @Test 93 publicvoid testConditionSearchExpression() throws ParseError, SearchParseError {94 void testConditionSearchExpression() throws ParseError, SearchParseError { 94 95 TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | '{admin_level}'}"); 95 96 Condition condition = new Condition(Arrays.asList( … … 139 140 */ 140 141 @Test 141 publicvoid testFilling() throws ParseError {142 void testFilling() throws ParseError { 142 143 TemplateParser parser = new TemplateParser("{name} u{unknown}u i{number}i"); 143 144 TemplateEntry entry = parser.parse(); … … 152 153 */ 153 154 @Test 154 publicvoid testFillingSearchExpression() throws ParseError {155 void testFillingSearchExpression() throws ParseError { 155 156 TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | '{admin_level}'}"); 156 157 TemplateEntry templateEntry = parser.parse(); … … 173 174 */ 174 175 @Test 175 publicvoid testPrintAll() throws ParseError {176 void testPrintAll() throws ParseError { 176 177 TemplateParser parser = new TemplateParser("{special:everything}"); 177 178 TemplateEntry entry = parser.parse(); … … 187 188 */ 188 189 @Test 189 publicvoid testPrintMultiline() throws ParseError {190 void testPrintMultiline() throws ParseError { 190 191 TemplateParser parser = new TemplateParser("{name}\\n{number}"); 191 192 TemplateEntry entry = parser.parse(); … … 200 201 */ 201 202 @Test 202 publicvoid testSpecialVariable() throws ParseError {203 void testSpecialVariable() throws ParseError { 203 204 TemplateParser parser = new TemplateParser("{name}u{special:localName}u{special:special:key}"); 204 205 TemplateEntry templateEntry = parser.parse(); … … 210 211 211 212 @Test 212 publicvoid testSearchExpression() throws Exception {213 void testSearchExpression() throws Exception { 213 214 compile("(parent type=type1 type=parent1) | (parent type=type2 type=parent2)"); 214 215 //"parent(type=type1,type=parent1) | (parent(type=type2,type=parent2)" … … 221 222 */ 222 223 @Test 223 publicvoid testSwitchContext() throws ParseError {224 void testSwitchContext() throws ParseError { 224 225 TemplateParser parser = new TemplateParser("!{parent() type=parent2 '{name}'}"); 225 226 DatasetFactory ds = new DatasetFactory(); … … 242 243 243 244 @Test 244 publicvoid testSetAnd() throws ParseError {245 void testSetAnd() throws ParseError { 245 246 TemplateParser parser = new TemplateParser("!{(parent(type=child) type=parent) & (parent type=child subtype=parent) '{name}'}"); 246 247 DatasetFactory ds = new DatasetFactory(); … … 261 262 262 263 @Test 263 publicvoid testSetOr() throws ParseError {264 void testSetOr() throws ParseError { 264 265 TemplateParser parser = new TemplateParser("!{(parent(type=type1) type=parent1) | (parent type=type2 type=parent2) '{name}'}"); 265 266 DatasetFactory ds = new DatasetFactory(); … … 288 289 289 290 @Test 290 publicvoid testMultilevel() throws ParseError {291 void testMultilevel() throws ParseError { 291 292 TemplateParser parser = new TemplateParser( 292 293 "!{(parent(parent(type=type1)) type=grandparent) | (parent type=type2 type=parent2) '{name}'}"); … … 320 321 } 321 322 322 @Test (expected = ParseError.class)323 public void testErrorsNot() throws ParseError{323 @Test 324 void testErrorsNot() { 324 325 TemplateParser parser = new TemplateParser("!{-parent() '{name}'}"); 325 parser.parse();326 } 327 328 @Test (expected = ParseError.class)329 public void testErrorOr() throws ParseError{326 assertThrows(ParseError.class, () -> parser.parse()); 327 } 328 329 @Test 330 void testErrorOr() { 330 331 TemplateParser parser = new TemplateParser("!{parent() | type=type1 '{name}'}"); 331 parser.parse();332 } 333 334 @Test 335 publicvoid testChild() throws ParseError {332 assertThrows(ParseError.class, () -> parser.parse()); 333 } 334 335 @Test 336 void testChild() throws ParseError { 336 337 TemplateParser parser = new TemplateParser("!{((child(type=type1) type=child1) | (child type=type2 type=child2)) type=child2 '{name}'}"); 337 338 DatasetFactory ds = new DatasetFactory(); … … 351 352 parent2.addMember(new RelationMember("", child2)); 352 353 353 354 354 StringBuilder sb = new StringBuilder(); 355 355 TemplateEntry entry = parser.parse(); … … 360 360 361 361 @Test 362 publicvoid testToStringCanBeParsedAgain() throws Exception {362 void testToStringCanBeParsedAgain() throws Exception { 363 363 final String s1 = "?{ '{name} ({desc})' | '{name} ({cmt})' | '{name}' | '{desc}' | '{cmt}' }"; 364 364 final String s2 = new TemplateParser(s1).parse().toString();
Note:
See TracChangeset
for help on using the changeset viewer.