Changeset 7005 in josm for trunk/test


Ignore:
Timestamp:
2014-04-26T17:39:23+02:00 (6 years ago)
Author:
Don-vip
Message:

see #8465 - use diamond operator where applicable

Location:
trunk/test
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r6995 r7005  
    5555        int numRelations = 1000;
    5656
    57         ArrayList<Node> nodes = new ArrayList<Node>();
    58         ArrayList<Way> ways = new ArrayList<Way>();
     57        ArrayList<Node> nodes = new ArrayList<>();
     58        ArrayList<Way> ways = new ArrayList<>();
    5959
    6060        // create a set of nodes
     
    122122    static public void createDataSetOnServer(DataSet ds) throws OsmTransferException {
    123123        logger.info("creating data set on the server ...");
    124         ArrayList<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
     124        ArrayList<OsmPrimitive> primitives = new ArrayList<>();
    125125        primitives.addAll(testDataSet.getNodes());
    126126        primitives.addAll(testDataSet.getWays());
     
    246246    public void testMultiGet10Nodes() throws OsmTransferException {
    247247        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    248         ArrayList<Node> nodes = new ArrayList<Node>(ds.getNodes());
     248        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
    249249        for (int i =0; i< 10; i++) {
    250250            reader.append(nodes.get(i));
     
    263263    public void testMultiGet10Ways() throws OsmTransferException {
    264264        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    265         ArrayList<Way> ways= new ArrayList<Way>(ds.getWays());
     265        ArrayList<Way> ways= new ArrayList<>(ds.getWays());
    266266        for (int i =0; i< 10; i++) {
    267267            reader.append(ways.get(i));
     
    281281    public void testMultiGet10Relations() throws OsmTransferException {
    282282        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    283         ArrayList<Relation> relations= new ArrayList<Relation>(ds.getRelations());
     283        ArrayList<Relation> relations= new ArrayList<>(ds.getRelations());
    284284        for (int i =0; i< 10; i++) {
    285285            reader.append(relations.get(i));
     
    299299    public void testMultiGet800Nodes() throws OsmTransferException {
    300300        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    301         ArrayList<Node> nodes = new ArrayList<Node>(ds.getNodes());
     301        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
    302302        for (int i =0; i< 812; i++) {
    303303            reader.append(nodes.get(i));
     
    316316    public void multiGetWithNonExistingNode() throws OsmTransferException {
    317317        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    318         ArrayList<Node> nodes = new ArrayList<Node>(ds.getNodes());
     318        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
    319319        for (int i =0; i< 10; i++) {
    320320            reader.append(nodes.get(i));
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r6995 r7005  
    127127    static public void createDataSetOnServer(DataSet ds) throws OsmTransferException {
    128128        logger.info("creating data set on the server ...");
    129         ArrayList<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
     129        ArrayList<OsmPrimitive> primitives = new ArrayList<>();
    130130        primitives.addAll(ds.getNodes());
    131131        primitives.addAll(ds.getWays());
     
    328328        }
    329329        assertEquals(2, referers.getRelations().size());  // two relations referring to
    330         Set<Long> expectedNodeIds = new HashSet<Long>();
     330        Set<Long> expectedNodeIds = new HashSet<>();
    331331        for (Way way : referers.getWays()) {
    332332            Way orig = (Way) ds.getPrimitiveById(way);
     
    359359        DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE);
    360360
    361         Set<Long> referringRelationsIds = new HashSet<Long>();
     361        Set<Long> referringRelationsIds = new HashSet<>();
    362362        r = lookupRelation(referers, 6);
    363363        assertNotNull(r);
     
    386386        // ways are incomplete after reading.
    387387        //
    388         Set<Long> expectedWayIds = new HashSet<Long>();
     388        Set<Long> expectedWayIds = new HashSet<>();
    389389        for (RelationMember m : lookupRelation(ds, 6).getMembers()) {
    390390            if (m.isWay()) {
     
    420420
    421421    protected Set<Long> getNodeIdsInWay(Way way) {
    422         HashSet<Long> ret = new HashSet<Long>();
     422        HashSet<Long> ret = new HashSet<>();
    423423        if (way == null)return ret;
    424424        for (Node n: way.getNodes()) {
     
    429429
    430430    protected Set<Long> getNodeIdsInRelation(Relation r) {
    431         HashSet<Long> ret = new HashSet<Long>();
     431        HashSet<Long> ret = new HashSet<>();
    432432        if (r == null) return ret;
    433433        for (RelationMember m: r.getMembers()) {
     
    455455        DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE);
    456456
    457         Set<Long> referringRelationsIds = new HashSet<Long>();
     457        Set<Long> referringRelationsIds = new HashSet<>();
    458458        r = lookupRelation(referers, 6);
    459459        assertNotNull(r);
     
    482482        // ways are completely read after reading the relations
    483483        //
    484         Set<Long> expectedWayIds = new HashSet<Long>();
     484        Set<Long> expectedWayIds = new HashSet<>();
    485485        for (RelationMember m : lookupRelation(ds, 6).getMembers()) {
    486486            if (m.isWay()) {
     
    509509        }
    510510
    511         Set<Long> expectedNodeIds = new HashSet<Long>();
     511        Set<Long> expectedNodeIds = new HashSet<>();
    512512        for (int i = 6; i < 10; i++) {
    513513            Relation r1 = lookupRelation(ds, i);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java

    r6881 r7005  
    4444        ds.addPrimitive(n2);
    4545
    46         Collection<OsmPrimitive> all = new HashSet<OsmPrimitive>();
     46        Collection<OsmPrimitive> all = new HashSet<>();
    4747        all.addAll(Arrays.asList(new OsmPrimitive[] {n1, n2}));
    4848
    49         List<Filter> filters = new LinkedList<Filter>();
     49        List<Filter> filters = new LinkedList<>();
    5050        Filter f1 = new Filter();
    5151        f1.text = "fixme";
     
    6767            DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/filterTests.osm"), NullProgressMonitor.INSTANCE);
    6868
    69             List<Filter> filters = new LinkedList<Filter>();
     69            List<Filter> filters = new LinkedList<>();
    7070            switch (i) {
    7171            case 1: {
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java

    r6881 r7005  
    2020
    2121    private void compareReferrers(OsmPrimitive actual, OsmPrimitive... expected) {
    22         Assert.assertEquals(new HashSet<OsmPrimitive>(Arrays.asList(expected)),
    23                 new HashSet<OsmPrimitive>(actual.getReferrers()));
     22        Assert.assertEquals(new HashSet<>(Arrays.asList(expected)),
     23                new HashSet<>(actual.getReferrers()));
    2424    }
    2525
  • trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java

    r6881 r7005  
    2727
    2828    private void removeAllTest(DataSet ds) {
    29         List<Node> allNodes = new ArrayList<Node>(ds.getNodes());
    30         List<Way> allWays = new ArrayList<Way>(ds.getWays());
    31         List<Relation> allRelations = new ArrayList<Relation>(ds.getRelations());
     29        List<Node> allNodes = new ArrayList<>(ds.getNodes());
     30        List<Way> allWays = new ArrayList<>(ds.getWays());
     31        List<Relation> allRelations = new ArrayList<>(ds.getRelations());
    3232
    3333        QuadBuckets<Node> nodes = Reflection.field("nodes").ofType(new TypeRef<QuadBuckets<Node>>() {}).in(ds).get();
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java

    r4603 r7005  
    9393        way.addNode(1);
    9494        way.addNode(2);
    95         ArrayList<Long> ids = new ArrayList<Long>();
     95        ArrayList<Long> ids = new ArrayList<>();
    9696        for (long id : way.getNodes()) {
    9797            ids.add(id);
     
    102102        assertEquals(2, (long) ids.get(1));
    103103    }
    104 
    105104}
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r6995 r7005  
    3333     */
    3434    public static void main(String[] args) {
    35         Map<String, Projection> allCodes = new HashMap<String, Projection>();
     35        Map<String, Projection> allCodes = new HashMap<>();
    3636        for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
    3737            for (String code : pc.allCodes()) {
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r6995 r7005  
    5858        setUp();
    5959
    60         Map<String, Projection> supportedCodesMap = new HashMap<String, Projection>();
     60        Map<String, Projection> supportedCodesMap = new HashMap<>();
    6161        for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
    6262            for (String code : pc.allCodes()) {
     
    6868        }
    6969
    70         List<TestData> prevData = new ArrayList<TestData>();
     70        List<TestData> prevData = new ArrayList<>();
    7171        if (new File(PROJECTION_DATA_FILE).exists()) {
    7272            prevData = readData();
    7373        }
    74         Map<String,TestData> prevCodesMap = new HashMap<String,TestData>();
     74        Map<String,TestData> prevCodesMap = new HashMap<>();
    7575        for (TestData data : prevData) {
    7676            prevCodesMap.put(data.code, data);
    7777        }
    7878
    79         Set<String> codesToWrite = new LinkedHashSet<String>();
     79        Set<String> codesToWrite = new LinkedHashSet<>();
    8080        for (TestData data : prevData) {
    8181            if (supportedCodesMap.containsKey(data.code)) {
     
    116116    private static List<TestData> readData() throws IOException, FileNotFoundException {
    117117        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), Utils.UTF_8));
    118         List<TestData> result = new ArrayList<TestData>();
     118        List<TestData> result = new ArrayList<>();
    119119        String line;
    120120        while ((line = in.readLine()) != null) {
     
    159159    public void regressionTest() throws IOException, FileNotFoundException {
    160160        List<TestData> allData = readData();
    161         Set<String> dataCodes = new HashSet<String>();
     161        Set<String> dataCodes = new HashSet<>();
    162162        for (TestData data : allData) {
    163163            dataCodes.add(data.code);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r6949 r7005  
    7373        c.initialize();
    7474
    75         LinkedHashSet<String> assertionErrors = new LinkedHashSet<String>();
     75        LinkedHashSet<String> assertionErrors = new LinkedHashSet<>();
    7676        for (final MapCSSTagChecker.TagCheck check : c.checks) {
    7777            System.out.println("Check: "+check);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

    r6920 r7005  
    144144    public void testPresetValues() throws Exception {
    145145        final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false, false);
    146         final Set<Tag> values = new LinkedHashSet<Tag>();
     146        final Set<Tag> values = new LinkedHashSet<>();
    147147        for (final TaggingPreset p : presets) {
    148148            for (final TaggingPresetItem i : p.data) {
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java

    r6471 r7005  
    1919import org.junit.Test;
    2020import org.openstreetmap.josm.Main;
    21 import org.openstreetmap.josm.data.Preferences;
    2221import org.openstreetmap.josm.data.osm.DatasetFactory;
    2322import org.openstreetmap.josm.data.osm.Node;
     
    705704
    706705        class MyListener implements PropertyChangeListener {
    707             public ArrayList<PropertyChangeEvent> events = new ArrayList<PropertyChangeEvent>();
     706            public ArrayList<PropertyChangeEvent> events = new ArrayList<>();
    708707
    709708            public void propertyChange(PropertyChangeEvent evt) {
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java

    r6881 r7005  
    5959
    6060    private void populate(OsmPrimitive my, OsmPrimitive their) {
    61         model.populate(new Conflict<OsmPrimitive>(my, their));
     61        model.populate(new Conflict<>(my, their));
    6262    }
    6363
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java

    r6471 r7005  
    99import org.junit.Test;
    1010import org.openstreetmap.josm.Main;
    11 import org.openstreetmap.josm.data.Preferences;
    1211import org.openstreetmap.josm.data.osm.Node;
    1312import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java

    r6471 r7005  
    1313import org.junit.Test;
    1414import org.openstreetmap.josm.Main;
    15 import org.openstreetmap.josm.data.Preferences;
    1615import org.openstreetmap.josm.data.osm.Node;
    1716import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java

    r6471 r7005  
    1010import org.junit.Test;
    1111import org.openstreetmap.josm.Main;
    12 import org.openstreetmap.josm.data.Preferences;
    1312import org.openstreetmap.josm.data.osm.DataSet;
    1413import org.openstreetmap.josm.data.osm.Relation;
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r6471 r7005  
    1111import org.junit.Test;
    1212import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.Preferences;
    1413import org.openstreetmap.josm.data.osm.DataSet;
    1514import org.openstreetmap.josm.data.osm.Relation;
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/ToolbarPreferencesTest.java

    r3175 r7005  
    3131
    3232        public List<ActionParameter<?>> getActionParameters() {
    33             List<ActionParameter<?>> result = new ArrayList<ActionParameter<?>>();
     33            List<ActionParameter<?>> result = new ArrayList<>();
    3434            result.add(new StringActionParameter("param1"));
    3535            result.add(new StringActionParameter("param2"));
     
    4444
    4545    private void checkAction(ActionDefinition a, Object... params) {
    46         Map<String, Object> expected = new HashMap<String, Object>();
     46        Map<String, Object> expected = new HashMap<>();
    4747        for (int i=0; i<params.length; i+=2) {
    4848            expected.put((String)params[i], params[i+1]);
     
    5353    @Test
    5454    public void test1() {
    55         Map<String, Action> actions = new HashMap<String, Action>();
     55        Map<String, Action> actions = new HashMap<>();
    5656        actions.put("action", new TestAction());
    5757        ActionParser parser = new ActionParser(actions);
Note: See TracChangeset for help on using the changeset viewer.