Changeset 15950 in josm for trunk/test
- Timestamp:
- 2020-02-28T00:24:17+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java
r15671 r15950 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertNull; 5 7 import static org.junit.Assert.assertTrue; 6 8 … … 14 16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 17 18 /** 19 * Unit tests for class {@link OsmUtils}. 20 */ 16 21 public class OsmUtilsTest { 17 22 … … 23 28 public JOSMTestRules test = new JOSMTestRules(); 24 29 30 /** 31 * Unit test of {@link OsmUtils#createPrimitive} 32 */ 25 33 @Test 26 public void testCreatePrimitive() throws Exception{34 public void testCreatePrimitive() { 27 35 final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail"); 28 36 assertTrue(p instanceof Way); … … 32 40 } 33 41 42 /** 43 * Unit test of {@link OsmUtils#createPrimitive} 44 */ 34 45 @Test 35 public void testArea() throws Exception{46 public void testArea() { 36 47 final OsmPrimitive p = OsmUtils.createPrimitive("area name=Foo railway=rail"); 37 48 assertEquals(OsmPrimitiveType.WAY, p.getType()); 38 assert True(p.getKeys().equals(OsmUtils.createPrimitive("way name=Foo railway=rail").getKeys()));49 assertEquals(p.getKeys(), OsmUtils.createPrimitive("way name=Foo railway=rail").getKeys()); 39 50 } 40 51 52 /** 53 * Unit test of {@link OsmUtils#createPrimitive} 54 */ 41 55 @Test(expected = IllegalArgumentException.class) 42 public void testCreatePrimitiveFail() throws Exception{56 public void testCreatePrimitiveFail() { 43 57 OsmUtils.createPrimitive("noway name=Foo"); 44 58 } 45 59 60 /** 61 * Unit test of {@link OsmUtils#splitMultipleValues} 62 */ 46 63 @Test 47 64 public void testSplitMultipleValues() { … … 52 69 OsmUtils.splitMultipleValues("Tu-Fr 08:00-18:00;Mo 09:00-18:00;Sa 09:00-12:00;closed Aug").collect(Collectors.toList())); 53 70 } 71 72 /** 73 * Unit test of {@link OsmUtils#isTrue}, {@link OsmUtils#isFalse}, {@link OsmUtils#getOsmBoolean} 74 */ 75 @Test 76 public void testTrueFalse() { 77 assertTrue(OsmUtils.isTrue("yes")); 78 assertFalse(OsmUtils.isFalse("yes")); 79 assertEquals(Boolean.TRUE, OsmUtils.getOsmBoolean("yes")); 80 assertTrue(OsmUtils.isFalse("no")); 81 assertFalse(OsmUtils.isTrue("no")); 82 assertEquals(Boolean.FALSE, OsmUtils.getOsmBoolean("no")); 83 assertNull(OsmUtils.getOsmBoolean("foobar")); 84 } 54 85 }
Note:
See TracChangeset
for help on using the changeset viewer.
