Changeset 17275 in josm
- Timestamp:
- 2020-10-28T20:41:00+01:00 (3 years ago)
- Location:
- trunk/test
- Files:
-
- 568 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java
r13412 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.InputStream; … … 11 11 import java.util.stream.Collectors; 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.data.osm.DataSet; 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 24 24 * Test of boundaries OSM file. 25 25 */ 26 publicclass BoundariesTestIT {26 class BoundariesTestIT { 27 27 28 28 private static final List<String> RETIRED_ISO3166_1_CODES = Arrays.asList( … … 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().preferences(); … … 59 59 */ 60 60 @Test 61 publicvoid testBoundariesFile() throws Exception {61 void testBoundariesFile() throws Exception { 62 62 try (InputStream is = getClass().getResourceAsStream("/data/boundaries.osm")) { 63 63 DataSet ds = OsmReader.parseDataSet(is, null); … … 67 67 for (String code : iso31661a2) { 68 68 if (!RETIRED_ISO3166_1_CODES.contains(code)) { 69 assertEquals( code, 1, tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2="+code)).count());69 assertEquals(1, tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2="+code)).count(), code); 70 70 } 71 71 } … … 73 73 for (OsmPrimitive p : tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2")).collect(Collectors.toList())) { 74 74 String code = p.get("ISO3166-1:alpha2"); 75 assertTrue( code, iso31661a2.contains(code) || EXCEPTIONNALY_RESERVED_ISO3166_1_CODES.contains(code));75 assertTrue(iso31661a2.contains(code) || EXCEPTIONNALY_RESERVED_ISO3166_1_CODES.contains(code), code); 76 76 } 77 77 // Check presence of all ISO-3166-2 codes for USA, Canada, Australia (for speed limits) 78 78 for (String code : ISO3166_2_CODES) { 79 assertEquals( code, 1, tagged.stream().filter(SearchCompiler.compile("ISO3166-2="+code)).count());79 assertEquals(1, tagged.stream().filter(SearchCompiler.compile("ISO3166-2="+code)).count(), code); 80 80 } 81 81 } -
trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.imagery; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.net.URL; 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.spi.preferences.Config; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a> 19 19 */ 20 publicclass ImageryCompareTestIT {20 class ImageryCompareTestIT { 21 21 22 22 private static final String BLACK_PREFIX = "<pre style=\"margin:3px;color:black\">"; … … 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(60000); … … 35 35 */ 36 36 @Test 37 publicvoid testImageryEntries() throws Exception {37 void testImageryEntries() throws Exception { 38 38 // Increase traditional timeouts to avoid random problems 39 39 Config.getPref().putInt("socket.timeout.connect", 60); -
trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java
r13103 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.io.IOException; … … 15 15 import javax.json.JsonValue; 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.validation.tests.MapCSSTagChecker; … … 31 31 * Various integration tests with Taginfo. 32 32 */ 33 publicclass TaginfoTestIT {33 class TaginfoTestIT { 34 34 35 35 /** 36 36 * Setup test. 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000); … … 47 47 */ 48 48 @Test 49 publicvoid testCheckPopularTags() throws SAXException, IOException, ParseException {49 void testCheckPopularTags() throws SAXException, IOException, ParseException { 50 50 TaggingPresets.readFromPreferences(); 51 51 new TagChecker().initialize(); … … 90 90 System.err.println(error); 91 91 } 92 assertTrue(errors. toString(), errors.isEmpty());92 assertTrue(errors.isEmpty(), errors::toString); 93 93 } 94 94 } -
trunk/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java
r16910 r17275 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit. Assert.assertNotEquals;4 import static org.junit.jupiter.api.Assertions.assertNotEquals; 5 5 6 6 import java.io.IOException; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Ignore;10 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.BeforeAll; 10 import org.junit.jupiter.api.Disabled; 11 11 import org.openstreetmap.josm.JOSMFixture; 12 12 … … 14 14 * Tests the {@link GettingStarted} class. 15 15 */ 16 publicclass GettingStartedTest {16 class GettingStartedTest { 17 17 18 18 /** 19 19 * Setup test. 20 20 */ 21 @Before Class21 @BeforeAll 22 22 public static void init() { 23 23 JOSMFixture.createFunctionalTestFixture().init(); … … 30 30 */ 31 31 @Test 32 @ Ignore("see #15240, inactive for /browser/trunk/nodist/images/download.png")33 publicvoid testImageReplacement() throws IOException {32 @Disabled("see #15240, inactive for /browser/trunk/nodist/images/download.png") 33 void testImageReplacement() throws IOException { 34 34 final String motd = new GettingStarted.MotdContent().updateIfRequiredString(); 35 35 // assuming that the MOTD contains one image included, fixImageLinks changes the HTML string … … 41 41 */ 42 42 @Test 43 publicvoid testImageReplacementStatic() {43 void testImageReplacementStatic() { 44 44 final String html = "the download button <img src=\"/browser/trunk/resources/images/download.svg?format=raw\" " + 45 45 "alt=\"source:trunk/resources/images/download.svg\" title=\"source:trunk/resources/images/download.svg\" />."; -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergerTestFT.java
r16438 r17275 13 13 import org.openstreetmap.josm.data.osm.Way; 14 14 15 publicclass NodeListMergerTestFT extends JFrame {15 class NodeListMergerTestFT extends JFrame { 16 16 17 17 private NodeListMerger nodeListMerger; … … 62 62 * Constructs a new {@code NodeListMergerTest}. 63 63 */ 64 publicNodeListMergerTestFT() {64 NodeListMergerTestFT() { 65 65 build(); 66 66 populate(); -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergerTestFT.java
r14120 r17275 13 13 import org.openstreetmap.josm.data.projection.Projections; 14 14 15 publicclass PropertiesMergerTestFT extends JFrame {15 class PropertiesMergerTestFT extends JFrame { 16 16 17 17 private PropertiesMerger merger; … … 38 38 * Constructs a new {@code PropertiesMergerTest}. 39 39 */ 40 publicPropertiesMergerTestFT() {40 PropertiesMergerTestFT() { 41 41 build(); 42 42 populate(); -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMergerTestFT.java
r9546 r17275 13 13 import org.openstreetmap.josm.data.osm.Way; 14 14 15 publicclass RelationMemberMergerTestFT extends JFrame {15 class RelationMemberMergerTestFT extends JFrame { 16 16 17 17 private RelationMemberMerger merger; … … 42 42 * Constructs a new {@code RelationMemberMergerTest}. 43 43 */ 44 publicRelationMemberMergerTestFT() {44 RelationMemberMergerTestFT() { 45 45 build(); 46 46 populate(); -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTestFT.java
r10378 r17275 6 6 import javax.swing.JFrame; 7 7 8 publicclass TagMergerTestFT extends JFrame {8 class TagMergerTestFT extends JFrame { 9 9 10 10 private TagMerger tagMerger; … … 19 19 * Constructs a new {@code TagMergerTest}. 20 20 */ 21 publicTagMergerTestFT() {21 TagMergerTestFT() { 22 22 build(); 23 23 tagMerger.getModel().addItem(new TagMergeItem("key", "myvalue", "theirvalue")); -
trunk/test/functional/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialogTestFT.java
r10957 r17275 9 9 import org.openstreetmap.josm.data.osm.Way; 10 10 11 publicclass ConflictResolutionDialogTestFT extends JFrame {11 class ConflictResolutionDialogTestFT extends JFrame { 12 12 13 13 private ConflictResolutionDialog dialog; … … 38 38 * Constructs a new {@code ConflictResolutionDialogTest}. 39 39 */ 40 publicConflictResolutionDialogTestFT() {40 ConflictResolutionDialogTestFT() { 41 41 build(); 42 42 } -
trunk/test/functional/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTestFT.java
r9546 r17275 4 4 import javax.swing.JFrame; 5 5 6 publicclass ChangesetCacheManagerTestFT extends JFrame {6 class ChangesetCacheManagerTestFT extends JFrame { 7 7 8 8 private ChangesetCacheManager manager; -
trunk/test/functional/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialogTestFT.java
r9546 r17275 4 4 import javax.swing.JFrame; 5 5 6 publicclass ChangesetQueryDialogTestFT extends JFrame {6 class ChangesetQueryDialogTestFT extends JFrame { 7 7 8 8 private ChangesetQueryDialog dialog; -
trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java
r12620 r17275 6 6 import javax.swing.JFrame; 7 7 8 import org.junit. BeforeClass;8 import org.junit.jupiter.api.BeforeAll; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 17 17 import org.openstreetmap.josm.tools.Logging; 18 18 19 publicclass HistoryBrowserTestFT extends JFrame {19 class HistoryBrowserTestFT extends JFrame { 20 20 21 @Before Class21 @BeforeAll 22 22 public static void init() { 23 23 JOSMFixture.createFunctionalTestFixture().init(); … … 49 49 * Constructs a new {@code HistoryBrowserTest}. 50 50 */ 51 publicHistoryBrowserTestFT() {51 HistoryBrowserTestFT() { 52 52 build(); 53 53 //populate(OsmPrimitiveType.NODE,354117); 54 54 //populate(OsmPrimitiveType.WAY,37951); 55 55 populate(OsmPrimitiveType.RELATION, 5055); 56 57 56 } 58 57 -
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
r17002 r17275 2 2 package org.openstreetmap.josm.gui.mappaint; 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 import static org.junit.jupiter.api.Assumptions.assumeTrue; 6 7 7 8 import java.awt.Color; … … 27 28 import javax.imageio.ImageIO; 28 29 29 import org.junit.Assume; 30 import org.junit.Before; 31 import org.junit.Rule; 32 import org.junit.Test; 30 import org.junit.jupiter.api.BeforeEach; 31 import org.junit.jupiter.api.Test; 32 import org.junit.jupiter.api.extension.RegisterExtension; 33 33 import org.junit.runner.RunWith; 34 34 import org.junit.runners.Parameterized; … … 67 67 * Minimal test rules required 68 68 */ 69 @R ule69 @RegisterExtension 70 70 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 71 71 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 181 181 * @since 11691 182 182 */ 183 @Before 183 @BeforeEach 184 184 public void forOpenJDK() { 185 185 String javaHome = System.getProperty("java.home"); 186 Assume.assumeTrue("Test requires openJDK", javaHome != null && javaHome.toLowerCase(Locale.ENGLISH).contains("openjdk"));186 assumeTrue(javaHome != null && javaHome.toLowerCase(Locale.ENGLISH).contains("openjdk"), "Test requires openJDK"); 187 187 188 188 List<String> fonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); 189 189 for (String font : testConfig.fonts) { 190 Assume.assumeTrue("Test requires font: " + font, fonts.contains(font));190 assumeTrue(fonts.contains(font), "Test requires font: " + font); 191 191 } 192 192 } … … 197 197 */ 198 198 @Test 199 publicvoid testRender() throws Exception {199 void testRender() throws Exception { 200 200 // Force reset of preferences 201 201 StyledMapRenderer.PREFERENCE_ANTIALIASING_USE.put(true); -
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.gui.mappaint; 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.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 5 7 6 8 import java.awt.Color; … … 11 13 import java.util.IdentityHashMap; 12 14 13 import org.junit.AfterClass; 14 import org.junit.Assert; 15 import org.junit.Before; 16 import org.junit.BeforeClass; 17 import org.junit.Rule; 18 import org.junit.Test; 15 import org.junit.jupiter.api.AfterAll; 16 import org.junit.jupiter.api.BeforeAll; 17 import org.junit.jupiter.api.BeforeEach; 18 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension; 19 20 import org.openstreetmap.josm.data.Bounds; 20 21 import org.openstreetmap.josm.data.osm.DataSet; … … 36 37 * Test {@link StyleCache}. 37 38 */ 38 publicclass StyleCacheTest {39 class StyleCacheTest { 39 40 40 41 private static final int IMG_WIDTH = 1400; … … 50 51 * The test rules used for this test. 51 52 */ 52 @R ule53 @RegisterExtension 53 54 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 54 55 public JOSMTestRules test = new JOSMTestRules().preferences().projection().mapStyles().timeout(60000); … … 58 59 * @throws Exception If an error occurred during load. 59 60 */ 60 @Before Class61 @BeforeAll 61 62 public static void load() throws Exception { 62 63 img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); … … 75 76 * Since we are running junit in non-forked mode, we don't know when this test will not be referenced any more. 76 77 */ 77 @After Class78 @AfterAll 78 79 public static void unload() { 79 80 g = null; … … 87 88 * Create the temporary graphics 88 89 */ 89 @Before 90 @BeforeEach 90 91 public void loadGraphicComponents() { 91 92 g = (Graphics2D) img.getGraphics(); … … 110 111 */ 111 112 @Test 112 publicvoid testStyleCacheInternPool() {113 void testStyleCacheInternPool() { 113 114 MapPaintStyles.getStyles().clearCached(); 114 115 StyleCache.clearStyleCachePool(); … … 130 131 } 131 132 } 132 assertEquals( "intern pool size", internPoolSize.intValue(), newInternPoolSize);133 assertEquals(internPoolSize.intValue(), newInternPoolSize, "intern pool size"); 133 134 } 134 135 } … … 144 145 */ 145 146 @Test 146 publicvoid testStyleCacheInternPool2() {147 void testStyleCacheInternPool2() { 147 148 StyleCache.clearStyleCachePool(); 148 149 Bounds bounds = new Bounds(53.56, 13.25, 53.57, 13.26); … … 159 160 Pair<StyleElementList, Range> p = osm.getCachedStyle().getWithRange(nc.getDist100Pixel(), false); 160 161 StyleElementList sel = p.a; 161 Assert.assertNotNull(sel);162 assertNotNull(sel); 162 163 Integer k = counter.get(sel); 163 164 if (k == null) { … … 168 169 } 169 170 int EXPECTED_NO_PRIMITIVES = 4294; // needs to be updated if data file or bbox changes 170 Assert.assertEquals( 171 "The number of rendered primitives should be " + EXPECTED_NO_PRIMITIVES, 172 EXPECTED_NO_PRIMITIVES, noPrimitives); 173 Assert.assertTrue( 174 "Too many StyleElementList instances, they should be shared using the StyleCache", 175 counter.size() < 100); 171 assertEquals(EXPECTED_NO_PRIMITIVES, noPrimitives, 172 "The number of rendered primitives should be " + EXPECTED_NO_PRIMITIVES); 173 assertTrue(counter.size() < 100, 174 "Too many StyleElementList instances, they should be shared using the StyleCache"); 176 175 } 177 176 } -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r16913 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; 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; … … 24 25 import java.util.logging.Logger; 25 26 26 import org.junit.Assume; 27 import org.junit.Before; 28 import org.junit.BeforeClass; 29 import org.junit.Rule; 30 import org.junit.Test; 27 import org.junit.jupiter.api.BeforeAll; 28 import org.junit.jupiter.api.BeforeEach; 29 import org.junit.jupiter.api.Test; 30 import org.junit.jupiter.api.extension.RegisterExtension; 31 31 import org.junit.rules.Timeout; 32 32 import org.openstreetmap.josm.JOSMFixture; … … 43 43 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 44 44 import org.openstreetmap.josm.spi.preferences.Config; 45 import org.openstreetmap.josm.testutils.JOSMTestRules; 45 46 46 47 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 47 import org.openstreetmap.josm.testutils.JOSMTestRules;48 48 49 49 /** … … 51 51 */ 52 52 @SuppressFBWarnings(value = "CRLF_INJECTION_LOGS") 53 publicclass MultiFetchServerObjectReaderTest {53 class MultiFetchServerObjectReaderTest { 54 54 private static final Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName()); 55 55 … … 57 57 * Setup test. 58 58 */ 59 @R ule59 @RegisterExtension 60 60 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 61 61 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 64 64 * Global timeout applied to all test methods. 65 65 */ 66 @R ule66 @RegisterExtension 67 67 public Timeout globalTimeout = Timeout.seconds(60); 68 68 … … 161 161 * @throws Exception if an error occurs 162 162 */ 163 @Before Class163 @BeforeAll 164 164 public static void init() throws Exception { 165 165 if (!TestUtils.areCredentialsProvided()) { … … 215 215 * @throws FileNotFoundException if the dataset file cannot be found 216 216 */ 217 @Before 217 @BeforeEach 218 218 public void setUp() throws IOException, IllegalDataException, FileNotFoundException { 219 219 if (!TestUtils.areCredentialsProvided()) { … … 233 233 */ 234 234 @Test 235 publicvoid testMultiGet10Nodes() throws OsmTransferException {236 Assume.assumeTrue(TestUtils.areCredentialsProvided());235 void testMultiGet10Nodes() throws OsmTransferException { 236 assumeTrue(TestUtils.areCredentialsProvided()); 237 237 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 238 238 ArrayList<Node> nodes = new ArrayList<>(ds.getNodes()); … … 255 255 */ 256 256 @Test 257 publicvoid testMultiGet10Ways() throws OsmTransferException {258 Assume.assumeTrue(TestUtils.areCredentialsProvided());257 void testMultiGet10Ways() throws OsmTransferException { 258 assumeTrue(TestUtils.areCredentialsProvided()); 259 259 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 260 260 ArrayList<Way> ways = new ArrayList<>(ds.getWays()); … … 278 278 */ 279 279 @Test 280 publicvoid testMultiGet10Relations() throws OsmTransferException {281 Assume.assumeTrue(TestUtils.areCredentialsProvided());280 void testMultiGet10Relations() throws OsmTransferException { 281 assumeTrue(TestUtils.areCredentialsProvided()); 282 282 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 283 283 ArrayList<Relation> relations = new ArrayList<>(ds.getRelations()); … … 301 301 */ 302 302 @Test 303 publicvoid testMultiGet800Nodes() throws OsmTransferException {304 Assume.assumeTrue(TestUtils.areCredentialsProvided());303 void testMultiGet800Nodes() throws OsmTransferException { 304 assumeTrue(TestUtils.areCredentialsProvided()); 305 305 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 306 306 ArrayList<Node> nodes = new ArrayList<>(ds.getNodes()); … … 323 323 */ 324 324 @Test 325 publicvoid testMultiGetWithNonExistingNode() throws OsmTransferException {326 Assume.assumeTrue(TestUtils.areCredentialsProvided());325 void testMultiGetWithNonExistingNode() throws OsmTransferException { 326 assumeTrue(TestUtils.areCredentialsProvided()); 327 327 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 328 328 ArrayList<Node> nodes = new ArrayList<>(ds.getNodes()); … … 348 348 */ 349 349 @Test 350 publicvoid testBuildRequestString() {350 void testBuildRequestString() { 351 351 String requestString = new MultiFetchServerObjectReader() 352 352 .buildRequestString(OsmPrimitiveType.WAY, new TreeSet<>(Arrays.asList(130L, 123L, 126L))); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r16442 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 import static org.junit.jupiter.api.Assumptions.assumeTrue; 9 10 10 11 import java.io.File; … … 22 23 import java.util.logging.Logger; 23 24 24 import org.junit.Assume; 25 import org.junit.Before; 26 import org.junit.BeforeClass; 27 import org.junit.Test; 25 import org.junit.jupiter.api.BeforeAll; 26 import org.junit.jupiter.api.BeforeEach; 27 import org.junit.jupiter.api.Test; 28 28 import org.openstreetmap.josm.JOSMFixture; 29 29 import org.openstreetmap.josm.TestUtils; … … 52 52 */ 53 53 @SuppressFBWarnings(value = "CRLF_INJECTION_LOGS") 54 publicclass OsmServerBackreferenceReaderTest {54 class OsmServerBackreferenceReaderTest { 55 55 private static final Logger logger = Logger.getLogger(OsmServerBackreferenceReader.class.getName()); 56 56 … … 158 158 * @throws IOException if an I/O error occurs 159 159 */ 160 @Before Class160 @BeforeAll 161 161 public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException, IOException { 162 162 if (!TestUtils.areCredentialsProvided()) { … … 217 217 * @throws FileNotFoundException if the dataset file cannot be found 218 218 */ 219 @Before 219 @BeforeEach 220 220 public void setUp() throws IOException, IllegalDataException, FileNotFoundException { 221 221 if (!TestUtils.areCredentialsProvided()) { … … 235 235 */ 236 236 @Test 237 publicvoid testBackreferenceForNode() throws OsmTransferException {238 Assume.assumeTrue(TestUtils.areCredentialsProvided());237 void testBackreferenceForNode() throws OsmTransferException { 238 assumeTrue(TestUtils.areCredentialsProvided()); 239 239 Node n = lookupNode(ds, 0); 240 240 assertNotNull(n); … … 291 291 */ 292 292 @Test 293 publicvoid testBackreferenceForNodeFull() throws OsmTransferException {294 Assume.assumeTrue(TestUtils.areCredentialsProvided());293 void testBackreferenceForNodeFull() throws OsmTransferException { 294 assumeTrue(TestUtils.areCredentialsProvided()); 295 295 Node n = lookupNode(ds, 0); 296 296 assertNotNull(n); … … 338 338 */ 339 339 @Test 340 publicvoid testBackreferenceForWay() throws OsmTransferException {341 Assume.assumeTrue(TestUtils.areCredentialsProvided());340 void testBackreferenceForWay() throws OsmTransferException { 341 assumeTrue(TestUtils.areCredentialsProvided()); 342 342 Way w = lookupWay(ds, 1); 343 343 assertNotNull(w); … … 381 381 */ 382 382 @Test 383 publicvoid testBackreferenceForWayFull() throws OsmTransferException {384 Assume.assumeTrue(TestUtils.areCredentialsProvided());383 void testBackreferenceForWayFull() throws OsmTransferException { 384 assumeTrue(TestUtils.areCredentialsProvided()); 385 385 Way w = lookupWay(ds, 1); 386 386 assertNotNull(w); … … 418 418 */ 419 419 @Test 420 publicvoid testBackreferenceForRelation() throws OsmTransferException {421 Assume.assumeTrue(TestUtils.areCredentialsProvided());420 void testBackreferenceForRelation() throws OsmTransferException { 421 assumeTrue(TestUtils.areCredentialsProvided()); 422 422 Relation r = lookupRelation(ds, 1); 423 423 assertNotNull(r); … … 536 536 */ 537 537 @Test 538 publicvoid testBackreferenceForRelationFull() throws OsmTransferException {539 Assume.assumeTrue(TestUtils.areCredentialsProvided());538 void testBackreferenceForRelationFull() throws OsmTransferException { 539 assumeTrue(TestUtils.areCredentialsProvided()); 540 540 Relation r = lookupRelation(ds, 1); 541 541 assertNotNull(r); -
trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java
r12620 r17275 12 12 import javax.swing.JTextField; 13 13 14 import org.junit. Ignore;14 import org.junit.jupiter.api.Disabled; 15 15 import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel; 16 16 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 17 17 import org.openstreetmap.josm.tools.Logging; 18 18 19 @ Ignore20 publicclass UploadStrategySelectionPanelTest extends JFrame {19 @Disabled 20 class UploadStrategySelectionPanelTest extends JFrame { 21 21 22 22 protected UploadStrategySelectionPanel uploadStrategySelectionPanel; … … 56 56 * Constructs a new {@code UploadStrategySelectionPanelTest}. 57 57 */ 58 publicUploadStrategySelectionPanelTest() {58 UploadStrategySelectionPanelTest() { 59 59 build(); 60 60 uploadStrategySelectionPanel.setNumUploadedObjects(51000); 61 61 } 62 62 63 public static void main(String[] args) throws OsmApiInitializationException, OsmTransferCanceledException {63 public static void main(String[] args) throws Exception { 64 64 OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE); 65 65 new UploadStrategySelectionPanelTest().setVisible(true); -
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java
r17144 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 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; 8 8 import static org.openstreetmap.josm.gui.mappaint.MapCSSRendererTest.assertImageEquals; 9 9 … … 48 48 * Unit tests of {@link ImageProvider} class. 49 49 */ 50 publicclass ImageProviderTest {50 class ImageProviderTest { 51 51 52 52 /** … … 94 94 */ 95 95 @Test 96 publicvoid testTicket9984() throws IOException {96 void testTicket9984() throws IOException { 97 97 File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png")); 98 98 assertEquals(Transparency.TRANSLUCENT, ImageProvider.read(file, true, true).getTransparency()); … … 108 108 */ 109 109 @Test 110 publicvoid testTicket10030() throws IOException {110 void testTicket10030() throws IOException { 111 111 File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg")); 112 112 BufferedImage img = ImageProvider.read(file, true, true); … … 120 120 @Test 121 121 @SuppressFBWarnings(value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") 122 publicvoid testTicket14319() throws IOException {122 void testTicket14319() throws IOException { 123 123 LogHandler14319 handler = new LogHandler14319(); 124 124 Logger.getLogger(SVGConst.SVG_LOGGER).addHandler(handler); … … 134 134 */ 135 135 @Test 136 publicvoid testTicket19551() throws SAXException {136 void testTicket19551() throws SAXException { 137 137 TaggingPreset badPreset = new TaggingPreset(); 138 138 badPreset.setType("node,way,relation,closedway"); … … 155 155 */ 156 156 @Test 157 publicvoid testDataUrl() {157 void testDataUrl() { 158 158 // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML 159 159 assertNotNull(ImageProvider.get("data:image/png;base64," + … … 167 167 */ 168 168 @Test 169 publicvoid testImageIcon() throws IOException {169 void testImageIcon() throws IOException { 170 170 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 171 171 testImage(12, 9, "housenumber_small-AUTO-null", resource.getImageIcon()); … … 182 182 */ 183 183 @Test 184 publicvoid testImageIconBounded() throws IOException {184 void testImageIconBounded() throws IOException { 185 185 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 186 186 testImage(8, 6, "housenumber_small-BOUNDED-08x08", resource.getImageIconBounded(new Dimension(8, 8))); … … 194 194 */ 195 195 @Test 196 publicvoid testImageIconPadded() throws IOException {196 void testImageIconPadded() throws IOException { 197 197 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 198 198 testImage(8, 8, "housenumber_small-PADDED-08x08", resource.getPaddedIcon(new Dimension(8, 8))); … … 204 204 final BufferedImage image = (BufferedImage) icon.getImage(); 205 205 final File referenceFile = getReferenceFile(reference); 206 assertEquals( "width", width, image.getWidth(null));207 assertEquals( "height", height, image.getHeight(null));206 assertEquals(width, image.getWidth(null), "width"); 207 assertEquals(height, image.getHeight(null), "height"); 208 208 assertImageEquals(reference, referenceFile, image, 0, 0, null); 209 209 } … … 219 219 */ 220 220 @Test 221 publicvoid testGetImageIconBounded() {221 void testGetImageIconBounded() { 222 222 int scale = 2; 223 223 GuiSizesHelper.setPixelDensity(scale); … … 240 240 /** 241 241 * Test getting an image for a crosshair cursor. 242 * @param guiScale coefficient of monitor pixel density to be set 243 * @throws IOException in case of I/O error 242 244 */ 243 245 @ParameterizedTest 244 246 @ValueSource(floats = {1.0f, 1.5f, 3.0f}) 245 publicvoid testGetCursorImageForCrosshair(float guiScale) throws IOException {247 void testGetCursorImageForCrosshair(float guiScale) throws IOException { 246 248 GuiSizesHelper.setPixelDensity(guiScale); 247 249 Point hotSpot = new Point(); … … 255 257 /** 256 258 * Test getting an image for a custom cursor with overlay. 259 * @param guiScale coefficient of monitor pixel density to be set 260 * @throws IOException in case of I/O error 257 261 */ 258 262 @ParameterizedTest 259 263 @ValueSource(floats = {1.0f, 1.5f, 3.0f}) 260 publicvoid testGetCursorImageWithOverlay(float guiScale) throws IOException {264 void testGetCursorImageWithOverlay(float guiScale) throws IOException { 261 265 GuiSizesHelper.setPixelDensity(guiScale); 262 266 Point hotSpot = new Point(); -
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java
r16983 r17275 2 2 package org.openstreetmap.josm.tools; 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.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Integration tests of {@link ImageProvider} class. 14 14 */ 15 publicclass ImageProviderTestIT {15 class ImageProviderTestIT { 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 testWikiProtocol() {28 void testWikiProtocol() { 29 29 // https://commons.wikimedia.org/wiki/File:OpenJDK_logo.svg 30 30 assertNotNull(ImageProvider.get("wiki://OpenJDK_logo.svg")); -
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java
r16983 r17275 11 11 import javax.swing.JPanel; 12 12 13 import org.junit. Ignore;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.Disabled; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.testutils.JOSMTestRules; 17 17 … … 21 21 * Unit tests of {@link ImageProvider} class for manual execution. 22 22 */ 23 publicclass ImageProviderTestManual {23 class ImageProviderTestManual { 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(); … … 32 32 /** 33 33 * Test getting a cursor 34 * @throws InterruptedException in case of thread interruption 34 35 */ 35 @ Ignore("manual execution only, as the look of the cursor cannot be checked automatedly")36 @Disabled("manual execution only, as the look of the cursor cannot be checked automatedly") 36 37 @Test 37 publicvoid testGetCursor() throws InterruptedException {38 void testGetCursor() throws InterruptedException { 38 39 JFrame frame = new JFrame(); 39 40 frame.setSize(500, 500); -
trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java
r16913 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.assertNotSame;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.assertNotSame; 7 import static org.junit.jupiter.api.Assertions.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.security.SecureRandom; 11 11 import java.util.ArrayList; 12 12 import java.util.Random; 13 import java.util.concurrent.TimeUnit; 13 14 14 15 import org.apache.commons.lang3.RandomStringUtils; 15 16 import org.junit.Before; 16 import org.junit. Rule;17 import org.junit. Test;18 import org.junit. rules.Timeout;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.Timeout; 19 import org.junit.jupiter.api.extension.RegisterExtension; 19 20 import org.openstreetmap.josm.PerformanceTestUtils; 20 21 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; … … 28 29 * @author Michael Zangl 29 30 */ 30 public class KeyValuePerformanceTest { 31 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 32 class KeyValuePerformanceTest { 31 33 private static final int PUT_RUNS = 10000; 32 34 private static final int GET_RUNS = 100000; … … 38 40 39 41 /** 40 * Global timeout applied to all test methods.41 */42 @Rule43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")44 public Timeout globalTimeout = Timeout.seconds(15*60);45 46 /**47 42 * Prepare the test. 48 43 */ 49 @R ule44 @RegisterExtension 50 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 51 46 public JOSMTestRules test = new JOSMTestRules().projection(); … … 56 51 @Test 57 52 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test Strings that are interned and those that are not") 58 publicvoid testMeasureStringEqualsIntern() {53 void testMeasureStringEqualsIntern() { 59 54 String str1Interned = "string1"; 60 55 String str1InternedB = "string1"; … … 134 129 */ 135 130 @Test 136 publicvoid testKeyValuePut() {131 void testKeyValuePut() { 137 132 for (double tagNodeRatio : TAG_NODE_RATIOS) { 138 133 int nodeCount = (int) (PUT_RUNS / tagNodeRatio); … … 158 153 @Test 159 154 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 160 publicvoid testKeyValueGet() {155 void testKeyValueGet() { 161 156 for (double tagNodeRatio : TAG_NODE_RATIOS) { 162 157 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); … … 179 174 */ 180 175 @Test 181 publicvoid testKeyValueGetKeys() {176 void testKeyValueGetKeys() { 182 177 for (double tagNodeRatio : TAG_NODE_RATIOS) { 183 178 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); … … 202 197 @Test 203 198 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 204 publicvoid testKeyValueGetKeysGet() {199 void testKeyValueGetKeysGet() { 205 200 for (double tagNodeRatio : TAG_NODE_RATIOS) { 206 201 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); -
trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java
r10758 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 8 import org.openstreetmap.josm.data.coor.LatLonTest; … … 13 13 * Checks that rounding of coordinates is not too slow. 14 14 */ 15 publicclass RoundingPerformanceTest {15 class RoundingPerformanceTest { 16 16 17 17 private static double oldRoundToOsmPrecision(double value) { … … 25 25 @Test 26 26 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 27 publicvoid testRounding() {27 void testRounding() { 28 28 final int n = 1000000; 29 29 long start = System.nanoTime(); -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
r16006 r17275 11 11 import java.nio.file.Files; 12 12 import java.nio.file.Paths; 13 import java.util.concurrent.TimeUnit; 13 14 14 15 import javax.imageio.ImageIO; 15 16 16 import org.junit.Rule; 17 import org.junit.Test; 18 import org.junit.rules.Timeout; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.Timeout; 19 19 import org.openstreetmap.josm.JOSMFixture; 20 20 import org.openstreetmap.josm.data.Bounds; … … 30 30 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}. 31 31 */ 32 public abstract class AbstractMapRendererPerformanceTestParent { 32 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 33 abstract class AbstractMapRendererPerformanceTestParent { 33 34 34 35 private static final int IMG_WIDTH = 1400; … … 45 46 private static DataSet dsOverpass; 46 47 private static DataSet dsCity; 47 48 /**49 * Global timeout applied to all test methods.50 */51 @Rule52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")53 public Timeout globalTimeout = Timeout.seconds(15*60);54 48 55 49 protected static void load() throws Exception { … … 112 106 113 107 @Test 114 publicvoid testRestriction() throws Exception {108 void testRestriction() throws Exception { 115 109 test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195)); 116 110 } 117 111 118 112 @Test 119 publicvoid testRestrictionSmall() throws Exception {113 void testRestrictionSmall() throws Exception { 120 114 test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152)); 121 115 } 122 116 123 117 @Test 124 publicvoid testMultipolygon() throws Exception {118 void testMultipolygon() throws Exception { 125 119 test(400, dsMultipolygon, new Bounds(60, -180, 85, -122)); 126 120 } 127 121 128 122 @Test 129 publicvoid testMultipolygonSmall() throws Exception {123 void testMultipolygonSmall() throws Exception { 130 124 test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180)); 131 125 } … … 135 129 * Complex polygon (Lake Ontario) with small download area. 136 130 */ 137 publicvoid testOverpassDownload() throws Exception {131 void testOverpassDownload() throws Exception { 138 132 test(20, dsOverpass, new Bounds(43.4510496, -76.536684, 43.4643202, -76.4954853)); 139 133 } 140 134 141 135 @Test 142 publicvoid testCity() throws Exception {136 void testCity() throws Exception { 143 137 test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34)); 144 138 } 145 139 146 140 @Test 147 publicvoid testCitySmall() throws Exception {141 void testCitySmall() throws Exception { 148 142 test(70, dsCity, new Bounds(52, 11, 55, 14)); 149 143 } 150 144 151 145 @Test 152 publicvoid testCityPart1() throws Exception {146 void testCityPart1() throws Exception { 153 147 test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26)); 154 148 } 155 149 156 150 @Test 157 publicvoid testCityPart2() throws Exception {151 void testCityPart2() throws Exception { 158 152 test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30)); 159 153 } 160 154 161 155 @Test 162 publicvoid testCitySmallPart2() throws Exception {156 void testCitySmallPart2() throws Exception { 163 157 test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30)); 164 158 } -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java
r10907 r17275 7 7 import javax.imageio.ImageIO; 8 8 9 import org.junit. AfterClass;10 import org.junit. BeforeClass;9 import org.junit.jupiter.api.AfterAll; 10 import org.junit.jupiter.api.BeforeAll; 11 11 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 12 12 … … 16 16 * Performance test of {@code StyledMapRenderer}. 17 17 */ 18 publicclass StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {18 class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent { 19 19 20 @Before Class20 @BeforeAll 21 21 public static void load() throws Exception { 22 22 AbstractMapRendererPerformanceTestParent.load(); … … 25 25 } 26 26 27 @After Class27 @AfterAll 28 28 public static void clean() throws Exception { 29 29 AbstractMapRendererPerformanceTestParent.clean(); -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRendererPerformanceTest.java
r10907 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 3 3 4 import org.junit. AfterClass;5 import org.junit. BeforeClass;4 import org.junit.jupiter.api.AfterAll; 5 import org.junit.jupiter.api.BeforeAll; 6 6 7 7 /** 8 8 * Performance test of {@code WireframeMapRenderer}. 9 9 */ 10 publicclass WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {10 class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent { 11 11 12 @Before Class12 @BeforeAll 13 13 public static void load() throws Exception { 14 14 AbstractMapRendererPerformanceTestParent.load(); 15 15 } 16 16 17 @After Class17 @AfterAll 18 18 public static void clean() throws Exception { 19 19 AbstractMapRendererPerformanceTestParent.clean(); -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
r16822 r17275 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.junit.jupiter.api.Assertions.assertEquals; 3 5 4 6 import java.awt.Color; … … 20 22 import javax.imageio.ImageIO; 21 23 22 import org.junit.AfterClass;23 24 import org.junit.Assert; 24 import org.junit.BeforeClass; 25 import org.junit.Rule; 26 import org.junit.Test; 25 import org.junit.jupiter.api.AfterAll; 26 import org.junit.jupiter.api.BeforeAll; 27 import org.junit.jupiter.api.Test; 28 import org.junit.jupiter.api.extension.RegisterExtension; 27 29 import org.openstreetmap.josm.JOSMFixture; 28 30 import org.openstreetmap.josm.PerformanceTestUtils; … … 49 51 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 50 52 51 import static org.junit.Assert.assertEquals;52 53 53 /** 54 54 * Performance test of map renderer. … … 87 87 * Setup tests 88 88 */ 89 @R ule89 @RegisterExtension 90 90 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 91 91 public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000); … … 95 95 * @throws Exception if any error occurs 96 96 */ 97 @Before Class97 @BeforeAll 98 98 public static void load() throws Exception { 99 99 JOSMFixture.createPerformanceTestFixture().init(true); … … 179 179 * Cleanup test environment. 180 180 */ 181 @After Class181 @AfterAll 182 182 public static void cleanUp() { 183 183 setFilterStyleActive(false); … … 283 283 */ 284 284 @Test 285 publicvoid testPerformanceGenerate() throws IOException {285 void testPerformanceGenerate() throws IOException { 286 286 setFilterStyleActive(false); 287 287 PerformanceTester test = new PerformanceTester(); … … 322 322 */ 323 323 @Test 324 publicvoid testPerformanceDrawFeatures() throws IOException {324 void testPerformanceDrawFeatures() throws IOException { 325 325 testDrawFeature(null); 326 326 for (Feature f : Feature.values()) { … … 352 352 } 353 353 354 publicstatic class BenchmarkData extends CapturingBenchmark {354 static class BenchmarkData extends CapturingBenchmark { 355 355 356 356 private List<StyleRecord> allStyleElems; -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSConditionPerformanceTest.java
r10837 r17275 4 4 import java.util.EnumSet; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.PerformanceTestUtils; 8 8 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; … … 12 12 * @author Michael Zangl 13 13 */ 14 publicclass MapCSSConditionPerformanceTest {14 class MapCSSConditionPerformanceTest { 15 15 /** 16 16 * Test the performance of all OP entries. 17 17 */ 18 18 @Test 19 publicvoid testAllOps() {19 void testAllOps() { 20 20 // The JIT does some really heavy optimisations if it notices that other values are not used. 21 21 // If we want to simulate a real scenario, we need to invoke every op several times to let the compiler -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 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.Graphics2D; … … 10 10 import java.util.Collection; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.BeforeAll; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.Bounds; … … 29 29 * 30 30 */ 31 publicclass MapCSSPerformanceTest {31 class MapCSSPerformanceTest { 32 32 33 33 /* ------------------------ configuration section ---------------------------- */ … … 56 56 * Setup test. 57 57 */ 58 @Before Class58 @BeforeAll 59 59 public static void createJOSMFixture() { 60 60 JOSMFixture.createPerformanceTestFixture().init(true); -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import org.junit.BeforeClass; 5 import org.junit.Rule; 6 import org.junit.Test; 7 import org.junit.rules.Timeout; 4 import java.util.concurrent.TimeUnit; 5 6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.Timeout; 8 9 import org.openstreetmap.josm.JOSMFixture; 9 10 import org.openstreetmap.josm.PerformanceTestUtils; … … 13 14 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 14 15 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;16 17 16 /** 18 17 * Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object. 19 18 * @author Michael Zangl 20 19 */ 21 public class MapCSSStyleSourceFilterTest { 20 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 21 class MapCSSStyleSourceFilterTest { 22 22 23 23 private static final int TEST_RULE_COUNT = 10000; … … 82 82 83 83 /** 84 * Global timeout applied to all test methods.85 */86 @Rule87 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")88 public Timeout globalTimeout = Timeout.seconds(15*60);89 90 /**91 84 * Prepare the test. 92 85 */ 93 @Before Class86 @BeforeAll 94 87 public static void createJOSMFixture() { 95 88 JOSMFixture.createPerformanceTestFixture().init(true); … … 100 93 */ 101 94 @Test 102 publicvoid testKeyValueRules() {95 void testKeyValueRules() { 103 96 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 104 97 data.generateDataSet(); … … 111 104 */ 112 105 @Test 113 publicvoid testKeyOnlyRules() {106 void testKeyOnlyRules() { 114 107 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 115 108 data.generateDataSet(); … … 122 115 */ 123 116 @Test 124 publicvoid testRegularExpressionRules() {117 void testRegularExpressionRules() { 125 118 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 126 119 data.generateDataSet(); … … 133 126 */ 134 127 @Test 135 publicvoid testIsTrueRules() {128 void testIsTrueRules() { 136 129 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 137 130 data.generateDataSet(); -
trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.io; 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.ByteArrayInputStream; … … 10 10 import java.io.IOException; 11 11 import java.io.InputStream; 12 import java.util.concurrent.TimeUnit; 12 13 13 import org.junit.BeforeClass; 14 import org.junit.Rule; 15 import org.junit.Test; 16 import org.junit.rules.Timeout; 14 import org.junit.jupiter.api.BeforeAll; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.Timeout; 17 17 import org.openstreetmap.josm.JOSMFixture; 18 18 import org.openstreetmap.josm.PerformanceTestUtils; 19 19 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;23 21 24 22 /** … … 29 27 * @author Michael Zangl 30 28 */ 31 public class OsmReaderPerformanceTest { 29 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 30 class OsmReaderPerformanceTest { 32 31 private static final int TIMES = 4; 33 32 private static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2"; 34 33 35 34 /** 36 * Global timeout applied to all test methods.37 */38 @Rule39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")40 public Timeout globalTimeout = Timeout.seconds(15*60);41 42 /**43 35 * Prepare the test. 44 36 */ 45 @Before Class37 @BeforeAll 46 38 public static void createJOSMFixture() { 47 39 JOSMFixture.createPerformanceTestFixture().init(true); … … 53 45 */ 54 46 @Test 55 publicvoid testCompressed() throws Exception {47 void testCompressed() throws Exception { 56 48 runTest("compressed (.osm.bz2)", false); 57 49 } … … 62 54 */ 63 55 @Test 64 publicvoid testPlain() throws Exception {56 void testPlain() throws Exception { 65 57 runTest(".osm-file", true); 66 58 } -
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 @Reg