From 963e99b485befb9850739a2e7096810964cc3e8e Mon Sep 17 00:00:00 2001 From: "taylor.smock" Date: Tue, 3 Oct 2023 22:03:40 +0000 Subject: [PATCH] See #16567: Update to JUnit 5 This removes `new JOSMTestRules()` with no additional setup and most `JOSMFixture` calls. Removing the bare JOSMTestRules speeds up the test suite since there are two fewer `System.gc()` calls per test. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18853 0c6e7542-c601-0410-84e7-c038aed88b3b --- .../josm/gui/GettingStartedTest.java | 13 +---- .../gui/history/HistoryBrowserTestFT.java | 8 +-- .../josm/tools/ImageProviderTest.java | 21 -------- .../josm/tools/ImageProviderTestIT.java | 12 ----- .../josm/tools/ImageProviderTestManual.java | 16 +----- .../josm/io/OsmReaderPerformanceTest.java | 10 ---- .../josm/io/OsmWriterPerformanceTest.java | 18 ++----- .../josm/actions/CombineWayActionTest.java | 11 ---- .../ReverseWayNoTagCorrectorTest.java | 12 ----- .../corrector/ReverseWayTagCorrectorTest.java | 11 ---- .../ChangesetContentDownloadTaskTest.java | 24 +++------ .../ChangesetHeaderDownloadTaskTest.java | 18 ++----- .../downloadtasks/ChangesetQueryTaskTest.java | 19 ++----- .../DownloadReferrersTaskTest.java | 31 +++-------- .../downloadtasks/DownloadTaskListTest.java | 16 +----- .../PostDownloadHandlerTest.java | 12 ----- .../command/TransformNodesCommandTest.java | 11 ---- .../conflict/ConflictAddCommandTest.java | 10 ---- .../conflict/ConflictResolveCommandTest.java | 11 ---- .../CoordinateConflictResolveCommandTest.java | 10 ---- ...eletedStateConflictResolveCommandTest.java | 11 ---- .../ModifiedConflictResolveCommandTest.java | 11 ---- ...tionMemberConflictResolverCommandTest.java | 11 ---- .../TagConflictResolveCommandTest.java | 11 ---- .../VersionConflictResolveCommandTest.java | 11 ---- .../WayNodesConflictResolverCommandTest.java | 11 ---- .../josm/data/APIDataSetTest.java | 21 +------- .../openstreetmap/josm/data/VersionTest.java | 11 ---- .../josm/data/coor/CachedLatLonTest.java | 11 ---- .../data/correction/TagCorrectionTest.java | 11 ---- .../data/gpx/GpxExtensionCollectionTest.java | 12 ----- .../josm/data/gpx/GpxExtensionTest.java | 11 ---- .../data/gpx/GpxImageCorrelationTest.java | 36 +++++-------- .../josm/data/gpx/GpxImageEntryTest.java | 11 ---- .../josm/data/gpx/GpxOffsetTest.java | 25 +-------- .../josm/data/gpx/GpxRouteTest.java | 11 ---- .../josm/data/gpx/GpxTimezoneTest.java | 25 +-------- .../josm/data/gpx/GpxTrackSegmentTest.java | 11 ---- .../josm/data/gpx/GpxTrackTest.java | 11 ---- .../josm/data/gpx/WayPointTest.java | 21 ++------ .../josm/data/gpx/WithAttributesTest.java | 11 ---- .../GetCapabilitiesParseHelperTest.java | 11 ---- .../josm/data/imagery/ImageryInfoTest.java | 12 ----- .../vectortile/mapbox/MVTTileTest.java | 19 +++---- .../josm/data/notes/NoteCommentTest.java | 12 ----- .../josm/data/notes/NoteTest.java | 11 ---- .../josm/data/oauth/OAuthParametersTest.java | 10 ---- .../josm/data/osm/AbstractPrimitiveTest.java | 12 ----- .../openstreetmap/josm/data/osm/BBoxTest.java | 11 ---- .../josm/data/osm/ChangesetCacheTest.java | 16 +----- .../josm/data/osm/ChangesetDataSetTest.java | 12 ----- .../osm/ChangesetDiscussionCommentTest.java | 12 ----- .../josm/data/osm/ChangesetTest.java | 10 ---- .../DataIntegrityProblemExceptionTest.java | 12 ----- .../josm/data/osm/DataSetMergerTest.java | 52 +++++++------------ .../josm/data/osm/DataSetTest.java | 12 ----- .../josm/data/osm/FilterTest.java | 11 ---- .../josm/data/osm/NodeGraphTest.java | 12 ----- .../data/osm/OsmPrimitiveKeyHandlingTest.java | 16 ++---- .../josm/data/osm/OsmPrimitiveTest.java | 12 ----- .../josm/data/osm/OsmPrimitiveTypeTest.java | 14 +---- .../josm/data/osm/OsmUtilsTest.java | 14 +---- .../josm/data/osm/QuadBucketsTest.java | 12 ----- .../josm/data/osm/RelationTest.java | 14 +---- .../josm/data/osm/StorageTest.java | 11 ---- .../openstreetmap/josm/data/osm/UserTest.java | 12 ----- .../josm/data/osm/WaySegmentTest.java | 12 ----- .../openstreetmap/josm/data/osm/WayTest.java | 13 +---- .../event/ChangesetIdChangedEventTest.java | 12 ----- .../data/osm/event/DataChangedEventTest.java | 12 ----- .../data/osm/event/NodeMovedEventTest.java | 12 ----- .../event/PrimitiveFlagsChangedEventTest.java | 12 ----- .../osm/event/PrimitivesAddedEventTest.java | 12 ----- .../osm/event/PrimitivesRemovedEventTest.java | 12 ----- .../RelationMembersChangedEventTest.java | 12 ----- .../data/osm/event/TagsChangedEventTest.java | 12 ----- .../osm/event/WayNodesChangedEventTest.java | 12 ----- .../data/osm/history/HistoryNodeTest.java | 12 ----- .../data/osm/history/HistoryRelationTest.java | 12 ----- .../josm/data/osm/history/HistoryWayTest.java | 11 ---- .../osm/search/PushbackTokenizerTest.java | 12 ----- .../josm/data/osm/search/SearchModeTest.java | 12 ----- .../MergeSourceBuildingVisitorTest.java | 11 ---- .../projection/ProjectionRegressionTest.java | 15 ++---- .../josm/data/projection/proj/LonLatTest.java | 11 ---- .../data/projection/proj/MercatorTest.java | 11 ---- .../ac/AutoCompletionPriorityTest.java | 11 ---- .../data/validation/tests/AddressesTest.java | 12 ----- .../data/validation/tests/CoastlinesTest.java | 11 ---- .../tests/ConnectivityRelationsTest.java | 11 ---- .../validation/tests/DirectionNodesTest.java | 12 ----- .../validation/tests/DuplicateNodeTest.java | 14 +---- .../validation/tests/DuplicateWayTest.java | 12 ----- .../data/validation/tests/HighwaysTest.java | 13 +---- .../validation/tests/InternetTagsTest.java | 11 ---- .../josm/data/validation/tests/LanesTest.java | 2 - .../validation/tests/LongSegmentTest.java | 12 ----- .../validation/tests/NameMismatchTest.java | 12 ----- .../tests/PublicTransportRouteTestTest.java | 11 ---- .../tests/SelfIntersectingWayTest.java | 11 ---- .../validation/tests/SharpAnglesTest.java | 4 +- .../tests/SimilarNamedWaysTest.java | 10 ---- .../validation/tests/UnconnectedWaysTest.java | 4 +- .../data/validation/util/ValUtilTest.java | 11 ---- .../gui/ConditionalOptionPaneUtilTest.java | 11 ---- .../josm/gui/ExceptionDialogUtilTest.java | 11 ---- .../openstreetmap/josm/gui/MapStatusTest.java | 11 ---- .../josm/gui/SystemOfMeasurementTest.java | 11 ---- .../tags/TagConflictResolutionUtilTest.java | 42 ++++----------- .../correction/RoleCorrectionTableTest.java | 15 +----- .../correction/TagCorrectionTableTest.java | 12 ----- .../josm/gui/dialogs/ChangesetDialogTest.java | 11 ---- .../dialogs/properties/TaginfoActionTest.java | 12 ----- .../dialogs/relation/SelectionTableTest.java | 12 ----- .../josm/gui/download/BookmarkListTest.java | 15 +----- .../gui/history/HistoryBrowserDialogTest.java | 12 ----- .../josm/gui/io/ActionFlagsTableCellTest.java | 11 ---- .../josm/gui/io/SaveLayerInfoTest.java | 9 ---- .../josm/gui/io/SaveLayerTaskTest.java | 13 +---- .../io/UploadAndSaveProgressRendererTest.java | 12 ----- .../josm/gui/io/UploadPrimitivesTaskTest.java | 16 +----- .../io/UploadedObjectsSummaryPanelTest.java | 16 +----- .../io/importexport/ImageImporterTest.java | 12 ----- .../gui/io/importexport/NoteImporterTest.java | 9 ---- .../layer/AbstractMapViewPaintableTest.java | 11 ---- .../josm/gui/layer/MapViewPaintableTest.java | 11 ---- .../josm/gui/layer/NativeScaleLayerTest.java | 13 +---- .../josm/gui/layer/NoteLayerTest.java | 12 ----- .../geoimage/CorrelateGpxWithImagesTest.java | 24 +-------- .../gpx/ChooseTrackVisibilityActionTest.java | 12 ----- .../gpx/ConvertToDataLayerActionTest.java | 14 +---- .../imagery/ColorfulImageProcessorTest.java | 11 ---- .../imagery/GammaImageProcessorTest.java | 12 ----- .../imagery/SharpenImageProcessorTest.java | 12 ----- .../layer/markerlayer/AudioMarkerTest.java | 11 ---- .../layer/markerlayer/PlayHeadMarkerTest.java | 11 ---- .../LabelCompositionStrategyTest.java | 12 ----- .../MapCSSWithExtendedTextDirectivesTest.java | 12 ----- .../mapcss/ExpressionFactoryTest.java | 17 ++---- .../advanced/AdvancedPreferenceTest.java | 11 ---- .../preferences/advanced/ListEditorTest.java | 15 +----- .../preferences/advanced/PrefEntryTest.java | 11 ---- .../audio/AudioPreferenceTest.java | 11 ---- .../display/ColorPreferenceTest.java | 11 ---- .../display/DisplayPreferenceTest.java | 11 ---- .../display/DrawingPreferenceTest.java | 11 ---- .../display/GPXPreferenceTest.java | 11 ---- .../display/LafPreferenceTest.java | 11 ---- .../display/LanguagePreferenceTest.java | 11 ---- .../preferences/map/BackupPreferenceTest.java | 11 ---- .../map/MapPaintPreferenceTest.java | 11 ---- .../map/TaggingPresetPreferenceTest.java | 10 ---- .../projection/ProjectionPreferenceTest.java | 11 ---- .../RemoteControlPreferenceTest.java | 11 ---- .../shortcut/ShortcutPreferenceTest.java | 11 ---- .../validator/ValidatorPreferenceTest.java | 11 ---- .../ValidatorTestsPreferenceTest.java | 11 ---- .../tagging/ac/AutoCompletionManagerTest.java | 11 ---- .../presets/PresetClassificationsTest.java | 2 - .../TaggingPresetItemGuiSupportTest.java | 25 +++------ .../presets/TaggingPresetReaderTest.java | 12 ----- .../tagging/presets/TaggingPresetTest.java | 12 ----- .../tagging/presets/items/CheckGroupTest.java | 11 ---- .../presets/items/ItemSeparatorTest.java | 11 ---- .../gui/tagging/presets/items/KeyTest.java | 11 ---- .../gui/tagging/presets/items/LabelTest.java | 11 ---- .../gui/tagging/presets/items/LinkTest.java | 11 ---- .../presets/items/MultiSelectTest.java | 11 ---- .../tagging/presets/items/OptionalTest.java | 11 ---- .../presets/items/PresetListEntryTest.java | 11 ---- .../gui/tagging/presets/items/RolesTest.java | 11 ---- .../gui/tagging/presets/items/SpaceTest.java | 11 ---- .../gui/util/MultiLineFlowLayoutTest.java | 11 ---- .../widgets/AutoAdjustingSplitPaneTest.java | 12 ----- .../org/openstreetmap/josm/io/OsmApiTest.java | 11 ---- .../josm/io/audio/AudioPlayerTest.java | 17 +----- .../josm/io/audio/AudioUtilTest.java | 10 ---- .../josm/io/nmea/NmeaReaderTest.java | 11 ---- .../josm/io/protocols/data/HandlerTest.java | 9 ---- .../josm/io/rtklib/RtkLibPosReaderTest.java | 11 ---- .../testutils/annotations/JosmDefaults.java | 3 +- .../josm/tools/ExifReaderTest.java | 11 ---- .../josm/tools/PlatformHookOsxTest.java | 2 - .../josm/tools/PlatformHookTestIT.java | 14 +---- .../josm/tools/ShortcutTest.java | 11 ---- .../template_engine/TemplateEntryTest.java | 11 ---- .../template_engine/TemplateParserTest.java | 11 ---- 187 files changed, 143 insertions(+), 2228 deletions(-) diff --git a/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java b/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java index 6c7a9ed0dba..489bc714304 100644 --- a/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java +++ b/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java @@ -5,24 +5,13 @@ import java.io.IOException; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; -import org.openstreetmap.josm.JOSMFixture; +import org.junit.jupiter.api.Test; /** * Tests the {@link GettingStarted} class. */ class GettingStartedTest { - - /** - * Setup test. - */ - @BeforeAll - public static void init() { - JOSMFixture.createFunctionalTestFixture().init(); - } - /** * Tests that image links are replaced. * diff --git a/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java b/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java index 65ad89759e5..35c0d629157 100644 --- a/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java +++ b/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java @@ -5,7 +5,6 @@ import javax.swing.JFrame; -import org.junit.jupiter.api.BeforeAll; import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.data.osm.SimplePrimitiveId; @@ -18,11 +17,6 @@ class HistoryBrowserTestFT extends JFrame { - @BeforeAll - public static void init() { - JOSMFixture.createFunctionalTestFixture().init(); - } - private HistoryBrowser browser; protected void build() { @@ -56,7 +50,7 @@ protected void populate(OsmPrimitiveType type, long id) { } public static void main(String[] args) { - HistoryBrowserTestFT.init(); + JOSMFixture.createFunctionalTestFixture().init(); new HistoryBrowserTestFT().setVisible(true); } } diff --git a/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java b/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java index 8b476bf75e8..8938623557c 100644 --- a/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java +++ b/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java @@ -24,38 +24,25 @@ import javax.swing.ImageIcon; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; import org.openstreetmap.josm.gui.tagging.presets.items.Key; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.xml.sax.SAXException; import com.kitfox.svg.SVGConst; - import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link ImageProvider} class. */ class ImageProviderTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static final class LogHandler14319 extends Handler { boolean failed; @@ -75,14 +62,6 @@ public void close() throws SecurityException { } } - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - @BeforeEach public void resetPixelDensity() { GuiSizesHelper.setPixelDensity(1.0f); diff --git a/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java b/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java index 16be1d91c90..d7c9c9698e4 100644 --- a/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java +++ b/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java @@ -4,23 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Integration tests of {@link ImageProvider} class. */ class ImageProviderTestIT { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test fetching an image using {@code wiki://} protocol. */ diff --git a/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java b/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java index 8750a83dbc7..f4d278dbba9 100644 --- a/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java +++ b/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java @@ -10,30 +10,18 @@ import javax.swing.JFrame; import javax.swing.JPanel; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.junit.jupiter.api.Test; /** * Unit tests of {@link ImageProvider} class for manual execution. */ class ImageProviderTestManual { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test getting a cursor * @throws InterruptedException in case of thread interruption */ - @Disabled("manual execution only, as the look of the cursor cannot be checked automatedly") + @Disabled("manual execution only, as the look of the cursor cannot be checked automatically") @Test void testGetCursor() throws InterruptedException { JFrame frame = new JFrame(); diff --git a/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java b/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java index 9e88c5c1786..e3ff36a36a1 100644 --- a/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java +++ b/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java @@ -11,10 +11,8 @@ import java.nio.file.Files; import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.PerformanceTestUtils; import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; import org.openstreetmap.josm.data.osm.DataSet; @@ -30,14 +28,6 @@ class OsmReaderPerformanceTest { private static final int TIMES = 4; - /** - * Prepare the test. - */ - @BeforeAll - public static void createJOSMFixture() { - JOSMFixture.createPerformanceTestFixture().init(true); - } - /** * Simulates a plain read of a .osm.bz2 file (from memory) * @throws Exception if an error occurs diff --git a/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java b/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java index 400ebcd2710..f9e9d5d2e0c 100644 --- a/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java +++ b/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java @@ -1,19 +1,17 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.io; -import org.junit.jupiter.api.BeforeAll; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.concurrent.TimeUnit; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.PerformanceTestUtils; import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; import org.openstreetmap.josm.data.osm.DataSet; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.concurrent.TimeUnit; - /** * This test tests how fast we are at writing an OSM file. *

