Changeset 11973 in josm for trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
- Timestamp:
- 2017-04-22T15:23:07+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r11878 r11973 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue; 7 import static org.junit.Assert.fail; 8 4 9 import java.util.Date; 10 import java.util.Iterator; 5 11 import java.util.Set; 6 12 7 import org.junit.Assert;8 13 import org.junit.Rule; 9 14 import org.junit.Test; 10 15 import org.openstreetmap.josm.Main; 11 16 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetDataSetEntry; 12 18 import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType; 13 19 import org.openstreetmap.josm.data.osm.history.HistoryNode; … … 38 44 try { 39 45 cds.getPrimitivesByModificationType(null); 40 Assert.fail("Should have thrown an IllegalArgumentException as we gave a null argument.");46 fail("Should have thrown an IllegalArgumentException as we gave a null argument."); 41 47 } catch (IllegalArgumentException e) { 42 48 Main.trace(e); … … 45 51 46 52 // empty object, a modification type => empty list 47 Assert.assertTrue(53 assertTrue( 48 54 "Empty data set should produce an empty list.", 49 55 cds.getPrimitivesByModificationType( … … 61 67 Set<HistoryOsmPrimitive> result = cds.getPrimitivesByModificationType( 62 68 ChangesetModificationType.CREATED); 63 Assert.assertEquals("We should have found only one item.", 1, result.size()); 64 Assert.assertTrue("The item found is prim1.", result.contains(prim1)); 69 assertEquals("We should have found only one item.", 1, result.size()); 70 assertTrue("The item found is prim1.", result.contains(prim1)); 71 } 72 73 /** 74 * Unit test of method {@link ChangesetDataSet#iterator}. 75 */ 76 @Test 77 public void testIterator() { 78 final ChangesetDataSet cds = new ChangesetDataSet(); 79 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); 80 cds.put(prim1, ChangesetModificationType.CREATED); 81 Iterator<ChangesetDataSetEntry> it = cds.iterator(); 82 assertTrue(it.hasNext()); 83 ChangesetDataSetEntry cdse = it.next(); 84 assertEquals(ChangesetModificationType.CREATED, cdse.getModificationType()); 85 assertEquals(prim1, cdse.getPrimitive()); 86 assertFalse(it.hasNext()); 65 87 } 66 88 }
Note:
See TracChangeset
for help on using the changeset viewer.