Changeset 10846 in josm for trunk/test/unit


Ignore:
Timestamp:
2016-08-18T21:13:00+02:00 (8 years ago)
Author:
Don-vip
Message:

see #13232 - move class DatasetFactory to unit tests folder

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  
    2222import org.openstreetmap.josm.JOSMFixture;
    2323import org.openstreetmap.josm.Main;
    24 import org.openstreetmap.josm.data.osm.DatasetFactory;
    2524import org.openstreetmap.josm.data.osm.Node;
    2625import org.openstreetmap.josm.data.osm.Way;
     26import org.openstreetmap.josm.testutils.DatasetFactory;
    2727
    2828public class NodeListMergeModelTest {
  • trunk/test/unit/org/openstreetmap/josm/testutils/DatasetFactory.java

    r10841 r10846  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.data.osm;
     2package org.openstreetmap.josm.testutils;
     3
     4import org.openstreetmap.josm.data.osm.DataSet;
     5import org.openstreetmap.josm.data.osm.Node;
     6import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     7import org.openstreetmap.josm.data.osm.Relation;
     8import org.openstreetmap.josm.data.osm.Way;
    39
    410/**
    511 * Convenience class allowing to manage primitives in the dataset. Useful especially for tests
    6  *
    712 */
    813public class DatasetFactory {
     
    1015    private final DataSet ds;
    1116
     17    /**
     18     * Constructs a new {@code DatasetFactory} with a new dataset.
     19     */
    1220    public DatasetFactory() {
    13         ds = new DataSet();
     21        this(new DataSet());
    1422    }
    1523
     24    /**
     25     * Constructs a new {@code DatasetFactory} with a given dataset.
     26     * @param ds existing dataset to wrap
     27     */
    1628    public DatasetFactory(DataSet ds) {
    1729        this.ds = ds;
    1830    }
    1931
     32    /**
     33     * Replies node with given id.
     34     * @param id node id
     35     * @return node with given id
     36     */
    2037    public Node getNode(long id) {
    2138        return (Node) ds.getPrimitiveById(id, OsmPrimitiveType.NODE);
    2239    }
    2340
     41    /**
     42     * Replies way with given id.
     43     * @param id way id
     44     * @return way with given id
     45     */
    2446    public Way getWay(long id) {
    2547        return (Way) ds.getPrimitiveById(id, OsmPrimitiveType.WAY);
    2648    }
    2749
     50    /**
     51     * Replies relation with given id.
     52     * @param id relation id
     53     * @return relation with given id
     54     */
    2855    public Relation getRelation(long id) {
    2956        return (Relation) ds.getPrimitiveById(id, OsmPrimitiveType.RELATION);
    3057    }
    3158
     59    /**
     60     * Adds node with given id.
     61     * @param id node id
     62     * @return created node
     63     */
    3264    public Node addNode(long id) {
    3365        return addNode(id, 0);
    3466    }
    3567
     68    /**
     69     * Adds way with given id.
     70     * @param id way id
     71     * @return created way
     72     */
    3673    public Way addWay(long id) {
    3774        return addWay(id, 0);
    3875    }
    3976
     77    /**
     78     * Adds relation with given id.
     79     * @param id relation id
     80     * @return created relation
     81     */
    4082    public Relation addRelation(long id) {
    4183        return addRelation(id, 0);
    4284    }
    4385
     86    /**
     87     * Adds node with given id and version.
     88     * @param id node id
     89     * @param version node version
     90     * @return created node
     91     */
    4492    public Node addNode(long id, int version) {
    4593        Node n = new Node(id, version);
     
    4896    }
    4997
     98    /**
     99     * Adds way with given id and version.
     100     * @param id way id
     101     * @param version way version
     102     * @return created way
     103     */
    50104    public Way addWay(long id, int version) {
    51105        Way w = new Way(id, version);
     
    54108    }
    55109
     110    /**
     111     * Adds relation with given id and version.
     112     * @param id relation id
     113     * @param version relation version
     114     * @return created relation
     115     */
    56116    public Relation addRelation(long id, int version) {
    57117        Relation e = new Relation(id, version);
     
    59119        return e;
    60120    }
    61 
    62121}
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java

    r9728 r10846  
    1111import org.openstreetmap.josm.actions.search.SearchCompiler;
    1212import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
    13 import org.openstreetmap.josm.data.osm.DatasetFactory;
    1413import org.openstreetmap.josm.data.osm.Node;
    1514import org.openstreetmap.josm.data.osm.Relation;
    1615import org.openstreetmap.josm.data.osm.RelationMember;
     16import org.openstreetmap.josm.testutils.DatasetFactory;
    1717import org.unitils.reflectionassert.ReflectionAssert;
    1818
Note: See TracChangeset for help on using the changeset viewer.