@@ -24,14 +22,6 @@ class OsmWriterPerformanceTest { private static final int TIMES = 4; private DataSet neubrandenburgDataSet; - /** - * Prepare the test. - */ - @BeforeAll - public static void createJOSMFixture() { - JOSMFixture.createPerformanceTestFixture().init(true); - } - /** * Setup test * @throws Exception if an error occurs diff --git a/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java index 56b57a49558..ff5b0b789f8 100644 --- a/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java +++ b/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java @@ -14,7 +14,6 @@ import java.util.List; import java.util.Set; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.osm.DataSet; @@ -23,23 +22,13 @@ import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.io.IllegalDataException; import org.openstreetmap.josm.io.OsmReader; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; /** * Unit tests for class {@link CombineWayAction}. */ class CombineWayActionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Non-regression test for bug #11957. * @throws IOException if any I/O error occurs diff --git a/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java b/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java index 7bf736efeb8..4597bc4fdb4 100644 --- a/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java +++ b/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java @@ -3,27 +3,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.Tag; import org.openstreetmap.josm.data.osm.Tagged; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link ReverseWayNoTagCorrector} class. */ class ReverseWayNoTagCorrectorTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests the {@link ReverseWayNoTagCorrector#getDirectionalTags} function */ diff --git a/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java b/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java index de42aab6d21..6844d587fbc 100644 --- a/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java +++ b/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java @@ -11,30 +11,19 @@ import java.util.stream.Stream; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.correction.TagCorrection; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.OsmUtils; import org.openstreetmap.josm.data.osm.Tag; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests of {@link ReverseWayTagCorrector} class. */ class ReverseWayTagCorrectorTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code ReverseWayTagCorrector.TagSwitcher} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java index 5c17f989448..02103546d57 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java @@ -1,30 +1,19 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.actions.downloadtasks; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; import java.awt.Component; import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link ChangesetContentDownloadTask}. */ class ChangesetContentDownloadTaskTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask}. */ @@ -33,9 +22,9 @@ void testChangesetContentDownloadTask() { Component parent = new Component() { // empty component }; - assertNotNull(new ChangesetContentDownloadTask(parent, 1)); - assertNotNull(new ChangesetContentDownloadTask(parent, Arrays.asList(1, 2))); - assertNotNull(new ChangesetContentDownloadTask(parent, null)); + assertDoesNotThrow(() -> new ChangesetContentDownloadTask(parent, 1)); + assertDoesNotThrow(() -> new ChangesetContentDownloadTask(parent, Arrays.asList(1, 2))); + assertDoesNotThrow(() -> new ChangesetContentDownloadTask(parent, null)); } /** @@ -59,6 +48,7 @@ void testChangesetContentDownloadTaskNullParent1() { */ @Test void testChangesetContentDownloadTaskNullParent2() { - assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(Arrays.asList(1, 2))); + final List toDownload = Arrays.asList(1, 2); + assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(toDownload)); } } diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java index eae205297e9..843bfe750b0 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java @@ -5,27 +5,16 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import java.awt.Component; +import java.util.Collection; import java.util.Collections; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.Changeset; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link ChangesetHeaderDownloadTask}. */ class ChangesetHeaderDownloadTaskTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@code ChangesetHeaderDownloadTask#buildTaskForChangesets}. */ @@ -35,7 +24,7 @@ void testBuildTaskForChangesets() { // empty component }; assertNotNull(ChangesetHeaderDownloadTask.buildTaskForChangesets(parent, Collections.singleton(new Changeset(1)))); - assertNotNull(ChangesetHeaderDownloadTask.buildTaskForChangesets(parent, Collections.singleton(null))); + assertNotNull(ChangesetHeaderDownloadTask.buildTaskForChangesets(parent, Collections.singleton(null))); assertNotNull(ChangesetHeaderDownloadTask.buildTaskForChangesets(parent, null)); } @@ -44,7 +33,8 @@ void testBuildTaskForChangesets() { */ @Test void testBuildTaskForChangesetsNullParent() { + final Collection changesets = Collections.singleton(new Changeset(1)); assertThrows(NullPointerException.class, - () -> ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1)))); + () -> ChangesetHeaderDownloadTask.buildTaskForChangesets(changesets)); } } diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java index ad37c178c5d..01f44e27702 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java @@ -1,30 +1,18 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.actions.downloadtasks; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; import java.awt.Component; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.io.ChangesetQuery; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link ChangesetQueryTask}. */ class ChangesetQueryTaskTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@code ChangesetQueryTask#ChangesetQueryTask}. */ @@ -33,7 +21,7 @@ void testChangesetQueryTask() { Component parent = new Component() { // empty component }; - assertNotNull(new ChangesetQueryTask(parent, new ChangesetQuery())); + assertDoesNotThrow(() -> new ChangesetQueryTask(parent, new ChangesetQuery())); } /** @@ -41,6 +29,7 @@ void testChangesetQueryTask() { */ @Test void testChangesetQueryTaskNullParent() { - assertThrows(IllegalArgumentException.class, () -> new ChangesetQueryTask(new ChangesetQuery())); + final ChangesetQuery query = new ChangesetQuery(); + assertThrows(IllegalArgumentException.class, () -> new ChangesetQueryTask(query)); } } diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java index 26896ee9b98..1246123a001 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java @@ -1,33 +1,21 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.actions.downloadtasks; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link DownloadReferrersTask}. */ class DownloadReferrersTaskTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@code DownloadReferrersTask#DownloadReferrersTask}. */ @@ -41,14 +29,11 @@ void testDownloadReferrersTask() { ds.addPrimitive(n1); ds.addPrimitive(n2); OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); - assertNotNull(new DownloadReferrersTask(layer, null)); - assertNotNull(new DownloadReferrersTask(layer, ds.allPrimitives())); - try { - new DownloadReferrersTask(layer, n1.getPrimitiveId(), null); - fail(); - } catch (IllegalArgumentException e) { - assertEquals("Cannot download referrers for new primitives (ID -1)", e.getMessage()); - } - assertNotNull(new DownloadReferrersTask(layer, n2.getPrimitiveId(), null)); + assertDoesNotThrow(() -> new DownloadReferrersTask(layer, null)); + assertDoesNotThrow(() -> new DownloadReferrersTask(layer, ds.allPrimitives())); + IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, + () -> new DownloadReferrersTask(layer, n1, null)); + assertEquals("Cannot download referrers for new primitives (ID -1)", iae.getMessage()); + assertDoesNotThrow(() -> new DownloadReferrersTask(layer, n2.getPrimitiveId(), null)); } } diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java index 21d4f7bf551..ce5a1be6ea2 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java @@ -1,32 +1,20 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.actions.downloadtasks; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.awt.geom.Area; import java.util.Collections; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link DownloadTaskList}. */ class DownloadTaskListTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@code DownloadTaskList#DownloadTaskList}. */ @@ -49,7 +37,7 @@ void testDownloadAreaEmpty() throws Exception { Collections.emptyList(), false, false, NullProgressMonitor.INSTANCE).get()); assertTrue(list.getDownloadedPrimitives().isEmpty()); assertNull(list.download(false, - Collections.singletonList(new Area(new Bounds(0, 0, true).asRect())), false, false, NullProgressMonitor.INSTANCE).get()); + Collections.singletonList(new Area(new Bounds(0, 0, true).asRect())), false, false, NullProgressMonitor.INSTANCE).get()); assertTrue(list.getDownloadedPrimitives().isEmpty()); } } diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java index b9a0c38a2ac..37daf66b992 100644 --- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java +++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java @@ -13,26 +13,14 @@ import java.util.concurrent.TimeoutException; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.gui.progress.ProgressMonitor; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests for class {@link PostDownloadHandler}. */ class PostDownloadHandlerTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static DownloadTask newTask(final List errorObjects) { return new DownloadTask() { @Override diff --git a/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java b/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java index c95abf51b91..b7211958e78 100644 --- a/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java @@ -1,16 +1,13 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -18,14 +15,6 @@ * Unit tests of {@link TransformNodesCommand} class. */ class TransformNodesCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link TransformNodesCommand#equals} and {@link TransformNodesCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java index 747faab2273..8caa468de44 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.command.CommandTest.CommandTestData; import org.openstreetmap.josm.data.conflict.Conflict; @@ -16,9 +15,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -26,13 +23,6 @@ * Unit tests of {@link ConflictAddCommand} class. */ class ConflictAddCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); private CommandTestData testData; /** diff --git a/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java index 8e44acbd643..51c3caaa1e9 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -9,9 +8,7 @@ import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -19,14 +16,6 @@ * Unit tests of {@link ConflictResolveCommand} class. */ class ConflictResolveCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link ConflictResolveCommand#equals} and {@link ConflictResolveCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java index 3df638713c0..dedbb28180b 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.command.CommandTest.CommandTestData; import org.openstreetmap.josm.data.conflict.Conflict; @@ -18,9 +17,7 @@ import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -31,13 +28,6 @@ class CoordinateConflictResolveCommandTest { private CommandTestData testData; - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Setup test. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java index c9f3021da05..809de785142 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link DeletedStateConflictResolveCommand} class. */ class DeletedStateConflictResolveCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link DeletedStateConflictResolveCommand#equals} and {@link DeletedStateConflictResolveCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java index 0058492ab31..82a6398221e 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link ModifiedConflictResolveCommand} class. */ class ModifiedConflictResolveCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link ModifiedConflictResolveCommand#equals} and {@link ModifiedConflictResolveCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java index 5188728052d..05340a07705 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link RelationMemberConflictResolverCommand} class. */ class RelationMemberConflictResolverCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link RelationMemberConflictResolverCommand#equals} and {@link RelationMemberConflictResolverCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java index 3d29070d9b1..3150f439598 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link TagConflictResolveCommand} class. */ class TagConflictResolveCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link TagConflictResolveCommand#equals} and {@link TagConflictResolveCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java index f18e124848e..cb244a31c42 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link VersionConflictResolveCommand} class. */ class VersionConflictResolveCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link VersionConflictResolveCommand#equals} and {@link VersionConflictResolveCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java index 86f49882e5e..472a511936c 100644 --- a/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java +++ b/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java @@ -1,7 +1,6 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.command.conflict; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.conflict.Conflict; @@ -10,9 +9,7 @@ import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests of {@link WayNodesConflictResolverCommand} class. */ class WayNodesConflictResolverCommandTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link WayNodesConflictResolverCommand#equals} and {@link WayNodesConflictResolverCommand#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java b/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java index f57a305d34d..f31c36b94af 100644 --- a/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java +++ b/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java @@ -3,12 +3,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.conflict.ConflictCollection; import org.openstreetmap.josm.data.osm.CyclicUploadDependencyException; @@ -18,22 +17,11 @@ import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link APIDataSet}. */ class APIDataSetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @Test void testOneNewRelationOnly() throws CyclicUploadDependencyException { Relation r = new Relation(); @@ -249,11 +237,6 @@ void testOneCycle() { APIDataSet apiDataSet = new APIDataSet(); apiDataSet.init(ds); - try { - apiDataSet.adjustRelationUploadOrder(); - fail("expected cyclic upload dependency exception not thrown"); - } catch (CyclicUploadDependencyException e) { - System.out.println(e); - } + assertThrows(CyclicUploadDependencyException.class, apiDataSet::adjustRelationUploadOrder); } } diff --git a/test/unit/org/openstreetmap/josm/data/VersionTest.java b/test/unit/org/openstreetmap/josm/data/VersionTest.java index f6e9d635647..ea6b79c7dad 100644 --- a/test/unit/org/openstreetmap/josm/data/VersionTest.java +++ b/test/unit/org/openstreetmap/josm/data/VersionTest.java @@ -7,23 +7,12 @@ import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; /** * Unit tests for class {@link Version}. */ class VersionTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link Version#getAgentString} */ diff --git a/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java b/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java index be506590dc6..c54fdf8b410 100644 --- a/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java +++ b/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java @@ -3,12 +3,9 @@ import java.text.DecimalFormat; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -16,14 +13,6 @@ * Unit tests for class {@link CachedLatLon}. */ class CachedLatLonTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link CachedLatLon#equals} and {@link CachedLatLon#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java b/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java index 45d14c0e145..b46122bb38d 100644 --- a/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java +++ b/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java @@ -1,26 +1,15 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.correction; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; /** * Unit tests for class {@link TagCorrection}. */ class TagCorrectionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link TagCorrection#equals} and {@link TagCorrection#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionCollectionTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionCollectionTest.java index 5d8a72d7611..bfeac6827df 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionCollectionTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionCollectionTest.java @@ -8,25 +8,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; import org.xml.sax.helpers.AttributesImpl; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link GpxExtensionCollection}. */ class GpxExtensionCollectionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @BeforeEach void before() { Logging.clearLastErrorAndWarnings(); diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java index df15a3c88f5..3c0c78de778 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java @@ -1,15 +1,12 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.gpx; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.gui.layer.gpx.ConvertToDataLayerActionTest; import org.openstreetmap.josm.io.GpxReaderTest; import org.openstreetmap.josm.io.GpxWriterTest; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -17,14 +14,6 @@ * Unit tests for class {@link GpxExtension} */ class GpxExtensionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link GpxExtension#equals} and {@link GpxExtension#hashCode}. * @see GpxWriterTest#testExtensions() diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java index b3e8a86ec6c..ad5029fba35 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java @@ -17,34 +17,23 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.TestMethodOrder; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.CachedLatLon; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.io.GpxReaderTest; import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.spi.preferences.IPreferences; -import org.openstreetmap.josm.testutils.JOSMTestRules; +import org.openstreetmap.josm.testutils.annotations.Timezone; import org.openstreetmap.josm.tools.date.DateUtils; -import org.openstreetmap.josm.tools.date.DateUtilsTest; import org.xml.sax.SAXException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link GpxImageCorrelation} class. */ -@TestMethodOrder(MethodName.class) @TestInstance(Lifecycle.PER_CLASS) +@TestMethodOrder(MethodName.class) +@Timezone class GpxImageCorrelationTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - GpxData gpx; GpxImageEntry ib, i0, i1, i2, i3, i4, i5, i6, i7; List images; @@ -58,7 +47,6 @@ class GpxImageCorrelationTest { @BeforeAll public void setUp() throws IOException, SAXException { s = Config.getPref(); - DateUtilsTest.setTimeZone(DateUtils.UTC); gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx"); assertEquals(5, gpx.tracks.size()); @@ -108,7 +96,7 @@ void clearTmp() { /** * Tests matching of images to a GPX track. - * + *

* TEST #1: default settings * tag images within 2 minutes to tracks/segments, interpolate between segments only */ @@ -156,7 +144,7 @@ void testMatchGpxTrack1() { /** * Tests matching of images to a GPX track. - * + *

* TEST #2: Disable all interpolation and tagging close to tracks. Only i1-i4 are tagged */ @Test @@ -180,7 +168,7 @@ void testMatchGpxTrack2() { /** * Tests matching of images to a GPX track. - * + *

* TEST #3: Disable all interpolation and allow tagging within 1 minute of a track. i0-i5 are tagged. * i6 will not be tagged, because it's 68 seconds away from the next waypoint in either direction * i7 will keep the old position @@ -209,7 +197,7 @@ void testMatchGpxTrack3() { /** * Tests matching of images to a GPX track. - * + *

* TEST #4: Force tagging (parameter forceTags=true, no change of configuration). All images will be tagged * i5-i6 will now be interpolated, therefore it will have an elevation and different coordinates than in tests above * i7 will be at the end of the track @@ -235,7 +223,7 @@ void testMatchGpxTrack4() { /** * Tests matching of images to a GPX track. - * + *

* TEST #5: Force tagging (parameter forceTags=false, but configuration changed). * Results same as #4 */ @@ -272,7 +260,7 @@ void testMatchGpxTrack5() { /** * Tests matching of images to a GPX track. - * + *

* TEST #6: Disable tagging but allow interpolation when tracks are less than 500m apart. i0-i4 are tagged. * i5-i6 will not be tagged, because the tracks are 897m apart. * not checking all the coordinates again, did that 5 times already, just the number of matched images @@ -292,7 +280,7 @@ void testMatchGpxTrack6() { /** * Tests matching of images to a GPX track. - * + *

* TEST #7: Disable tagging but allow interpolation when tracks are less than 1000m apart. i0-i6 are tagged. * i5-i6 will be tagged, because the tracks are 897m apart. */ @@ -311,7 +299,7 @@ void testMatchGpxTrack7() { /** * Tests matching of images to a GPX track. - * + *

* TEST #8: Disable tagging but allow interpolation when tracks are less than 2 min apart. i0-i4 are tagged. * i5-i6 will not be tagged, because the tracks are 2.5min apart. */ @@ -330,7 +318,7 @@ void testMatchGpxTrack8() { /** * Tests matching of images to a GPX track. - * + *

* TEST #9: Disable tagging but allow interpolation when tracks are less than 3 min apart. i0-i6 are tagged. * i5-i6 will be tagged, because the tracks are 2.5min apart. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java index 49d2f3b0a44..76ef910be9a 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java @@ -3,12 +3,9 @@ import java.io.File; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -16,14 +13,6 @@ * Unit tests of {@link GpxImageEntry} class. */ class GpxImageEntryTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link GpxImageEntry#equals} and {@link GpxImageEntry#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java index effa6d57c99..9c411b95e69 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java @@ -5,35 +5,14 @@ import java.text.ParseException; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import org.openstreetmap.josm.tools.date.DateUtils; -import org.openstreetmap.josm.tools.date.DateUtilsTest; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.openstreetmap.josm.testutils.annotations.Timezone; /** * Unit tests of {@link GpxTimeOffset} class. */ +@Timezone class GpxOffsetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - DateUtilsTest.setTimeZone(DateUtils.UTC); - } - /** * Unit test of {@link GpxTimeOffset#formatOffset}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java index 9dd58242980..c0260a79431 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java @@ -1,13 +1,10 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.gpx; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -15,14 +12,6 @@ * Unit tests for class {@link GpxRoute}. */ class GpxRouteTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link GpxRoute#equals} and {@link GpxRoute#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java index fea6f91a5e0..47bed74793a 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java @@ -5,35 +5,14 @@ import java.text.ParseException; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import org.openstreetmap.josm.tools.date.DateUtils; -import org.openstreetmap.josm.tools.date.DateUtilsTest; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.openstreetmap.josm.testutils.annotations.Timezone; /** * Unit tests of {@link GpxTimezone} class. */ +@Timezone class GpxTimezoneTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - DateUtilsTest.setTimeZone(DateUtils.UTC); - } - /** * Unit test of {@link GpxTimezone#formatTimezone}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java index d80255717e3..0ba7ddbe182 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java @@ -1,13 +1,10 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.gpx; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -15,14 +12,6 @@ * Unit tests for class {@link GpxTrackSegment}. */ class GpxTrackSegmentTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link GpxTrackSegment#equals} and {@link GpxTrackSegment#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java index 9559aec25ba..aadcd78bc4c 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java @@ -9,12 +9,9 @@ import java.util.HashMap; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.ListenerList; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -22,14 +19,6 @@ * Unit tests for class {@link GpxTrack}. */ class GpxTrackTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests whether the track can read and write colors. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java b/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java index f92ca829edb..f2aceef74c2 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java @@ -1,33 +1,22 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.gpx; -import org.junit.jupiter.api.extension.RegisterExtension; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import java.time.Instant; + import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; -import java.time.Instant; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; - /** * Unit tests for class {@link WayPoint}. */ class WayPointTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link WayPoint#equals} and {@link WayPoint#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java b/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java index 63696741735..74ea8fabbf2 100644 --- a/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java +++ b/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java @@ -1,12 +1,9 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.gpx; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -14,14 +11,6 @@ * Unit tests for class {@link WithAttributes}. */ class WithAttributesTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link WithAttributes#equals} and {@link WithAttributes#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java b/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java index f012d5e1f94..f574185da23 100644 --- a/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java +++ b/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java @@ -3,25 +3,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests for class {@link GetCapabilitiesParseHelper}. */ class GetCapabilitiesParseHelperTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code GetCapabilitiesParseHelper} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java b/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java index a369daaf1c4..90d292ecada 100644 --- a/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java +++ b/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java @@ -10,27 +10,15 @@ import java.util.Set; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.StructUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.MultiMap; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * * Unit tests for class {@link ImageryInfo}. * */ class ImageryInfoTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test if extended URL is returned properly */ diff --git a/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java b/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java index f76f016cfb3..67f0a378388 100644 --- a/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java +++ b/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java @@ -8,30 +8,25 @@ import java.util.Collections; import java.util.stream.Stream; -import org.openstreetmap.gui.jmapviewer.Tile; -import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; -import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.data.cache.JCSCacheManager; -import org.openstreetmap.josm.data.imagery.ImageryInfo; -import org.openstreetmap.josm.data.imagery.TileJobOptions; -import org.openstreetmap.josm.testutils.JOSMTestRules; - import org.awaitility.Awaitility; import org.awaitility.Durations; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.openstreetmap.gui.jmapviewer.Tile; +import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; +import org.openstreetmap.josm.TestUtils; +import org.openstreetmap.josm.data.cache.JCSCacheManager; +import org.openstreetmap.josm.data.imagery.ImageryInfo; +import org.openstreetmap.josm.data.imagery.TileJobOptions; /** * Test class for {@link MVTTile} */ -public class MVTTileTest { +class MVTTileTest { private MapboxVectorTileSource tileSource; private MapboxVectorCachedTileLoader loader; - @RegisterExtension - JOSMTestRules rule = new JOSMTestRules(); @BeforeEach void setup() { tileSource = new MapboxVectorTileSource(new ImageryInfo("Test Mapillary", "file:/" + TestUtils.getTestDataRoot() diff --git a/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java b/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java index 17a080c66a8..6152ce32673 100644 --- a/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java +++ b/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java @@ -7,24 +7,12 @@ import java.time.Instant; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link NoteComment}. */ class NoteCommentTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link NoteComment} class. */ diff --git a/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java b/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java index a746791a6fb..4e2389ea920 100644 --- a/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java +++ b/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java @@ -7,14 +7,11 @@ import java.time.Instant; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.io.NoteReader; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -22,14 +19,6 @@ * Unit tests for class {@link NoteComment}. */ class NoteTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link Note#toString} method. */ diff --git a/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java b/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java index 2455b407e4c..16f12b4b853 100644 --- a/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java +++ b/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java @@ -5,11 +5,9 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.spi.preferences.Config; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -19,14 +17,6 @@ * Unit tests for class {@link OAuthParameters}. */ class OAuthParametersTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of method {@link OAuthParameters#createDefault}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java b/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java index 1c4cd87d671..2f827585148 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java @@ -6,24 +6,12 @@ import java.util.Collections; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of the {@code AbstractPrimitive} class. */ class AbstractPrimitiveTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link AbstractPrimitive#isUndeleted} method. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java b/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java index 3c554d6371b..8a800418176 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java @@ -6,13 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -20,14 +17,6 @@ * Unit tests for class {@link BBox}. */ class BBoxTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link BBox#equals} and {@link BBox#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java b/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java index 68fd187c33f..fc4a97b13b9 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java @@ -15,27 +15,15 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.UserIdentityManager; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.tools.Logging; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit test of {@link ChangesetCache} */ @BasicPreferences class ChangesetCacheTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static final ChangesetCache cache = ChangesetCache.getInstance(); /** @@ -48,7 +36,7 @@ public void clearCache() { cache.clear(); } - abstract class TestListener implements ChangesetCacheListener { + abstract static class TestListener implements ChangesetCacheListener { protected final CountDownLatch latch = new CountDownLatch(1); protected ChangesetCacheEvent event; @@ -71,7 +59,7 @@ protected final void await() { } /** - * Unit test of {@link ChangesetCache#ChangesetCache} + * Unit test of {@link ChangesetCache#getInstance()} */ @Test void testConstructor() { diff --git a/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java b/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java index 945f450e704..b73904efb29 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java @@ -9,30 +9,18 @@ import java.time.Instant; import java.util.Iterator; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetDataSetEntry; import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType; import org.openstreetmap.josm.data.osm.history.HistoryNode; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests for class {@link ChangesetDataSet}. */ class ChangesetDataSetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of method {@link ChangesetDataSet#iterator}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java b/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java index 570fb740f91..405b4aef718 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java @@ -5,24 +5,12 @@ import java.time.Instant; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link ChangesetDiscussionComment}. */ class ChangesetDiscussionCommentTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link ChangesetDiscussionComment} constructor. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java b/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java index db79eae68d6..0b12470601d 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java @@ -16,11 +16,9 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -29,14 +27,6 @@ * Unit tests for class {@link Changeset}. */ class ChangesetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of method {@link Changeset#setKeys}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java b/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java index 071ea2df4b4..8e2ab5dead4 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java @@ -4,24 +4,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link DataIntegrityProblemException}. */ class DataIntegrityProblemExceptionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link DataIntegrityProblemException} constructor. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java b/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java index 370cefc1748..f2f0f71875c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java @@ -17,27 +17,15 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.projection.ProjectionRegistry; import org.openstreetmap.josm.data.projection.Projections; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link DataSetMerger}. */ class DataSetMergerTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private DataSet my; private DataSet their; @@ -75,7 +63,7 @@ public void checkDatasets() { /** * two identical nodes, even in id and version. No conflict expected. - * + *

* Can happen if data is loaded in two layers and then merged from one layer * on the other. */ @@ -149,7 +137,7 @@ void testNodeSimpleLocallyUnmodifiedNoConflict() { /** * Node with same id, my is modified, their has a higher version * => results in a conflict - * + *

* Use case: node which is modified locally and updated by another mapper on * the server */ @@ -183,7 +171,7 @@ void testNodeSimpleTagConflict() { /** * node with same id, my is deleted, their has a higher version * => results in a conflict - * + *

* Use case: node which is deleted locally and updated by another mapper on * the server */ @@ -242,7 +230,7 @@ void testNodeSimpleDeleteConflict2() { /** * My and their node are new but semantically equal. My node is deleted. - * + *

* => Ignore my node, no conflict */ @Test @@ -265,7 +253,7 @@ void testNodeSimpleDeleteConflict3() { /** * My and their node are new but semantically equal. Both are deleted. - * + *

* => take mine */ @Test @@ -290,7 +278,7 @@ void testNodeSimpleDeleteConflict4() { /** * their node has no assigned id (id == 0) and is semantically equal to one of my * nodes with id == 0 - * + *

* => merge it onto my node. */ @Test @@ -330,7 +318,7 @@ void testNodeSimpleNoIdSemanticallyEqual() { /** * my node is incomplete, their node is complete - * + *

* => merge it onto my node. My node becomes complete */ @Test @@ -360,7 +348,7 @@ void testNodeSimpleIncompleteNode() { /** * their way has a higher version and different tags. the nodes are the same. My * way is not modified. Merge is possible. No conflict. - * + *

* => merge it onto my way. */ @Test @@ -432,7 +420,7 @@ void testWaySimpleIdenticalNodesDifferentTags() { /** * their way has a higher version and different tags. And it has more nodes. Two * of the existing nodes are modified. - * + *

* => merge it onto my way, no conflict */ @Test @@ -493,7 +481,7 @@ void testWaySimpleAdditionalNodesAndChangedNodes() { assertEquals("value1", merged.getNode(2).get("key1")); assertSame(merged.getNode(0), n1); - assertNotSame(merged.getNode(1), n5); // must be clone of the original node in their + assertNotSame(merged.getNode(1), n5); // must be a clone of the original node in their assertSame(merged.getNode(2), n2); assertFalse(merged.isModified()); // the target wasn't modified before merging, it mustn't be after merging @@ -501,7 +489,7 @@ void testWaySimpleAdditionalNodesAndChangedNodes() { /** * their way has a higher version and different nodes. My way is modified. - * + *

* => merge onto my way not possible, create a conflict */ @Test @@ -565,7 +553,7 @@ void testWaySimpleDifferentNodesAndMyIsModified() { /** * their way is not visible anymore. - * + *

* => conflict */ @Test @@ -718,7 +706,7 @@ void testWaySimpleTwoWaysWithNoIdNodesWithoutId() { /** * My dataset includes a deleted node. * Their dataset includes a way with three nodes, the first one being my node. - * + *

* => the merged way should include all three nodes. Deleted node should have deleted=false and * special conflict with isDeleted should exist */ @@ -772,7 +760,7 @@ void testWayComplexMergingADeletedNode() { /** * My dataset includes a deleted node. * Their dataset includes a relation with three nodes, the first one being my node. - * + *

* => the merged relation should include all three nodes. There should be conflict for deleted * node with isMyDeleted set */ @@ -822,7 +810,7 @@ void testRelationComplexMergingADeletedNode() { /** * Merge an incomplete way with two incomplete nodes into an empty dataset. - * + *

* Use case: a way loaded with a multiget, i.e. GET /api/0.6/ways?ids=123456 */ @Test @@ -864,8 +852,8 @@ void testNewIncompleteWay() { /** * Merge an incomplete way with two incomplete nodes into a dataset where the way already exists as complete way. - * - * Use case: a way loaded with a multiget, i.e. GET /api/0.6/ways?ids=123456 after a "Update selection " of this way + *

+ * Use case: a way loaded with a multiget, i.e. GET /api/0.6/ways?ids=123456 after an "Update selection " of this way */ @Test void testIncompleteWayOntoCompleteWay() { @@ -927,7 +915,7 @@ void testTwoCompleteNodesOntoAnIncompleteWay() { // -- source dataset - // an complete node + // a complete node Node n1 = new Node(1, 1); n1.setCoor(new LatLon(1, 1)); their.addPrimitive(n1); @@ -991,7 +979,7 @@ void testSameVersionAndDifferentVisibility() { their.addPrimitive(n1); // --- target dataset - // an complete node + // a complete node Node n1b = new Node(1, 2); n1b.setCoor(new LatLon(1, 1)); n1b.setVisible(false); @@ -1097,7 +1085,7 @@ void testDeletedWayNoReferrers() { } /** - * Dependency loop in relations,, both deleted in source + * Dependency loop in relations, both deleted in source * => make sure that DataIntegrityProblemException is thrown. */ @Test diff --git a/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java b/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java index 64be651ae0e..1d94988814b 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java @@ -13,29 +13,17 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.DataSource; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.event.DataSourceAddedEvent; import org.openstreetmap.josm.data.osm.event.DataSourceRemovedEvent; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link DataSet}. */ class DataSetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of method {@link DataSet#searchRelations}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java b/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java index b331138f463..93f03600ced 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java @@ -15,7 +15,6 @@ import java.util.LinkedList; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; @@ -24,9 +23,7 @@ import org.openstreetmap.josm.data.osm.search.SearchParseError; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.io.OsmReader; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -34,14 +31,6 @@ * Unit tests for class {@link Filter}. */ class FilterTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @Test void testBasic() throws SearchParseError { DataSet ds = new DataSet(); diff --git a/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java b/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java index af1c64035c9..723125eeb60 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java @@ -8,24 +8,12 @@ import java.util.Collections; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of the {@code NodeGraph} class. */ class NodeGraphTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link NodeGraph#buildNodePairs} and {@link NodeGraph#eliminateDuplicateNodePairs} */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java index a46f24da1cf..7e62cdddba4 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java @@ -6,29 +6,19 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.extension.RegisterExtension; +import java.util.Collections; +import java.util.HashSet; + import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import java.util.Collections; -import java.util.HashSet; - /** * Some unit test cases for basic tag management on {@link OsmPrimitive}. Uses * {@link Node} for the tests, {@link OsmPrimitive} is abstract. */ class OsmPrimitiveKeyHandlingTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * test query and get methods on a node withouth keys */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java index 0117e02bf83..add550a0fd7 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java @@ -9,26 +9,14 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.projection.ProjectionRegistry; import org.openstreetmap.josm.data.projection.Projections; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of the {@code OsmPrimitive} class. */ class OsmPrimitiveTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private void compareReferrers(OsmPrimitive actual, OsmPrimitive... expected) { assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(actual.getReferrers())); } diff --git a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java index 2bb7b282e0b..2253341805f 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java @@ -5,30 +5,18 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of the {@code OsmPrimitiveType} class. */ class OsmPrimitiveTypeTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link OsmPrimitiveType} enum. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java b/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java index bfd30dffff6..2907d7fed3b 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java @@ -5,30 +5,18 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.stream.Collectors; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link OsmUtils}. */ class OsmUtilsTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link OsmUtils#createPrimitive} */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java b/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java index 07c344a0182..a8a82214daf 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java @@ -18,29 +18,17 @@ import java.util.List; import java.util.Random; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.projection.ProjectionRegistry; import org.openstreetmap.josm.data.projection.Projections; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.io.OsmReader; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link QuadBuckets}. */ class QuadBucketsTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @SuppressWarnings("unchecked") private void removeAllTest(DataSet ds) throws ReflectiveOperationException { List allNodes = new ArrayList<>(ds.getNodes()); diff --git a/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java b/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java index 33f3295fc69..0067b73f251 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java @@ -3,25 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; class RelationTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @Test void testCreateNewRelation() { assertThrows(NullPointerException.class, () -> new Relation(null)); diff --git a/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java b/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java index 083556103d2..b7a34c4391c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java @@ -1,12 +1,9 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.osm; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -14,14 +11,6 @@ * Unit tests for class {@link Storage}. */ class StorageTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link Storage#equals} and {@link Storage#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/UserTest.java b/test/unit/org/openstreetmap/josm/data/osm/UserTest.java index 7a899bc6524..8c3a262e263 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/UserTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/UserTest.java @@ -5,24 +5,12 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests of {@link User}. */ class UserTest { - - /** - * Setup test - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test method for {@link User#createOsmUser}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java b/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java index a7490154981..ab0da6e26cb 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java @@ -6,25 +6,13 @@ import java.util.Arrays; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of the {@code WaySegment} class. */ class WaySegmentTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @Test void testForNodePair() { final DataSet ds = new DataSet(); diff --git a/test/unit/org/openstreetmap/josm/data/osm/WayTest.java b/test/unit/org/openstreetmap/josm/data/osm/WayTest.java index 0838f4daae7..f598bb316c8 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/WayTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/WayTest.java @@ -3,16 +3,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.coor.LatLon; /** @@ -20,15 +18,6 @@ * @since 11270 */ class WayTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test BBox calculation with Way */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java index 2f05860860a..2020bc5f808 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link ChangesetIdChangedEvent} class. */ class ChangesetIdChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link ChangesetIdChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java index 7774d399eca..144b57a2ddc 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link DataChangedEvent} class. */ class DataChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link DataChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java index a2dd87a28b8..2618671159e 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link NodeMovedEvent} class. */ class NodeMovedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link NodeMovedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java index d3ea6ae4a84..7ee962e731c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link PrimitiveFlagsChangedEvent} class. */ class PrimitiveFlagsChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link PrimitiveFlagsChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java index 8e073efef01..79d869d63be 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java @@ -5,24 +5,12 @@ import java.util.Collections; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link PrimitivesAddedEvent} class. */ class PrimitivesAddedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link PrimitivesAddedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java index e81fbb6428a..9081fe96ad4 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java @@ -5,24 +5,12 @@ import java.util.Collections; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link PrimitivesRemovedEvent} class. */ class PrimitivesRemovedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link PrimitivesRemovedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java index 127841f2f40..33b8614461c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link RelationMembersChangedEvent} class. */ class RelationMembersChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link RelationMembersChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java index 4645a6802b8..120d3549f6c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link TagsChangedEvent} class. */ class TagsChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link TagsChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java b/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java index 25c6dae402d..107242c6d8c 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link WayNodesChangedEvent} class. */ class WayNodesChangedEventTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link WayNodesChangedEvent#toString}. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java index b6a7e9b50c8..d61e5834383 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java @@ -8,29 +8,17 @@ import java.util.HashMap; import java.util.Map; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DefaultNameFormatter; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.data.osm.User; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link HistoryNode}. */ class HistoryNodeTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static HistoryNode create(Instant d) { return new HistoryNode( 1L, // id diff --git a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java index 2d516617bc5..d9748626a77 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java @@ -8,28 +8,16 @@ import java.util.HashMap; import java.util.Map; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.DefaultNameFormatter; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.data.osm.RelationMemberData; import org.openstreetmap.josm.data.osm.User; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link HistoryRelation}. */ class HistoryRelationTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static HistoryRelation create(Instant d) { return new HistoryRelation( 1, // id diff --git a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java index cbaad5f5342..f406af2c525 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java @@ -10,26 +10,15 @@ import java.util.List; import java.util.Map; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.DefaultNameFormatter; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.data.osm.User; -import org.openstreetmap.josm.testutils.JOSMTestRules; /** * Unit tests for class {@link HistoryWay}. */ class HistoryWayTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static HistoryWay create(Instant d) { return new HistoryWay( 1, // id diff --git a/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java b/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java index 430a360505c..875a019cb19 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java @@ -1,26 +1,14 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.osm.search; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link SearchCompiler}. */ class PushbackTokenizerTest { - - /** - * Setup rules. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link Token} enum. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java b/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java index e56d820fd3c..d7afcd56ff8 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java @@ -1,25 +1,13 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.osm.search; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link SearchMode}. */ class SearchModeTest { - - /** - * Setup rules. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link SearchMode} enum. */ diff --git a/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java b/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java index 0da2cc7c8e5..07300a636f9 100644 --- a/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java +++ b/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java @@ -8,7 +8,6 @@ import java.util.Collection; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; @@ -18,9 +17,6 @@ import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests for class {@link MergeSourceBuildingVisitor}. @@ -35,13 +31,6 @@ protected OsmPrimitive lookupByName(Collection primitive .findFirst().orElse(null); } - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - @Test void testNodes() { DataSet source = new DataSet(); diff --git a/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java b/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java index a5a9638e160..3b3f66b76de 100644 --- a/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java +++ b/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java @@ -19,7 +19,6 @@ import java.util.stream.Collectors; import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.Bounds; @@ -31,12 +30,12 @@ /** * This test is used to monitor changes in projection code. - * + *

* It keeps a record of test data in the file nodist/data/projection/projection-regression-test-data. * This record is generated from the current Projection classes available in JOSM. It needs to * be updated, whenever a projection is added / removed or an algorithm is changed, such that * the computed values are numerically different. There is no error threshold, every change is reported. - * + *

* So when this test fails, first check if the change is intended. Then update the regression * test data, by running the main method of this class and commit the new data file. */ @@ -57,7 +56,7 @@ private static class TestData { * @throws IOException if any I/O errors occurs */ public static void main(String[] args) throws IOException { - setUp(); + JOSMFixture.createUnitTestFixture().init(); Map supportedCodesMap = Projections.getAllProjectionCodes().stream() .collect(Collectors.toMap(code -> code, Projections::getProjectionByCode)); @@ -134,14 +133,6 @@ private static Pair readLine(String expectedName, String input) return Pair.create(a, b); } - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Non-regression unit test. * @throws IOException if any I/O error occurs diff --git a/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java b/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java index cfca1ff9d86..8831d691cb1 100644 --- a/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java +++ b/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java @@ -3,23 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests for {@link LonLat}. */ class LonLatTest { - /** - * Setup rule. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link LonLat#lonIsLinearToEast} */ diff --git a/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java b/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java index 3acc9177c03..40512b8370e 100644 --- a/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java +++ b/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java @@ -3,23 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests for {@link Mercator}. */ class MercatorTest { - /** - * Setup rule. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link Mercator#lonIsLinearToEast} */ diff --git a/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java b/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java index 1f3213e5b86..631accac16c 100644 --- a/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java +++ b/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java @@ -11,26 +11,15 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; /** * Unit tests of {@link AutoCompletionPriority}. */ class AutoCompletionPriorityTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test getters. */ diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java index d0c5d7939fc..0f022cf4b57 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java @@ -10,7 +10,6 @@ import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; @@ -19,22 +18,11 @@ import org.openstreetmap.josm.data.osm.RelationMember; import org.openstreetmap.josm.data.validation.Severity; import org.openstreetmap.josm.data.validation.TestError; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of {@link Addresses} validation test. */ class AddressesTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static Node createAddressNode(String nodeTags, String wayTags, String relationTags) { DataSet ds = new DataSet(); Node n = TestUtils.newNode(nodeTags); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java index bcb41d47ed5..acdd163d411 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java @@ -3,11 +3,7 @@ import java.util.stream.Collectors; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of {@link Coastlines} validation test. @@ -17,13 +13,6 @@ class CoastlinesTest { private static final Coastlines COASTLINES = new Coastlines(); private static final WronglyOrderedWays WRONGLY_ORDERED_WAYS = new WronglyOrderedWays(); - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test all error cases manually created in coastline.osm. * @throws Exception in case of error diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java index 12c93a9411d..47b66e35fc8 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java @@ -5,15 +5,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Test the ConnectivityRelations validation test @@ -24,13 +20,6 @@ class ConnectivityRelationsTest { private ConnectivityRelations check; private static final String CONNECTIVITY = "connectivity"; - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules rule = new JOSMTestRules(); - @BeforeEach public void setUpCheck() { check = new ConnectivityRelations(); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java index 3d4b51d6ed5..d9e28783540 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java @@ -2,24 +2,12 @@ package org.openstreetmap.josm.data.validation.tests; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.DataSet; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of {@link DirectionNodes} validation test. */ class DirectionNodesTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test all error cases manually created in direction-nodes.osm. * @throws Exception in case of error diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java index 60c64771116..4fc71161283 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.command.Command; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; @@ -17,22 +16,11 @@ import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.validation.TestError; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Duplicate node" validation test. */ class DuplicateNodeTest { - - /** - * Setup test by initializing JOSM preferences and projection. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static final DuplicateNode TEST = new DuplicateNode(); private static void doTest(int code, Tag... tags) { @@ -179,7 +167,7 @@ void testDuplicateNode() { /** * Test of "Duplicate node" validation test - server precision. - * + *

* Non-regression test for ticket #18074. */ @Test diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java index 584def0fecc..8966642e5a6 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java @@ -8,7 +8,6 @@ import java.nio.file.Files; import java.nio.file.Paths; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.command.Command; @@ -18,22 +17,11 @@ import org.openstreetmap.josm.data.validation.TestError; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.io.OsmReader; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Duplicate way" validation test. */ class DuplicateWayTest { - - /** - * Setup test by initializing JOSM preferences and projection. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static final DuplicateWay TEST = new DuplicateWay(); private static void doTest(int code) { diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java index 1031bc81262..6cb10a5d5d9 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java @@ -9,9 +9,7 @@ import java.io.InputStream; import java.util.Collection; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; @@ -19,20 +17,13 @@ import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.validation.TestError; import org.openstreetmap.josm.io.OsmReader; +import org.openstreetmap.josm.testutils.annotations.Projection; /** * Unit test of {@link HighwaysTest}. */ +@Projection class HighwaysTest { - - /** - * Setup test. - */ - @BeforeEach - public void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - private static Way createTestSetting(String highway, String highwayLink) { DataSet ds = new DataSet(); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java index 62bdbe8fbbf..580d4466047 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java @@ -9,16 +9,12 @@ import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.validation.TestError; import org.openstreetmap.josm.data.validation.routines.AbstractValidator; import org.openstreetmap.josm.data.validation.routines.EmailValidator; import org.openstreetmap.josm.data.validation.routines.UrlValidator; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Internet Tags" validation test. @@ -27,13 +23,6 @@ class InternetTagsTest { private static final InternetTags TEST = new InternetTags(); - /** - * Setup test by initializing JOSM preferences and projection. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of valid URLs. */ diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java index 7461edeeda6..553f9e6c3bf 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.osm.OsmUtils; /** @@ -22,7 +21,6 @@ class LanesTest { */ @BeforeEach public void setUp() throws Exception { - JOSMFixture.createUnitTestFixture().init(); lanes.initialize(); lanes.startTest(null); } diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java index d3bd1926a70..333028c4853 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java @@ -3,27 +3,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Long Segment" validation test. */ class LongSegmentTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static int test(Way w) throws Exception { LongSegment test = new LongSegment(); test.initialize(); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java index b5832f36c5e..6306db2bd42 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java @@ -5,26 +5,14 @@ import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.OsmUtils; import org.openstreetmap.josm.data.validation.TestError; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Name mismatch" validation test. */ class NameMismatchTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - List test(String primitive) { final NameMismatch test = new NameMismatch(); test.check(OsmUtils.createPrimitive(primitive)); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java index 95d3a2572cc..fadc7e8d5b2 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java @@ -6,16 +6,12 @@ import java.util.Arrays; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; import org.openstreetmap.josm.data.osm.Way; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * JUnit Test of "Public Transport Route" validation test. @@ -24,13 +20,6 @@ class PublicTransportRouteTestTest { final PublicTransportRouteTest test = new PublicTransportRouteTest(); - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules rules = new JOSMTestRules(); - /** * Performs various tests. */ diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java index 2460c15bf68..3ffb9f4fa63 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java @@ -10,12 +10,10 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmUtils; @@ -26,15 +24,6 @@ */ class SelfIntersectingWayTest { - /** - * Setup test. - * @throws Exception if test cannot be initialized - */ - @BeforeAll - public static void setUp() throws Exception { - JOSMFixture.createUnitTestFixture().init(); - } - private static List createNodes() { List nodes = IntStream.range(0, 6).mapToObj(i -> new Node(i + 1)).collect(Collectors.toList()); nodes.get(0).setCoor(new LatLon(34.2680, 133.563)); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java index c5de697f747..1e64ce50bed 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java @@ -12,18 +12,19 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.EastNorth; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; +import org.openstreetmap.josm.testutils.annotations.Projection; /** * JUnit Test of the Sharp Angles validation test. */ @BasicPreferences +@Projection class SharpAnglesTest { private SharpAngles angles; @@ -33,7 +34,6 @@ class SharpAnglesTest { */ @BeforeEach public void setUp() throws Exception { - JOSMFixture.createUnitTestFixture().init(); angles = new SharpAngles(); angles.initialize(); } diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java index 21cbd4b0ef2..82fc3196af1 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java @@ -4,9 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; /** * Unit test of {@link SimilarNamedWays} @@ -15,14 +13,6 @@ class SimilarNamedWaysTest { private final SimilarNamedWays test = new SimilarNamedWays(); - /** - * Setup test - */ - @BeforeEach - public void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - private void checkSimilarity(String message, String name1, String name2, boolean expected) { boolean actual = test.similaryName(name1, name2); assertEquals(expected, actual, message); diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java index f14f6896d89..92e99e22a86 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.MainApplication; @@ -21,10 +20,12 @@ import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.io.IllegalDataException; import org.openstreetmap.josm.io.OsmReader; +import org.openstreetmap.josm.testutils.annotations.Projection; /** * Unit tests of {@code UnconnectedWays} class. */ +@Projection class UnconnectedWaysTest { private UnconnectedWays bib; @@ -36,7 +37,6 @@ class UnconnectedWaysTest { @BeforeEach public void setUp() throws Exception { bib = new UnconnectedWays.UnconnectedHighways(); - JOSMFixture.createUnitTestFixture().init(); bib.initialize(); } diff --git a/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java b/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java index f40e54e8a95..b4b336e7c5c 100644 --- a/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java +++ b/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java @@ -1,25 +1,14 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.validation.util; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests for class {@link ValUtil}. */ class ValUtilTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code ValUtil} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java b/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java index 210fda1c6a6..d3c9180b232 100644 --- a/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java +++ b/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java @@ -1,25 +1,14 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests of {@link ConditionalOptionPaneUtil} class. */ class ConditionalOptionPaneUtilTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code ConditionalOptionPaneUtil} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java b/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java index 2fd57e57d10..6f10a93c20f 100644 --- a/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java +++ b/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java @@ -1,25 +1,14 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests of {@link ExceptionDialogUtil} class. */ class ExceptionDialogUtilTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code ExceptionDialogUtil} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java b/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java index 2ef98e6bf10..b5250ca9e0e 100644 --- a/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java +++ b/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java @@ -1,26 +1,15 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; /** * Test {@link MapStatus} */ class MapStatusTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link MapStatus.StatusTextHistory#equals} and {@link MapStatus.StatusTextHistory#hashCode}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java b/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java index 227587a42d8..fb21bc72a1e 100644 --- a/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java +++ b/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java @@ -7,24 +7,13 @@ import java.text.DecimalFormatSymbols; import java.util.Locale; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.SystemOfMeasurement; /** * Unit tests of {@link SystemOfMeasurement} class. */ class SystemOfMeasurementTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test of {@link SystemOfMeasurement#getDistText} method. */ diff --git a/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java b/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java index 7656eb37789..b8e0401948c 100644 --- a/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java +++ b/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java @@ -14,18 +14,15 @@ import java.util.regex.PatternSyntaxException; import java.util.stream.Collectors; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.Tag; import org.openstreetmap.josm.data.osm.TagCollection; import org.openstreetmap.josm.gui.conflict.tags.TagConflictResolutionUtil.AutomaticChoice; import org.openstreetmap.josm.gui.conflict.tags.TagConflictResolutionUtil.AutomaticChoiceGroup; import org.openstreetmap.josm.gui.conflict.tags.TagConflictResolutionUtil.AutomaticCombine; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - /** * Unit tests of {@link TagConflictResolutionUtil} class. */ @@ -101,14 +98,15 @@ void testApplyAutomaticTagConflictResolution() { /** * Unit tests of {@link AutomaticCombine} class. */ - static class AutomaticCombineTest { + @Nested + class AutomaticCombineTest { /** * Return AutomaticCombine instantiated with the two possible constructors. * @param ac a model for the constructed object. * @return AutomaticCombine object constructed with the two different constructors. */ - private static List differentlyConstructed(AutomaticCombine ac) { + private List differentlyConstructed(AutomaticCombine ac) { AutomaticCombine fullyConstructed = new AutomaticCombine(ac.key, ac.description, ac.isRegex, ac.separator, ac.sort); AutomaticCombine defaultConstructed = new AutomaticCombine(); defaultConstructed.key = ac.key; @@ -119,13 +117,6 @@ private static List differentlyConstructed(AutomaticCombine ac return Arrays.asList(defaultConstructed, fullyConstructed); } - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link AutomaticCombine#matchesKey} with empty key. */ @@ -228,21 +219,14 @@ void testResolve() { /** * Unit tests of {@link AutomaticChoice} class. */ - static class AutomaticChoiceTest { + @Nested + class AutomaticChoiceTest { /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - - /** - * Return AutomaticCombine instantiated with the two possible constructors. * @param ac a model for the constructed object. * @return AutomaticCombine object constructed with the two different constructors. */ - private static List differentlyConstructed(AutomaticChoice ac) { + private List differentlyConstructed(AutomaticChoice ac) { AutomaticChoice fullyConstructed = new AutomaticChoice(ac.key, ac.group, ac.description, ac.isRegex, ac.value, ac.score); AutomaticChoice defaultConstructed = new AutomaticChoice(); defaultConstructed.key = ac.key; @@ -348,14 +332,8 @@ void testComputeScoreFromValueInvalidReplacement() { /** * Unit tests of {@link AutomaticChoiceGroup} class. */ - static class AutomaticChoiceGroupTest { - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - + @Nested + class AutomaticChoiceGroupTest { AutomaticChoice choiceKey1Group1 = new AutomaticChoice("Key1", "Group1", "", false, "value1", "score1"); AutomaticChoice choiceKey1Group1bis = new AutomaticChoice("Key1", "Group1", "", false, "value2", "score2"); AutomaticChoice choiceKey1Group2 = new AutomaticChoice("Key1", "Group2", "", false, "value1", "score1"); diff --git a/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java b/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java index 1a83cd37d79..2ad2d162d1a 100644 --- a/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java +++ b/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java @@ -8,29 +8,18 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; +import java.util.Collections; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.correction.RoleCorrection; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link RoleCorrectionTable} class. */ class RoleCorrectionTableTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link RoleCorrectionTable#RoleCorrectionTable}. */ @@ -40,7 +29,7 @@ void testRoleCorrectionTable() { RelationMember member = new RelationMember("foo", new Node()); r.addMember(member); RoleCorrection rc = new RoleCorrection(r, 0, member, "bar"); - RoleCorrectionTable t = new RoleCorrectionTable(Arrays.asList(rc)); + RoleCorrectionTable t = new RoleCorrectionTable(Collections.singletonList(rc)); assertNotNull(t.getCellRenderer(0, 0)); assertNotNull(t.getCellRenderer(0, 1)); assertNotNull(t.getCellRenderer(0, 2)); diff --git a/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java b/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java index 244060ce127..1d63562e48d 100644 --- a/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java +++ b/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java @@ -9,25 +9,13 @@ import java.util.Arrays; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.correction.TagCorrection; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link TagCorrectionTable} class. */ class TagCorrectionTableTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link TagCorrectionTable#TagCorrectionTable}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java index 7159ba5f39c..11fe566dadc 100644 --- a/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java +++ b/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java @@ -1,26 +1,15 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.dialogs; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.gui.dialogs.ChangesetDialog.LaunchChangesetManager; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; /** * Unit tests of {@link ChangesetDialog} class. */ class ChangesetDialogTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code LaunchChangesetManager} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java index e364b95366a..3403e98b667 100644 --- a/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java +++ b/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java @@ -7,21 +7,9 @@ import javax.swing.Action; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.Tag; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; class TaginfoActionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link TaginfoAction#getTaginfoUrlForTag} and {@link TaginfoAction#getTaginfoUrlForRelationType} */ diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java index a97b2168b52..edf95f27b64 100644 --- a/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java +++ b/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java @@ -7,7 +7,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; @@ -17,22 +16,11 @@ import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable.DoubleClickAdapter; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link SelectionTable} class. */ class SelectionTableTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link SelectionTable#SelectionTable}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/download/BookmarkListTest.java b/test/unit/org/openstreetmap/josm/gui/download/BookmarkListTest.java index e97f48f9bc1..203e6a05627 100644 --- a/test/unit/org/openstreetmap/josm/gui/download/BookmarkListTest.java +++ b/test/unit/org/openstreetmap/josm/gui/download/BookmarkListTest.java @@ -1,26 +1,15 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.download; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.time.Instant; + import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.Changeset; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import java.time.Instant; /** * Unit test of {@link BookmarkList} */ class BookmarkListTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link BookmarkList.ChangesetBookmark#ChangesetBookmark(Changeset)} */ diff --git a/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java b/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java index 2cf97dedabe..9f3e69846e3 100644 --- a/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java +++ b/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java @@ -5,7 +5,6 @@ import java.time.Instant; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.OsmPrimitiveType; import org.openstreetmap.josm.data.osm.User; @@ -13,22 +12,11 @@ import org.openstreetmap.josm.data.osm.history.HistoryNode; import org.openstreetmap.josm.data.osm.history.HistoryRelation; import org.openstreetmap.josm.data.osm.history.HistoryWay; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link HistoryBrowserDialog} class. */ class HistoryBrowserDialogTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test for {@link HistoryBrowserDialog#buildTitle}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java b/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java index 65c629080f4..598a0a90fe5 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java @@ -9,26 +9,15 @@ import javax.swing.JTable; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link ActionFlagsTableCell} class. */ class ActionFlagsTableCellTest { - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link ActionFlagsTableCell} class. */ diff --git a/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java b/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java index 79b2eb6eb37..e0904663416 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java @@ -8,11 +8,9 @@ import java.io.File; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -20,13 +18,6 @@ * Unit tests of {@link SaveLayerInfo} class. */ class SaveLayerInfoTest { - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link SaveLayerInfo} class - null case. */ diff --git a/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java b/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java index 2faf1210c97..de6344dd27a 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java @@ -1,14 +1,12 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.io; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.layer.OsmDataLayer; -import org.openstreetmap.josm.testutils.JOSMTestRules; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -16,13 +14,6 @@ * Unit tests of {@link SaveLayerTask} class. */ class SaveLayerTaskTest { - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link SaveLayerTask} class - null case. */ @@ -37,6 +28,6 @@ void testSaveLayerTaskNull() { */ @Test void testSaveLayerTaskNominal() { - assertNotNull(new SaveLayerTask(new SaveLayerInfo(new OsmDataLayer(new DataSet(), "", null)), null)); + assertDoesNotThrow(() -> new SaveLayerTask(new SaveLayerInfo(new OsmDataLayer(new DataSet(), "", null)), null)); } } diff --git a/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java b/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java index c580289fa70..3dad98480d8 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java @@ -8,25 +8,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.gui.io.SaveLayersModel.Mode; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link UploadAndSaveProgressRenderer} class. */ class UploadAndSaveProgressRendererTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link UploadAndSaveProgressRenderer#UploadAndSaveProgressRenderer}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java b/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java index 501751f9efc..c775c2e531a 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java @@ -1,36 +1,24 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.io; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.Changeset; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.io.UploadStrategySpecification; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link UploadPrimitivesTask} class. */ class UploadPrimitivesTaskTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link UploadPrimitivesTask#UploadPrimitivesTask}. */ @Test void testUploadPrimitivesTask() { - assertNotNull(new UploadPrimitivesTask( + assertDoesNotThrow(() -> new UploadPrimitivesTask( new UploadStrategySpecification(), new OsmDataLayer(new DataSet(), null, null), null, diff --git a/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java b/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java index f6edbfd8225..7f1972a9789 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java @@ -1,31 +1,19 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.io; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link UploadedObjectsSummaryPanel} class. */ class UploadedObjectsSummaryPanelTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test of {@link UploadedObjectsSummaryPanel#UploadedObjectsSummaryPanel}. */ @Test void testUploadedObjectsSummaryPanel() { - assertNotNull(new UploadedObjectsSummaryPanel()); + assertDoesNotThrow(UploadedObjectsSummaryPanel::new); } } diff --git a/test/unit/org/openstreetmap/josm/gui/io/importexport/ImageImporterTest.java b/test/unit/org/openstreetmap/josm/gui/io/importexport/ImageImporterTest.java index ce93df63831..b39cfebc661 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/importexport/ImageImporterTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/importexport/ImageImporterTest.java @@ -10,25 +10,13 @@ import java.util.HashSet; import java.util.List; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link ImageImporter} class. */ class ImageImporterTest { - - /** - * Setup test - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Non-regression test for Bug #14868. * @throws IOException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java b/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java index 0f9859d94ca..00b5bb30970 100644 --- a/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java +++ b/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java @@ -6,23 +6,14 @@ import java.io.File; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.gui.MainApplication; -import org.openstreetmap.josm.testutils.JOSMTestRules; /** * Unit tests of {@link NoteImporter} class. */ class NoteImporterTest { - - /** - * Use the test rules to remove any layers and reset state. - */ - @RegisterExtension - public final JOSMTestRules rules = new JOSMTestRules(); - /** * Non-regression test for Bug #12531. */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java b/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java index 7274dacf003..5eed76601d8 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java @@ -8,24 +8,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationListener; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Test of the base {@link AbstractMapViewPaintable} class * @author Michael Zangl */ class AbstractMapViewPaintableTest { - /** - * No special test rules - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private Layer testLayer; /** diff --git a/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java b/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java index 286dcb07e0e..63ab7d5b8fb 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent; /** * Unit tests of {@link MapViewPaintable} class. */ class MapViewPaintableTest { - - /** - * Setup tests - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link MapViewPaintable.PaintableInvalidationEvent#toString} */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java index b20a3b904cb..0d375881e31 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java @@ -5,28 +5,17 @@ import java.util.Collections; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; /** * Unit tests of {@link NativeScaleLayer} class. */ class NativeScaleLayerTest { - - /** - * Setup tests - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Non-regression test for ticket #12255. */ @Test void testTicket12255() { - assertNull(new NativeScaleLayer.ScaleList(Collections.emptyList()).getSnapScale(10, 2, false)); + assertNull(new NativeScaleLayer.ScaleList(Collections.emptyList()).getSnapScale(10, 2, false)); } } diff --git a/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java index 8a9213fdfc1..8184f2fd40a 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java @@ -3,24 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link NoteLayer} class. */ class NoteLayerTest { - - /** - * Setup tests - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Non-regression test for ticket #13208. */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java b/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java index 5ddb875b154..4516c4ac5a0 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java @@ -5,40 +5,20 @@ import java.util.Collections; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.data.gpx.GpxTimeOffset; import org.openstreetmap.josm.data.gpx.GpxTimezone; import org.openstreetmap.josm.io.GpxReaderTest; -import org.openstreetmap.josm.testutils.JOSMTestRules; +import org.openstreetmap.josm.testutils.annotations.Timezone; import org.openstreetmap.josm.tools.Pair; import org.openstreetmap.josm.tools.date.DateUtils; -import org.openstreetmap.josm.tools.date.DateUtilsTest; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link CorrelateGpxWithImages} class. */ +@Timezone class CorrelateGpxWithImagesTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - DateUtilsTest.setTimeZone(DateUtils.UTC); - } - /** * Tests automatic guessing of timezone/offset * @throws Exception if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java b/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java index bce922a0c56..c3bbb730fff 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java @@ -8,27 +8,15 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.gui.ExtendedDialog; import org.openstreetmap.josm.gui.layer.GpxLayerTest; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link ChooseTrackVisibilityAction} class. */ class ChooseTrackVisibilityActionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test action. * @throws Exception if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java b/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java index 06e52a7bbb3..de1cb24040b 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.GpxData; @@ -29,23 +28,12 @@ import org.openstreetmap.josm.io.IllegalDataException; import org.openstreetmap.josm.io.OsmReader; import org.openstreetmap.josm.spi.preferences.Config; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.xml.sax.SAXException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link ConvertToDataLayerAction} class. */ -public class ConvertToDataLayerActionTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - +class ConvertToDataLayerActionTest { /** * Tests a conversion from a GPX marker layer to a OSM dataset * @throws Exception if the parsing fails diff --git a/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java b/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java index 72ef5f2097f..401143073ed 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java @@ -11,10 +11,6 @@ import java.awt.image.IndexColorModel; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests for the {@link ColorfulImageProcessor} class. @@ -40,13 +36,6 @@ class ColorfulImageProcessorTest { private static final IndexColorModel COLOR_MODEL = new IndexColorModel(8, PALETTE.length, PALETTE, 0, true, 255, DataBuffer.TYPE_BYTE); - /** - * No special rules - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link ColorfulImageProcessor#setColorfulness(double)} and {@link ColorfulImageProcessor#getColorfulness()} */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java b/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java index 510329858cf..3e55fdba3e6 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java @@ -3,25 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests for the {@link GammaImageProcessor} class. * @author Michael Zangl */ class GammaImageProcessorTest { - - /** - * No special rules - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link GammaImageProcessor#setGamma(double)} and {@link GammaImageProcessor#getGamma()} */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java b/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java index 4962a553b11..6ee18bb24e3 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java @@ -3,25 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Tests for the {@link SharpenImageProcessor} class. * @author Michael Zangl */ class SharpenImageProcessorTest { - - /** - * No special rules - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link SharpenImageProcessor#setSharpenLevel(float)} and {@link SharpenImageProcessor#getSharpenLevel()} */ diff --git a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java index ea04e500e37..bc3b3b3a01b 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java @@ -6,9 +6,7 @@ import java.net.MalformedURLException; import java.net.URL; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.data.gpx.WayPoint; @@ -17,15 +15,6 @@ * Unit tests of {@link AudioMarker} class. */ class AudioMarkerTest { - - /** - * Setup tests - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link AudioMarker#AudioMarker}. * @throws MalformedURLException never diff --git a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java index 1c914105770..aab2624c4e8 100644 --- a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java +++ b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java @@ -4,9 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.WayPoint; @@ -14,15 +12,6 @@ * Unit tests of {@link PlayHeadMarker} class. */ class PlayHeadMarkerTest { - - /** - * Setup tests - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link PlayHeadMarker#PlayHeadMarker}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java index bc3cb15b7d1..e779e8c84e9 100644 --- a/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java +++ b/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java @@ -7,29 +7,17 @@ import java.util.Arrays; import java.util.Collections; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.StaticLabelCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.TagLookupCompositionStrategy; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link LabelCompositionStrategy}. */ class LabelCompositionStrategyTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link StaticLabelCompositionStrategy}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java index 17295f13cce..1c0a80cdcb4 100644 --- a/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java +++ b/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java @@ -8,29 +8,17 @@ import java.awt.Color; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.TagLookupCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Extended text directives tests. */ class MapCSSWithExtendedTextDirectivesTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test {@link DeriveLabelFromNameTagsCompositionStrategy} */ diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java index 05d8c501b0a..caa21ad918e 100644 --- a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java +++ b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java @@ -1,28 +1,17 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.mappaint.mapcss; -import org.junit.jupiter.api.extension.RegisterExtension; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.trajano.commons.testing.UtilityClassTestUtil; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - /** * Unit tests of {@link ExpressionFactory}. */ class ExpressionFactoryTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests that {@code Functions} satisfies utility class criteria. * @throws ReflectiveOperationException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java index 36d19d8449f..5f44c614feb 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link AdvancedPreference} class. */ class AdvancedPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link AdvancedPreference#AdvancedPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java index f7c244d6dd2..90f11bfe184 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java @@ -5,26 +5,15 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.Arrays; +import java.util.Collections; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.advanced.ListEditor.ListSettingTableModel; /** * Unit tests of {@link ListEditor} class. */ class ListEditorTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ListSettingTableModel} class. */ @@ -32,7 +21,7 @@ public static void setUpBeforeClass() { void testListSettingTableModel() { ListSettingTableModel model = new ListSettingTableModel(null); assertNotNull(model.getData()); - model = new ListSettingTableModel(Arrays.asList("foo")); + model = new ListSettingTableModel(Collections.singletonList("foo")); assertTrue(model.getData().contains("foo")); assertEquals(2, model.getRowCount()); assertEquals(1, model.getColumnCount()); diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java index 2cbc392ff3a..2fff831c2f1 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java @@ -5,9 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.spi.preferences.StringSetting; @@ -17,15 +15,6 @@ * Unit tests of {@link PrefEntry} class. */ class PrefEntryTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link PrefEntry#PrefEntry}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java index dcf9998bf39..891300d79f0 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java @@ -3,9 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; import org.openstreetmap.josm.spi.preferences.Config; @@ -13,15 +11,6 @@ * Unit tests of {@link AudioPreference} class. */ class AudioPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link AudioPreference#AudioPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java index 3cc1540cb4f..9a56e914f7c 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link ColorPreference} class. */ class ColorPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ColorPreference#ColorPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java index 7d95ab54005..c2d38124ef2 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link DisplayPreference} class. */ class DisplayPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link DisplayPreference#DisplayPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java index c8036c2d319..3d851e6432a 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link DrawingPreference} class. */ class DrawingPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link DrawingPreference#DrawingPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java index 7346bb118c6..15784198439 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link GPXPreference} class. */ class GPXPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link GPXPreference.Factory}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java index bb0e1e37f76..494752df053 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link LafPreference} class. */ class LafPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link LafPreference#LafPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java index f1ff6df7b28..cfdef66cfcf 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link LanguagePreference} class. */ class LanguagePreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link LanguagePreference#LanguagePreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java index 12ddd6c4755..b2c39dff58e 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link BackupPreference} class. */ class BackupPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link BackupPreference#BackupPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java index 29b901e1764..a7dfaa117d7 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link MapPaintPreference} class. */ class MapPaintPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link MapPaintPreference#MapPaintPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java index 74bdb1d8c51..b8b8819ae0b 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java @@ -3,9 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** @@ -13,14 +11,6 @@ */ class TaggingPresetPreferenceTest { - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link TaggingPresetPreference#TaggingPresetPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java index 3ebd2f214a4..6ead0080ba1 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link ProjectionPreference} class. */ class ProjectionPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ProjectionPreference#ProjectionPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java index f8843893058..011ec0e53ef 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link RemoteControlPreference} class. */ class RemoteControlPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link RemoteControlPreference#RemoteControlPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java index f7b13cc5bfa..6f801ce17f3 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link ShortcutPreference} class. */ class ShortcutPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ShortcutPreference#ShortcutPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java index 735689b2a58..c4191dc444a 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link ValidatorPreference} class. */ class ValidatorPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ValidatorPreference#ValidatorPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java index 3c033440591..f8d67d31fab 100644 --- a/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java @@ -3,24 +3,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; /** * Unit tests of {@link ValidatorTestsPreference} class. */ class ValidatorTestsPreferenceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUpBeforeClass() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test of {@link ValidatorTestsPreference#ValidatorTestsPreference}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java index f735327d661..569b87b41a3 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java @@ -1,30 +1,19 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.tagging.ac; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager.UserInputTag; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; /** * Unit tests of {@link AutoCompletionManager} class. */ class AutoCompletionManagerTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Non-regression test for ticket #17064. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java index eba467c4f43..910c568eb2a 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.OsmUtils; @@ -36,7 +35,6 @@ class PresetClassificationsTest { */ @BeforeAll public static void setUp() throws IOException, SAXException { - JOSMFixture.createUnitTestFixture().init(); final Collection presets = TaggingPresetReader.readAll("resource://data/defaultpresets.xml", true); classifications.loadPresets(presets); } diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupportTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupportTest.java index 87b290c8eed..0ebe1de1559 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupportTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupportTest.java @@ -1,35 +1,24 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.gui.tagging.presets; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.data.osm.OsmPrimitive; -import org.openstreetmap.josm.data.osm.OsmUtils; -import org.openstreetmap.josm.data.osm.Tag; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import org.openstreetmap.josm.tools.template_engine.TemplateEntry; -import org.openstreetmap.josm.tools.template_engine.TemplateParser; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.openstreetmap.josm.data.osm.OsmPrimitive; +import org.openstreetmap.josm.data.osm.OsmUtils; +import org.openstreetmap.josm.data.osm.Tag; +import org.openstreetmap.josm.tools.template_engine.TemplateEntry; +import org.openstreetmap.josm.tools.template_engine.TemplateParser; /** * Unit tests of {@link TaggingPresetItemGuiSupport} */ class TaggingPresetItemGuiSupportTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests {@link TemplateEntry} evaluation */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java index aa4d77243f9..27f14c66d8e 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java @@ -14,27 +14,15 @@ import java.util.stream.Collectors; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.gui.tagging.presets.items.Check; import org.openstreetmap.josm.gui.tagging.presets.items.Key; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.xml.sax.SAXException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link TaggingPresetReader} class. */ class TaggingPresetReaderTest { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * #8954 - last checkbox in the preset is not added * @throws SAXException if any XML error occurs diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetTest.java index 3af549cb1cb..56e5687f329 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetTest.java @@ -7,28 +7,16 @@ import java.util.EnumSet; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.osm.IPrimitive; import org.openstreetmap.josm.data.osm.OsmUtils; import org.openstreetmap.josm.data.osm.search.SearchCompiler; import org.openstreetmap.josm.data.osm.search.SearchParseError; import org.openstreetmap.josm.gui.tagging.presets.items.Key; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@code TaggingPreset} */ class TaggingPresetTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests {@link TaggingPreset#test(IPrimitive)} * @throws SearchParseError never diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java index 9da3cde25f8..9be864204f6 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java @@ -7,24 +7,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link CheckGroup} class. */ class CheckGroupTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link CheckGroup#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java index 933651713c4..9528b989dc7 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java @@ -7,24 +7,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link ItemSeparator} class. */ class ItemSeparatorTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link ItemSeparator#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java index 3021a6b51da..2b2480a3e6a 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java @@ -6,24 +6,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link Key} class. */ class KeyTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Key#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java index 583ae5f46b5..3a3f64a16ae 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java @@ -6,24 +6,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link Label} class. */ class LabelTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Label#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java index 9dbf04846ff..766ef5d09fa 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java @@ -7,9 +7,7 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; import org.openstreetmap.josm.spi.preferences.Config; @@ -17,15 +15,6 @@ * Unit tests of {@link Link} class. */ class LinkTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Link#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java index 07eecf56823..7d2cbef1d7a 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java @@ -6,24 +6,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link MultiSelect} class. */ class MultiSelectTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link MultiSelect#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java index 237695c4c3f..9b8490e87ab 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java @@ -7,24 +7,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link Optional} class. */ class OptionalTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Optional#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java index 0555ba6ca12..10d737c1943 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java @@ -4,23 +4,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; /** * Unit tests of {@link PresetListEntry} class. */ class PresetListEntryTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Non-regression test for ticket #12416. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java index fda90385225..5477d1b1e3c 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java @@ -7,24 +7,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link Roles} class. */ class RolesTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Roles#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java index fde44fb38cd..06030c64cd4 100644 --- a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java +++ b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java @@ -7,24 +7,13 @@ import javax.swing.JPanel; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; /** * Unit tests of {@link Space} class. */ class SpaceTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Unit test for {@link Space#addToPanel}. */ diff --git a/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java b/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java index 50ed711cedf..871e700d015 100644 --- a/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java +++ b/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java @@ -11,23 +11,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Test {@link MultiLineFlowLayout} * @author Michael Zangl */ class MultiLineFlowLayoutTest { - /** - * No special rules. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static final int TEST_WIDHT = 500; private JPanel container; diff --git a/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java b/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java index 04e6f981ecc..46e7627b8f7 100644 --- a/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java +++ b/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java @@ -7,24 +7,12 @@ import javax.swing.JSplitPane; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Unit tests of {@link AutoAdjustingSplitPane} class. */ class AutoAdjustingSplitPaneTest { - - /** - * Setup test. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of {@link AutoAdjustingSplitPane} class. */ diff --git a/test/unit/org/openstreetmap/josm/io/OsmApiTest.java b/test/unit/org/openstreetmap/josm/io/OsmApiTest.java index 25fbd21600a..f5d9013f9af 100644 --- a/test/unit/org/openstreetmap/josm/io/OsmApiTest.java +++ b/test/unit/org/openstreetmap/josm/io/OsmApiTest.java @@ -6,9 +6,7 @@ import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.osm.Changeset; import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; @@ -17,15 +15,6 @@ * Unit tests of {@link OsmApi} class. */ class OsmApiTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Non-regression test for Bug #12675. * @throws IllegalDataException if an error occurs diff --git a/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java b/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java index 9323f84246c..22c989dfd41 100644 --- a/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java +++ b/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java @@ -2,18 +2,15 @@ package org.openstreetmap.josm.io.audio; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTimeout; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import java.net.MalformedURLException; import java.net.URL; import java.time.Duration; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.tools.Stopwatch; @@ -26,21 +23,11 @@ class AudioPlayerTest { // We play wav files of about 4 seconds + pause, so define timeout at 16 seconds private static final long MAX_DURATION = 16000; - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test method for {@code AudioPlayer#play(URL)} - * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format - * @throws MalformedURLException wrong URL */ @Test - void testPlay() throws MalformedURLException, Exception { + void testPlay() { assertTimeout(Duration.ofMillis(4*MAX_DURATION), () -> { File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav")); diff --git a/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java b/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java index 10db579cea8..5ae3f1a815b 100644 --- a/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java +++ b/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java @@ -5,9 +5,7 @@ import java.io.File; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.TestUtils; /** @@ -17,14 +15,6 @@ class AudioUtilTest { private static final double EPSILON = 1e-11; - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test method for {@code AudioUtil#getCalibratedDuration(File)} */ diff --git a/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java b/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java index dbcf58b80a7..db94024eb69 100644 --- a/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java +++ b/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java @@ -17,7 +17,6 @@ import java.util.TimeZone; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.GpxConstants; @@ -26,23 +25,13 @@ import org.openstreetmap.josm.data.gpx.IGpxTrackSegment; import org.openstreetmap.josm.data.gpx.WayPoint; import org.openstreetmap.josm.io.GpxReaderTest; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.date.DateUtils; import org.xml.sax.SAXException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link NmeaReader} class. */ class NmeaReaderTest { - /** - * Set the timezone and timeout. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Tests reading a nmea file. * @throws Exception if any error occurs diff --git a/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java b/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java index 963b0299679..dc405cba1f6 100644 --- a/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java +++ b/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java @@ -9,20 +9,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; /** * Unit tests of {@link Handler} class. */ class HandlerTest { - - /** - * Use the test rules to remove any layers and reset state. - */ - @RegisterExtension - public final JOSMTestRules rules = new JOSMTestRules(); - /** * Setup test. */ diff --git a/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java b/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java index ece10e3f619..f927752ed17 100644 --- a/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java +++ b/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java @@ -12,27 +12,16 @@ import java.util.TimeZone; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.GpxConstants; import org.openstreetmap.josm.data.gpx.WayPoint; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.date.DateUtils; import org.xml.sax.SAXException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Unit tests of {@link RtkLibPosReader} class. */ class RtkLibPosReaderTest { - /** - * Set the timezone and timeout. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private static RtkLibPosReader read(String path) throws IOException, SAXException { TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); RtkLibPosReader in = new RtkLibPosReader(Files.newInputStream(Paths.get(path))); diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java b/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java index 52d04eed480..c3e7ef0fa8e 100644 --- a/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java +++ b/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java @@ -76,8 +76,9 @@ public void afterEach(ExtensionContext context) throws Exception { /** * Clean up what test not using these test rules may have broken. + * See {@link org.openstreetmap.josm.JOSMFixture} for the most common reason why this needs to be called. */ - private void cleanUpFromJosmFixture() { + private static void cleanUpFromJosmFixture() { MemoryManagerTest.resetState(true); JOSMTestRules.cleanLayerEnvironment(); Preferences.main().resetToInitialState(); diff --git a/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java b/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java index b3ac0c4458e..285acd9d55e 100644 --- a/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java +++ b/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java @@ -11,27 +11,16 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.coor.conversion.AbstractCoordinateFormat; import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat; -import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * EXIF metadata extraction test * @since 6209 */ class ExifReaderTest { - /** - * Set the timezone and timeout. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - private File orientationSampleFile, directionSampleFile; /** diff --git a/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java b/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java index 58e9f063aa9..fc17ad679cb 100644 --- a/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java +++ b/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.spi.preferences.Config; /** @@ -27,7 +26,6 @@ class PlatformHookOsxTest { */ @BeforeAll public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); hook = new PlatformHookOsx(); } diff --git a/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java b/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java index 9c2f9b1c13f..12b2e79bf1c 100644 --- a/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java +++ b/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java @@ -7,26 +7,14 @@ import java.net.HttpURLConnection; import java.net.URL; -import jakarta.json.Json; - import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import jakarta.json.Json; /** * Integration tests of {@link PlatformHook} class. */ class PlatformHookTestIT { - - /** - * Setup rule - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Test that we always support the latest Ubuntu version. * @throws Exception in case of error diff --git a/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java b/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java index 4ca03e72f07..d42352fd518 100644 --- a/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java +++ b/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java @@ -8,23 +8,12 @@ import javax.swing.KeyStroke; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; /** * Unit tests of {@link Shortcut} class. */ class ShortcutTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test method for {@code Shortcut#makeTooltip} */ diff --git a/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java b/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java index 1120a48df03..ce5ec50c2d7 100644 --- a/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java +++ b/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java @@ -5,13 +5,10 @@ import java.util.Set; -import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.tools.Logging; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; @@ -19,14 +16,6 @@ * Unit tests of {@link TemplateEntry} class. */ class TemplateEntryTest { - - /** - * Setup rule. - */ - @RegisterExtension - @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") - public JOSMTestRules test = new JOSMTestRules(); - /** * Unit test of methods {@link TemplateEntry#equals} and {@link TemplateEntry#hashCode}, including all subclasses. */ diff --git a/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java b/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java index f3810303aba..bc941af126f 100644 --- a/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java +++ b/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java @@ -7,9 +7,7 @@ import java.util.Arrays; import java.util.List; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openstreetmap.josm.JOSMFixture; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Relation; import org.openstreetmap.josm.data.osm.RelationMember; @@ -22,15 +20,6 @@ * Unit tests of {@link TemplateParser} class. */ class TemplateParserTest { - - /** - * Setup test. - */ - @BeforeAll - public static void setUp() { - JOSMFixture.createUnitTestFixture().init(); - } - /** * Test to parse an empty string. * @throws ParseError if the template cannot be parsed