Ignore:
Timestamp:
2017-08-03T23:24:56+02:00 (7 years ago)
Author:
Don-vip
Message:

fix unit tests

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r12563 r12564  
    186186            Main.mainPanel.reAddListeners();
    187187        }
     188        if (Main.main != null) {
     189            Main.main.panel = Main.mainPanel;
     190        }
    188191    }
    189192
  • trunk/test/unit/org/openstreetmap/josm/MainTest.java

    r12562 r12564  
    4646    @Rule
    4747    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    48     public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main();
     48    public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().mainMenu().projection();
    4949
    5050    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r10758 r12564  
    66import static org.junit.Assert.assertTrue;
    77
    8 import org.junit.AfterClass;
    9 import org.junit.BeforeClass;
     8import org.junit.After;
     9import org.junit.Before;
     10import org.junit.Rule;
    1011import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.conflict.Conflict;
     
    1717import org.openstreetmap.josm.data.osm.Way;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     19import org.openstreetmap.josm.testutils.JOSMTestRules;
    1920
     21import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2022import nl.jqno.equalsverifier.EqualsVerifier;
    2123import nl.jqno.equalsverifier.Warning;
     
    2628public class ConflictAddCommandTest {
    2729
    28     private static OsmDataLayer layer;
     30    private OsmDataLayer layer;
    2931
    3032    /**
    3133     * Setup test.
    3234     */
    33     @BeforeClass
    34     public static void setUpBeforeClass() {
    35         JOSMFixture.createUnitTestFixture().init(true);
     35    @Rule
     36    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     37    public JOSMTestRules test = new JOSMTestRules().platform();
     38
     39    /**
     40     * Setup test.
     41     */
     42    @Before
     43    public void setUp() {
    3644        layer = new OsmDataLayer(new DataSet(), null, null);
    3745        Main.getLayerManager().addLayer(layer);
     
    4149     * Cleanup test resources.
    4250     */
    43     @AfterClass
    44     public static void tearDownAfterClass() {
     51    @After
     52    public void tearDown() {
    4553        Main.getLayerManager().removeLayer(layer);
    4654    }
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java

    r10758 r12564  
    66import static org.junit.Assert.assertTrue;
    77
    8 import org.junit.AfterClass;
    9 import org.junit.BeforeClass;
     8import org.junit.After;
     9import org.junit.Before;
     10import org.junit.Rule;
    1011import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.conflict.Conflict;
     
    1919import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
    2020import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     21import org.openstreetmap.josm.testutils.JOSMTestRules;
    2122
     23import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2224import nl.jqno.equalsverifier.EqualsVerifier;
    2325import nl.jqno.equalsverifier.Warning;
     
    2830public class CoordinateConflictResolveCommandTest {
    2931
    30     private static OsmDataLayer layer;
     32    private OsmDataLayer layer;
    3133
    3234    /**
    3335     * Setup test.
    3436     */
    35     @BeforeClass
    36     public static void setUpBeforeClass() {
    37         JOSMFixture.createUnitTestFixture().init(true);
     37    @Rule
     38    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     39    public JOSMTestRules test = new JOSMTestRules().platform();
     40
     41    /**
     42     * Setup test.
     43     */
     44    @Before
     45    public void setUp() {
    3846        layer = new OsmDataLayer(new DataSet(), null, null);
    3947        Main.getLayerManager().addLayer(layer);
     
    4351     * Cleanup test resources.
    4452     */
    45     @AfterClass
    46     public static void tearDownAfterClass() {
     53    @After
     54    public void tearDown() {
    4755        Main.getLayerManager().removeLayer(layer);
    4856    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java

    r10991 r12564  
    2323    @Rule
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    25     public JOSMTestRules test = new JOSMTestRules().commands();
     25    public JOSMTestRules test = new JOSMTestRules();
    2626
    2727    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java

    r11241 r12564  
    3535    @Rule
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules test = new JOSMTestRules().commands();
     37    public JOSMTestRules test = new JOSMTestRules().projection().preferences();
    3838
    3939    private static Way createUnclosedWay(String tags) {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java

    r11441 r12564  
    2525    @BeforeClass
    2626    public static void setUp() throws Exception {
    27         JOSMFixture.createUnitTestFixture().init(false);
     27        JOSMFixture.createUnitTestFixture().init();
    2828    }
    2929
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r11324 r12564  
    1313import java.util.Collection;
    1414
    15 import org.junit.BeforeClass;
     15import org.junit.Rule;
    1616import org.junit.Test;
    17 import org.openstreetmap.josm.JOSMFixture;
    1817import org.openstreetmap.josm.data.Version;
    1918import org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor;
     
    2322import org.openstreetmap.josm.plugins.PluginListParseException;
    2423import org.openstreetmap.josm.plugins.PluginListParser;
     24import org.openstreetmap.josm.testutils.JOSMTestRules;
    2525
    2626import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3434     * Setup test.
    3535     */
    36     @BeforeClass
    37     public static void setUp() {
    38         JOSMFixture.createUnitTestFixture().init(true);
    39     }
     36    @Rule
     37    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     38    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu();
    4039
    4140    @SuppressFBWarnings(value = "DM_DEFAULT_ENCODING")
  • trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java

    r9954 r12564  
    88import java.awt.Color;
    99
    10 import org.junit.BeforeClass;
     10import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.JOSMFixture;
    1312import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.TestUtils;
     14import org.openstreetmap.josm.data.osm.DataSet;
    1515import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler;
     16import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     17import org.openstreetmap.josm.testutils.JOSMTestRules;
     18
     19import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1620
    1721/**
     
    2327     * Setup tests
    2428     */
    25     @BeforeClass
    26     public static void setUpBeforeClass() {
    27         JOSMFixture.createUnitTestFixture().init(true);
    28     }
     29    @Rule
     30    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     31    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2932
    3033    /**
     
    3336    @Test
    3437    public void testMapScaler() {
     38        Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3539        assertEquals(Color.WHITE, MapScaler.getColor());
    3640        MapScaler ms = new MapScaler(Main.map.mapView);
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r10937 r12564  
    1414
    1515import org.junit.Assert;
    16 import org.junit.BeforeClass;
     16import org.junit.Rule;
    1717import org.junit.Test;
    18 import org.openstreetmap.josm.JOSMFixture;
     18import org.openstreetmap.josm.testutils.JOSMTestRules;
    1919import org.openstreetmap.josm.tools.Utils;
    2020import org.reflections.Reflections;
     21
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2123
    2224/**
     
    4749     * Setup test.
    4850     */
    49     @BeforeClass
    50     public static void setUp() {
    51         JOSMFixture.createFunctionalTestFixture().init(true);
    52     }
     51    @Rule
     52    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     53    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu();
    5354
    5455    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java

    r10944 r12564  
    2828    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().projection().commands();
     30    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main().platform();
    3131
    3232    private final OsmTransferHandler transferHandler = new OsmTransferHandler();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r11110 r12564  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().commands();
     28    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java

    r10962 r12564  
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.coor.LatLon;
     14import org.openstreetmap.josm.data.osm.DataSet;
    1415import org.openstreetmap.josm.data.osm.Node;
    1516import org.openstreetmap.josm.data.osm.Relation;
     
    1718import org.openstreetmap.josm.data.osm.Way;
    1819import org.openstreetmap.josm.gui.dialogs.ConflictDialog.ConflictPainter;
     20import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1921import org.openstreetmap.josm.testutils.JOSMTestRules;
    2022
     
    3133    @Rule
    3234    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().platform().commands();
     35    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    3436
    3537    /**
     
    5456    @Test
    5557    public void testConflictPainter() {
     58        Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    5659        ConflictPainter cp = new ConflictPainter(Main.map.mapView, new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
    5760        Node n1 = new Node(1, 1);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r11803 r12564  
    3131    @Rule
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().commands();
     33    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    3434
    3535    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java

    r10962 r12564  
    55import org.junit.Test;
    66import org.openstreetmap.josm.Main;
     7import org.openstreetmap.josm.data.osm.DataSet;
     8import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    79import org.openstreetmap.josm.testutils.JOSMTestRules;
    810
     
    1921    @Rule
    2022    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    21     public JOSMTestRules test = new JOSMTestRules().commands();
     23    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2224
    2325    /**
     
    2628    @Test
    2729    public void testInfoAction() {
     30        Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    2831        Main.map.mapPaintDialog.new InfoAction().actionPerformed(null);
    2932    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java

    r11020 r12564  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().commands();
     23    public JOSMTestRules test = new JOSMTestRules().platform();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r12394 r12564  
    66import static org.junit.Assert.assertTrue;
    77
    8 import org.junit.BeforeClass;
    98import org.junit.Rule;
    109import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
    1210import org.openstreetmap.josm.Main;
    1311import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    2826    @Rule
    2927    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().projection().platform();
    31 
    32     /**
    33      * Somewhere deep down the dependencies we need shortcuts
    34      */
    35     @BeforeClass
    36     public static void setUp() {
    37         JOSMFixture.createUnitTestFixture().init(true);
    38     }
     28    public JOSMTestRules test = new JOSMTestRules().preferences().projection().platform().mainMenu();
    3929
    4030    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r10962 r12564  
    4141    @Rule
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().preferences().platform().commands();
     43    public JOSMTestRules test = new JOSMTestRules().preferences().platform().main();
    4444
    4545    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java

    r10604 r12564  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().preferences().platform().commands();
     29    public JOSMTestRules test = new JOSMTestRules().preferences().platform().main();
    3030
    3131    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java

    r11957 r12564  
    2727import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource;
    2828import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo;
     29import org.openstreetmap.josm.Main;
    2930import org.openstreetmap.josm.data.imagery.ImageryInfo;
    3031import org.openstreetmap.josm.data.imagery.TileLoaderFactory;
     32import org.openstreetmap.josm.data.osm.DataSet;
    3133import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings;
    3234import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    4446    @Rule
    4547    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    46     public JOSMTestRules test = new JOSMTestRules().platform().projection().commands();
     48    public JOSMTestRules test = new JOSMTestRules().platform().projection().mainMenu();
    4749
    4850    private static final class TMSTileStubSource extends AbstractTMSTileSource {
     
    147149    @Before
    148150    public void setUp() {
     151        Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    149152        testLayer = new TileSourceStubLayer();
    150153        testLayer.addInvalidationListener(l -> invalidated.set(true));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r11383 r12564  
    1515import javax.swing.JScrollPane;
    1616
    17 import org.junit.BeforeClass;
     17import org.junit.Rule;
    1818import org.junit.Test;
    19 import org.openstreetmap.josm.JOSMFixture;
    2019import org.openstreetmap.josm.Main;
    2120import org.openstreetmap.josm.TestUtils;
     
    2726import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    2827import org.openstreetmap.josm.io.GpxReaderTest;
     28import org.openstreetmap.josm.testutils.JOSMTestRules;
    2929import org.xml.sax.SAXException;
     30
     31import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3032
    3133/**
     
    3739     * Setup tests
    3840     */
    39     @BeforeClass
    40     public static void setUpBeforeClass() {
    41         JOSMFixture.createUnitTestFixture().init(true);
    42     }
     41    @Rule
     42    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     43    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu().projection();
    4344
    4445    private static String getHtml(GpxLayer layer) {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/MarkerLayerTest.java

    r11931 r12564  
    99import org.openstreetmap.josm.Main;
    1010import org.openstreetmap.josm.data.gpx.GpxData;
     11import org.openstreetmap.josm.data.osm.DataSet;
    1112import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1213import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2425    @Rule
    2526    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().commands();
     27    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2728
    2829    /**
     
    3233    public void testPlayHeadMarker() {
    3334        try {
     35            Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3436            MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null);
    3537            assertNull(Main.map.mapView.playHeadMarker);
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r10436 r12564  
    44import static org.junit.Assert.assertEquals;
    55
    6 import org.junit.BeforeClass;
     6import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.JOSMFixture;
    98import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1110import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     11import org.openstreetmap.josm.testutils.JOSMTestRules;
     12
     13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1214
    1315/**
     
    1921     * Setup tests
    2022     */
    21     @BeforeClass
    22     public static void setUpBeforeClass() {
    23         JOSMFixture.createUnitTestFixture().init(true);
    24     }
     23    @Rule
     24    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     25    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2526
    2627    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r11168 r12564  
    44import static org.junit.Assert.assertEquals;
    55
    6 import org.junit.BeforeClass;
     6import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.JOSMFixture;
    98import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1110import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     11import org.openstreetmap.josm.testutils.JOSMTestRules;
     12
     13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1214
    1315/**
     
    1921     * Setup tests
    2022     */
    21     @BeforeClass
    22     public static void setUpBeforeClass() {
    23         JOSMFixture.createUnitTestFixture().init(true);
    24     }
     23    @Rule
     24    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     25    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
    2526
    2627    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java

    r9669 r12564  
    44import static org.junit.Assert.assertEquals;
    55
    6 import org.junit.BeforeClass;
     6import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.JOSMFixture;
    98import org.openstreetmap.josm.data.imagery.ImageryInfo;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     10import org.openstreetmap.josm.testutils.JOSMTestRules;
     11
     12import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1113
    1214/**
     
    1820     * Setup tests
    1921     */
    20     @BeforeClass
    21     public static void setUpBeforeClass() {
    22         JOSMFixture.createUnitTestFixture().init();
    23     }
     22    @Rule
     23    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     24    public JOSMTestRules test = new JOSMTestRules();
    2425
    2526    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java

    r9949 r12564  
    22package org.openstreetmap.josm.gui.layer.gpx;
    33
    4 import org.junit.BeforeClass;
     4import org.junit.Rule;
    55import org.junit.Test;
    6 import org.openstreetmap.josm.JOSMFixture;
    76import org.openstreetmap.josm.gui.layer.GpxLayerTest;
     7import org.openstreetmap.josm.testutils.JOSMTestRules;
     8
     9import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    810
    911/**
     
    1517     * Setup test.
    1618     */
    17     @BeforeClass
    18     public static void setUpBeforeClass() {
    19         JOSMFixture.createUnitTestFixture().init();
    20     }
     19    @Rule
     20    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     21    public JOSMTestRules test = new JOSMTestRules().platform();
    2122
    2223    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java

    r11486 r12564  
    77import java.io.IOException;
    88
    9 import org.junit.BeforeClass;
     9import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.data.gpx.GpxData;
     
    1615import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1716import org.openstreetmap.josm.io.GpxReaderTest;
     17import org.openstreetmap.josm.testutils.JOSMTestRules;
    1818import org.xml.sax.SAXException;
     19
     20import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1921
    2022/**
     
    2628     * Setup test.
    2729     */
    28     @BeforeClass
    29     public static void setUpBeforeClass() {
    30         JOSMFixture.createUnitTestFixture().init(false);
    31     }
     30    @Rule
     31    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     32    public JOSMTestRules test = new JOSMTestRules();
    3233
    3334    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    r10436 r12564  
    77import static org.junit.Assert.assertTrue;
    88
    9 import org.junit.BeforeClass;
     9import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
    1211import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.gpx.GpxData;
     
    1615import org.openstreetmap.josm.gui.layer.TMSLayer;
    1716import org.openstreetmap.josm.gui.layer.gpx.DownloadWmsAlongTrackAction.PrecacheWmsTask;
     17import org.openstreetmap.josm.testutils.JOSMTestRules;
     18
     19import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1820
    1921/**
     
    2527     * Setup test.
    2628     */
    27     @BeforeClass
    28     public static void setUpBeforeClass() {
    29         JOSMFixture.createUnitTestFixture().init(true);
    30     }
     29    @Rule
     30    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     31    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu().projection();
    3132
    3233    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java

    r12157 r12564  
    99import java.util.stream.Collectors;
    1010
    11 import org.junit.BeforeClass;
     11import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.JOSMFixture;
    1413import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.TestUtils;
     
    1716import org.openstreetmap.josm.gui.layer.GpxLayer;
    1817import org.openstreetmap.josm.io.GpxReaderTest;
     18import org.openstreetmap.josm.testutils.JOSMTestRules;
    1919import org.openstreetmap.josm.tools.ColorHelper;
    2020import org.xml.sax.SAXException;
     21
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2123
    2224/**
     
    2830     * Setup test.
    2931     */
    30     @BeforeClass
    31     public static void setUpBeforeClass() {
    32         JOSMFixture.createUnitTestFixture().init(false);
    33     }
     32    @Rule
     33    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     34    public JOSMTestRules test = new JOSMTestRules();
    3435
    3536    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r10824 r12564  
    99import java.util.Arrays;
    1010
    11 import org.junit.BeforeClass;
     11import org.junit.Before;
     12import org.junit.Rule;
    1213import org.junit.Test;
    13 import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.Main;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     
    1818import org.openstreetmap.josm.data.gpx.GpxLink;
    1919import org.openstreetmap.josm.data.gpx.WayPoint;
     20import org.openstreetmap.josm.testutils.JOSMTestRules;
     21
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2023
    2124/**
     
    2730     * Setup tests
    2831     */
    29     @BeforeClass
    30     public static void setUpBeforeClass() {
    31         JOSMFixture.createUnitTestFixture().init(true);
     32    @Rule
     33    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     34    public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().preferences().projection();
     35
     36    /**
     37     * Setup tests
     38     */
     39    @Before
     40    public void setUp() {
    3241        Main.pref.put("marker.traceaudio", true);
    3342    }
     
    4049        assertEquals(Color.magenta, MarkerLayer.getGenericColor());
    4150        MarkerLayer layer = new MarkerLayer(new GpxData(), "foo", null, null);
     51        Main.getLayerManager().addLayer(layer);
    4252
    4353        assertEquals("foo", layer.getName());
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r12140 r12564  
    1010import java.util.List;
    1111
    12 import org.junit.BeforeClass;
     12import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.JOSMFixture;
    1514import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.TestUtils;
     
    2322import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    2423import org.openstreetmap.josm.io.IllegalDataException;
     24import org.openstreetmap.josm.testutils.JOSMTestRules;
     25
     26import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2527
    2628/**
     
    3234     * Setup tests.
    3335     */
    34     @BeforeClass
    35     public static void setUpBeforeClass() {
    36         JOSMFixture.createUnitTestFixture().init();
    37     }
     36    @Rule
     37    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     38    public JOSMTestRules test = new JOSMTestRules().platform().projection();
    3839
    3940    private static String getSessionDataDir() {
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r12118 r12564  
    1010import java.util.Map;
    1111
    12 import org.junit.BeforeClass;
     12import org.junit.Before;
     13import org.junit.Rule;
    1314import org.junit.Test;
    14 import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.Main;
    1616import org.openstreetmap.josm.data.coor.LatLon;
     
    2828import org.openstreetmap.josm.gui.layer.TMSLayer;
    2929import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    30 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
     30import org.openstreetmap.josm.testutils.JOSMTestRules;
    3131import org.openstreetmap.josm.tools.MultiMap;
    3232import org.openstreetmap.josm.tools.Utils;
     33
     34import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3335
    3436/**
     
    8486     * Setup tests.
    8587     */
    86     @BeforeClass
    87     public static void setUpBeforeClass() {
    88         JOSMFixture.createUnitTestFixture().init(true);
    89         ProjectionPreference.setProjection();
     88    @Rule
     89    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     90    public JOSMTestRules test = new JOSMTestRules().platform().projection().mainMenu();
     91
     92    /**
     93     * Setup tests.
     94     */
     95    @Before
     96    public void setUp() {
     97        Main.getLayerManager().addLayer(createOsmLayer());
    9098    }
    9199
Note: See TracChangeset for help on using the changeset viewer.