Changeset 13616 in josm for trunk


Ignore:
Timestamp:
2018-04-11T22:38:52+02:00 (6 years ago)
Author:
Don-vip
Message:

use OsmDataLayer.getDataSet() in unit tests

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

Legend:

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

    r13079 r13616  
    162162    @Test(expected = IllegalArgumentException.class)
    163163    public void testConsistencyDataset() {
    164         testData.layer.data.removePrimitive(testData.existingNode);
     164        testData.layer.getDataSet().removePrimitive(testData.existingNode);
    165165        new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay));
    166166    }
  • trunk/test/unit/org/openstreetmap/josm/command/PurgeCommandTest.java

    r13079 r13616  
    6363        // to check that algorithm ignores it:
    6464        Relation relationParent3 = testData.createRelation(102, new RelationMember("child", testData.existingRelation));
    65         PurgeCommand command = new PurgeCommand(testData.layer.data,
     65        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(),
    6666                Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingNode2, testData.existingWay,
    6767                        testData.existingRelation, relationParent, relationParent2),
     
    8484    @Test
    8585    public void testUndo() {
    86         PurgeCommand command = new PurgeCommand(testData.layer.data,
     86        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(),
    8787                Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay),
    8888                Arrays.<OsmPrimitive>asList(testData.existingWay));
     
    108108        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
    109109        ArrayList<OsmPrimitive> added = new ArrayList<>();
    110         PurgeCommand command = new PurgeCommand(testData.layer.data, Arrays.<OsmPrimitive>asList(testData.existingNode),
     110        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), Arrays.<OsmPrimitive>asList(testData.existingNode),
    111111                Arrays.<OsmPrimitive>asList(testData.existingRelation));
    112112        command.fillModifiedData(modified, deleted, added);
     
    122122    @Test
    123123    public void testGetParticipatingPrimitives() {
    124         PurgeCommand command = new PurgeCommand(testData.layer.data, Arrays.<OsmPrimitive>asList(testData.existingNode),
     124        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), Arrays.<OsmPrimitive>asList(testData.existingNode),
    125125                Arrays.<OsmPrimitive>asList(testData.existingRelation));
    126126        assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray());
     
    133133    public void testDescription() {
    134134        List<OsmPrimitive> shortList = Arrays.<OsmPrimitive>asList(testData.existingWay);
    135         assertTrue(new PurgeCommand(testData.layer.data, shortList, Arrays.<OsmPrimitive>asList()).getDescriptionText()
     135        assertTrue(new PurgeCommand(testData.layer.getDataSet(), shortList, Arrays.<OsmPrimitive>asList()).getDescriptionText()
    136136                .matches("Purged 1 object"));
    137137        List<OsmPrimitive> longList = Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingNode2,
    138138                testData.existingWay);
    139         assertTrue(new PurgeCommand(testData.layer.data, longList, Arrays.<OsmPrimitive>asList()).getDescriptionText()
     139        assertTrue(new PurgeCommand(testData.layer.getDataSet(), longList, Arrays.<OsmPrimitive>asList()).getDescriptionText()
    140140                .matches("Purged 3 objects"));
    141141    }
  • trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java

    r13079 r13616  
    5151    @Test
    5252    public void testExecute() {
    53         SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
     53        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay));
    5454
    55         testData.layer.data.setSelected(Arrays.asList(testData.existingNode2));
     55        testData.layer.getDataSet().setSelected(Arrays.asList(testData.existingNode2));
    5656
    5757        command.executeCommand();
     
    6868    public void testExecuteAfterModify() {
    6969        List<OsmPrimitive> list = new ArrayList<>(Arrays.asList(testData.existingNode, testData.existingWay));
    70         SelectCommand command = new SelectCommand(testData.layer.data, list);
     70        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), list);
    7171
    7272        list.remove(testData.existingNode);
     
    8585    @Test
    8686    public void testUndo() {
    87         SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
    88         testData.layer.data.setSelected(Arrays.asList(testData.existingNode2));
     87        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay));
     88        testData.layer.getDataSet().setSelected(Arrays.asList(testData.existingNode2));
    8989
    9090        command.executeCommand();
     
    111111        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
    112112        ArrayList<OsmPrimitive> added = new ArrayList<>();
    113         SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
     113        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay));
    114114        command.fillModifiedData(modified, deleted, added);
    115115        // intentionally empty.
     
    124124    @Test
    125125    public void testGetParticipatingPrimitives() {
    126         SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode));
     126        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode));
    127127        command.executeCommand();
    128128        assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
     
    134134    @Test
    135135    public void testDescription() {
    136         DataSet ds = testData.layer.data;
     136        DataSet ds = testData.layer.getDataSet();
    137137        assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode))
    138138                .getDescriptionText().matches("Selected 1 object"));
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r13079 r13616  
    4949    @Test
    5050    public void testExecuteUndoCommand() {
    51         DataSet ds = testData.layer.data;
     51        DataSet ds = testData.layer.getDataSet();
    5252        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
    5353        ConflictAddCommand cmd = new ConflictAddCommand(ds, conflict);
     
    6666    public void testGetDescriptionIcon() {
    6767        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
    68         assertNotNull(new ConflictAddCommand(testData.layer.data, conflict).getDescriptionIcon());
     68        assertNotNull(new ConflictAddCommand(testData.layer.getDataSet(), conflict).getDescriptionIcon());
    6969    }
    7070
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java

    r12636 r13616  
    7777
    7878        // active layer, should change
    79         testData1.layer.data.setSelected(testData1.existingNode.getPrimitiveId());
     79        testData1.layer.getDataSet().setSelected(testData1.existingNode.getPrimitiveId());
    8080        assertSelectionEquals(listeners, new HashSet<OsmPrimitive>(Arrays.asList(testData1.existingNode)));
    8181
    82         testData1.layer.data.clearSelection(testData1.existingNode.getPrimitiveId());
     82        testData1.layer.getDataSet().clearSelection(testData1.existingNode.getPrimitiveId());
    8383        assertSelectionEquals(listeners, new HashSet<OsmPrimitive>(Arrays.asList()));
    8484
    85         testData1.layer.data.addSelected(testData1.existingNode2.getPrimitiveId());
     85        testData1.layer.getDataSet().addSelected(testData1.existingNode2.getPrimitiveId());
    8686        assertSelectionEquals(listeners, new HashSet<OsmPrimitive>(Arrays.asList(testData1.existingNode2)));
    8787
     
    9191
    9292        // This should not trigger anything, since the layer is not active any more.
    93         testData1.layer.data.clearSelection(testData1.existingNode.getPrimitiveId());
     93        testData1.layer.getDataSet().clearSelection(testData1.existingNode.getPrimitiveId());
    9494        assertSelectionEquals(listeners, null);
    9595
    96         testData2.layer.data.setSelected(testData2.existingNode.getPrimitiveId());
     96        testData2.layer.getDataSet().setSelected(testData2.existingNode.getPrimitiveId());
    9797        assertSelectionEquals(listeners, new HashSet<OsmPrimitive>(Arrays.asList(testData2.existingNode)));
    9898
     
    104104
    105105        // no event triggered now
    106         testData2.layer.data.setSelected(testData2.existingNode2.getPrimitiveId());
     106        testData2.layer.getDataSet().setSelected(testData2.existingNode2.getPrimitiveId());
    107107        assertSelectionEquals(listeners, null);
    108108    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r13489 r13616  
    2626import org.openstreetmap.josm.command.SequenceCommand;
    2727import org.openstreetmap.josm.data.osm.DataSet;
     28import org.openstreetmap.josm.data.osm.IPrimitive;
    2829import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2930import org.openstreetmap.josm.data.osm.OsmUtils;
     
    233234            List<TestError> errors = test.getErrors();
    234235            assertEquals(errorsCount, errors.size());
    235             Set<Set<OsmPrimitive>> primitives = new HashSet<>();
     236            Set<Set<IPrimitive>> primitives = new HashSet<>();
    236237            for (TestError e : errors) {
    237238                primitives.add(new HashSet<>(e.getPrimitives()));
Note: See TracChangeset for help on using the changeset viewer.