Changeset 10846 in josm for trunk/test/unit
- Timestamp:
- 2016-08-18T21:13:00+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java
r10758 r10846 22 22 import org.openstreetmap.josm.JOSMFixture; 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.data.osm.DatasetFactory;25 24 import org.openstreetmap.josm.data.osm.Node; 26 25 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.testutils.DatasetFactory; 27 27 28 28 public class NodeListMergeModelTest { -
trunk/test/unit/org/openstreetmap/josm/testutils/DatasetFactory.java
r10841 r10846 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.data.osm; 2 package org.openstreetmap.josm.testutils; 3 4 import org.openstreetmap.josm.data.osm.DataSet; 5 import org.openstreetmap.josm.data.osm.Node; 6 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 7 import org.openstreetmap.josm.data.osm.Relation; 8 import org.openstreetmap.josm.data.osm.Way; 3 9 4 10 /** 5 11 * Convenience class allowing to manage primitives in the dataset. Useful especially for tests 6 *7 12 */ 8 13 public class DatasetFactory { … … 10 15 private final DataSet ds; 11 16 17 /** 18 * Constructs a new {@code DatasetFactory} with a new dataset. 19 */ 12 20 public DatasetFactory() { 13 ds = new DataSet();21 this(new DataSet()); 14 22 } 15 23 24 /** 25 * Constructs a new {@code DatasetFactory} with a given dataset. 26 * @param ds existing dataset to wrap 27 */ 16 28 public DatasetFactory(DataSet ds) { 17 29 this.ds = ds; 18 30 } 19 31 32 /** 33 * Replies node with given id. 34 * @param id node id 35 * @return node with given id 36 */ 20 37 public Node getNode(long id) { 21 38 return (Node) ds.getPrimitiveById(id, OsmPrimitiveType.NODE); 22 39 } 23 40 41 /** 42 * Replies way with given id. 43 * @param id way id 44 * @return way with given id 45 */ 24 46 public Way getWay(long id) { 25 47 return (Way) ds.getPrimitiveById(id, OsmPrimitiveType.WAY); 26 48 } 27 49 50 /** 51 * Replies relation with given id. 52 * @param id relation id 53 * @return relation with given id 54 */ 28 55 public Relation getRelation(long id) { 29 56 return (Relation) ds.getPrimitiveById(id, OsmPrimitiveType.RELATION); 30 57 } 31 58 59 /** 60 * Adds node with given id. 61 * @param id node id 62 * @return created node 63 */ 32 64 public Node addNode(long id) { 33 65 return addNode(id, 0); 34 66 } 35 67 68 /** 69 * Adds way with given id. 70 * @param id way id 71 * @return created way 72 */ 36 73 public Way addWay(long id) { 37 74 return addWay(id, 0); 38 75 } 39 76 77 /** 78 * Adds relation with given id. 79 * @param id relation id 80 * @return created relation 81 */ 40 82 public Relation addRelation(long id) { 41 83 return addRelation(id, 0); 42 84 } 43 85 86 /** 87 * Adds node with given id and version. 88 * @param id node id 89 * @param version node version 90 * @return created node 91 */ 44 92 public Node addNode(long id, int version) { 45 93 Node n = new Node(id, version); … … 48 96 } 49 97 98 /** 99 * Adds way with given id and version. 100 * @param id way id 101 * @param version way version 102 * @return created way 103 */ 50 104 public Way addWay(long id, int version) { 51 105 Way w = new Way(id, version); … … 54 108 } 55 109 110 /** 111 * Adds relation with given id and version. 112 * @param id relation id 113 * @param version relation version 114 * @return created relation 115 */ 56 116 public Relation addRelation(long id, int version) { 57 117 Relation e = new Relation(id, version); … … 59 119 return e; 60 120 } 61 62 121 } -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java
r9728 r10846 11 11 import org.openstreetmap.josm.actions.search.SearchCompiler; 12 12 import org.openstreetmap.josm.actions.search.SearchCompiler.Match; 13 import org.openstreetmap.josm.data.osm.DatasetFactory;14 13 import org.openstreetmap.josm.data.osm.Node; 15 14 import org.openstreetmap.josm.data.osm.Relation; 16 15 import org.openstreetmap.josm.data.osm.RelationMember; 16 import org.openstreetmap.josm.testutils.DatasetFactory; 17 17 import org.unitils.reflectionassert.ReflectionAssert; 18 18
Note:
See TracChangeset
for help on using the changeset viewer.