Changeset 17275 in josm for trunk/test/functional/org
- Timestamp:
- 2020-10-28T20:41:00+01:00 (4 years ago)
- Location:
- trunk/test/functional/org/openstreetmap/josm
- Files:
-
- 20 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);
Note:
See TracChangeset
for help on using the changeset viewer.