Ignore:
Timestamp:
2017-09-04T23:45:49+02:00 (7 years ago)
Author:
Don-vip
Message:

see #13036 - deprecate Command() default constructor, fix unit tests and java warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r12672 r12726  
    66import static org.junit.Assert.assertTrue;
    77
    8 import org.junit.After;
    98import org.junit.Before;
    109import org.junit.Rule;
    1110import org.junit.Test;
     11import org.openstreetmap.josm.command.CommandTest.CommandTestData;
    1212import org.openstreetmap.josm.data.conflict.Conflict;
    1313import org.openstreetmap.josm.data.osm.DataSet;
     
    1515import org.openstreetmap.josm.data.osm.User;
    1616import org.openstreetmap.josm.data.osm.Way;
    17 import org.openstreetmap.josm.gui.MainApplication;
    1817import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1918import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2827public class ConflictAddCommandTest {
    2928
    30     private OsmDataLayer layer;
    31 
    3229    /**
    3330     * Setup test.
     
    3633    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3734    public JOSMTestRules test = new JOSMTestRules().platform();
     35    private CommandTestData testData;
    3836
    3937    /**
     
    4240    @Before
    4341    public void setUp() {
    44         layer = new OsmDataLayer(new DataSet(), null, null);
    45         MainApplication.getLayerManager().addLayer(layer);
    46     }
    47 
    48     /**
    49      * Cleanup test resources.
    50      */
    51     @After
    52     public void tearDown() {
    53         MainApplication.getLayerManager().removeLayer(layer);
     42        testData = new CommandTestData();
    5443    }
    5544
     
    5948    @Test
    6049    public void testExecuteUndoCommand() {
    61         DataSet ds = MainApplication.getLayerManager().getEditDataSet();
    62         Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
     50        DataSet ds = testData.layer.data;
     51        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
    6352        ConflictAddCommand cmd = new ConflictAddCommand(ds, conflict);
    6453        assertTrue(cmd.executeCommand());
     
    7564    @Test
    7665    public void testGetDescriptionIcon() {
    77         OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer();
    78         Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
    79         assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon());
     66        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
     67        assertNotNull(new ConflictAddCommand(testData.layer.data, conflict).getDescriptionIcon());
    8068    }
    8169
Note: See TracChangeset for help on using the changeset viewer.