Ticket #21768: 21768.patch
| File 21768.patch, 6.6 KB (added by , 4 years ago) |
|---|
-
test/unit/net/simon04/comfort0/EditLevel0LActionTest.java
10 10 import java.io.StringReader; 11 11 import java.util.List; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.command.ChangePropertyCommand; 16 16 import org.openstreetmap.josm.command.MoveCommand; 17 17 import org.openstreetmap.josm.command.PseudoCommand; … … 27 27 28 28 import net.simon04.comfort0.level0l.parsergen.Level0LParser; 29 29 import net.simon04.comfort0.level0l.parsergen.ParseException; 30 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 30 31 31 public class EditLevel0LActionTest { 32 @BasicPreferences 33 class EditLevel0LActionTest { 32 34 33 35 /** 34 36 * Setup rule 35 37 */ 36 @R ule38 @RegisterExtension 37 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 public JOSMTestRules test = new JOSMTestRules().preferences().projection();40 JOSMTestRules test = new JOSMTestRules().projection(); 39 41 40 42 private SequenceCommand buildChangeCommands(DataSet dataSet) throws ParseException { 41 43 final String level0l = "node 1831881213: 54.0900666, 12.2539381 #Neu Broderstorf (54.0900666, 12.2539381)\n" + … … 54 56 } 55 57 56 58 @Test 57 publicvoid test() throws Exception {59 void test() throws Exception { 58 60 final Node node = new Node(1831881213, 42); 59 61 node.setCoor(new LatLon(54.0900666, 12.2539381)); 60 62 final DataSet dataSet = new DataSet(node); -
test/unit/net/simon04/comfort0/OsmToLevel0LTest.java
1 1 package net.simon04.comfort0; 2 2 3 import static org.hamcrest.CoreMatchers.is; 4 import static org.junit.Assert.assertThat; 5 6 import java.io.InputStream; 7 8 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 9 import org.junit.Before; 10 import org.junit.Rule; 11 import org.junit.Test; 12 import org.openstreetmap.josm.data.Preferences; 3 import org.junit.jupiter.api.BeforeEach; 4 import org.junit.jupiter.api.Test; 13 5 import org.openstreetmap.josm.data.coor.LatLon; 14 6 import org.openstreetmap.josm.data.osm.DataSet; 15 7 import org.openstreetmap.josm.data.osm.Node; 16 8 import org.openstreetmap.josm.io.OsmReader; 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 import org.openstreetmap.josm.spi.preferences.Config; 10 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 18 11 19 public class OsmToLevel0LTest { 12 import java.io.InputStream; 20 13 21 /** 22 * Setup rule 23 */ 24 @Rule 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 public JOSMTestRules test = new JOSMTestRules().preferences(); 14 import static org.hamcrest.CoreMatchers.is; 15 import static org.hamcrest.MatcherAssert.assertThat; 27 16 28 @Before 29 public void setUp() throws Exception { 30 Preferences.main().putBoolean("osm-primitives.showcoor", true); 17 @BasicPreferences 18 class OsmToLevel0LTest { 19 20 @BeforeEach 21 public void setUp() { 22 Config.getPref().putBoolean("osm-primitives.showcoor", true); 31 23 } 32 24 33 25 @Test 34 public void testNode() throws Exception{26 void testNode() { 35 27 final Node node = new Node(1234L, 42); 36 28 node.setCoor(new LatLon(123.45, 67.89)); 37 29 node.put("name", "Comfort0"); … … 43 35 } 44 36 45 37 @Test 46 publicvoid testLargerExample() throws Exception {38 void testLargerExample() throws Exception { 47 39 // from https://wiki.openstreetmap.org/wiki/OSM_XML#OSM_XML_file_format 48 40 // compare to https://wiki.openstreetmap.org/wiki/Level0L#Examples 49 41 try (InputStream in = getClass().getClassLoader().getResource("example.osm").openStream()) { -
test/unit/net/simon04/comfort0/level0l/parsergen/Level0LParserTest.java
2 2 3 3 import static org.CustomMatchers.hasSize; 4 4 import static org.hamcrest.CoreMatchers.is; 5 import static org. junit.Assert.assertThat;5 import static org.hamcrest.MatcherAssert.assertThat; 6 6 7 7 import java.io.StringReader; 8 8 import java.util.List; 9 9 10 10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 11 import org.junit.Rule; 12 import org.junit.Test; 11 import org.junit.jupiter.api.Test; 13 12 import org.openstreetmap.josm.data.osm.NodeData; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 15 14 import org.openstreetmap.josm.data.osm.PrimitiveData; … … 16 15 import org.openstreetmap.josm.data.osm.RelationData; 17 16 import org.openstreetmap.josm.data.osm.WayData; 18 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 19 19 20 public class Level0LParserTest { 21 22 /** 23 * Setup rule 24 */ 25 @Rule 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 public JOSMTestRules test = new JOSMTestRules().preferences(); 28 20 @BasicPreferences 21 class Level0LParserTest { 29 22 @Test 30 publicvoid testNode() throws Exception {23 void testNode() throws Exception { 31 24 final String level0l = "" + 32 25 "node 298884272: 54.0901447, 12.2516513\n" + 33 26 " name = Neu Broderstorf\n" + … … 42 35 } 43 36 44 37 @Test 45 publicvoid testWay() throws Exception {38 void testWay() throws Exception { 46 39 final String level0l = "" + 47 40 "way 26659127\n" + 48 41 " nd 292403538\n" + … … 62 55 } 63 56 64 57 @Test 65 publicvoid testRelation() throws Exception {58 void testRelation() throws Exception { 66 59 final String level0l = "" + 67 60 "relation 56688 # member types: nd, wy, rel; roles are put after ids\n" + 68 61 " nd 294942404\n" + … … 89 82 } 90 83 91 84 @Test 92 publicvoid testExampleFromDocs() throws Exception {85 void testExampleFromDocs() throws Exception { 93 86 // https://wiki.openstreetmap.org/wiki/Level0L#Examples 94 87 final String level0l = "" + 95 88 "node 298884269: 54.0901746, 12.2482632 # made by user SvenHRO (46882) in changeset 676636 on 2008-09-21T21:37:45Z\n" +
