Changeset 10218 in josm for trunk/test


Ignore:
Timestamp:
2016-05-15T18:36:50+02:00 (4 years ago)
Author:
Don-vip
Message:

findbugs - RC_REF_COMPARISON

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java

    r8624 r10218  
    33
    44import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertSame;
    65
    76import java.util.List;
     
    3837    public void test0() {
    3938        final List<TestError> errors = test("node name:de=Europa");
    40         assertSame(1, errors.size());
     39        assertEquals(1, errors.size());
    4140        assertEquals("A name is missing, even though name:* exists.", errors.get(0).getMessage());
    4241    }
     
    4847    public void test1() {
    4948        final List<TestError> errors = test("node name=Europe name:de=Europa");
    50         assertSame(1, errors.size());
     49        assertEquals(1, errors.size());
    5150        assertEquals("Missing name:*=Europe. Add tag with correct language key.", errors.get(0).getDescription());
    5251    }
     
    5857    public void test2() {
    5958        final List<TestError> errors = test("node name=Europe name:de=Europa name:en=Europe");
    60         assertSame(0, errors.size());
     59        assertEquals(0, errors.size());
    6160    }
    6261
     
    6867        List<TestError> errors;
    6968        errors = test("node \"name\"=\"Italia - Italien - Italy\"");
    70         assertSame(0, errors.size());
     69        assertEquals(0, errors.size());
    7170        errors = test("node name=\"Italia - Italien - Italy\" name:it=Italia");
    72         assertSame(2, errors.size());
     71        assertEquals(2, errors.size());
    7372        errors = test("node name=\"Italia - Italien - Italy\" name:it=Italia name:de=Italien");
    74         assertSame(1, errors.size());
     73        assertEquals(1, errors.size());
    7574        assertEquals("Missing name:*=Italy. Add tag with correct language key.", errors.get(0).getDescription());
    7675        errors = test("node name=\"Italia - Italien - Italy\" name:it=Italia name:de=Italien name:en=Italy");
    77         assertSame(0, errors.size());
     76        assertEquals(0, errors.size());
    7877    }
    7978}
  • trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java

    r9489 r10218  
    33
    44import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertSame;
    65
    76import java.io.IOException;
     
    6867            System.out.println("p3: "+DefaultNameFormatter.getInstance().format(p3)+" - "+p3);
    6968
    70             assertSame(comparator.compare(p1, p2), -1); // p1 < p2
    71             assertSame(comparator.compare(p2, p1),  1); // p2 > p1
     69            assertEquals(comparator.compare(p1, p2), -1); // p1 < p2
     70            assertEquals(comparator.compare(p2, p1),  1); // p2 > p1
    7271
    73             assertSame(comparator.compare(p1, p3), -1); // p1 < p3
    74             assertSame(comparator.compare(p3, p1),  1); // p3 > p1
    75             assertSame(comparator.compare(p2, p3),  1); // p2 > p3
    76             assertSame(comparator.compare(p3, p2), -1); // p3 < p2
     72            assertEquals(comparator.compare(p1, p3), -1); // p1 < p3
     73            assertEquals(comparator.compare(p3, p1),  1); // p3 > p1
     74            assertEquals(comparator.compare(p2, p3),  1); // p2 > p3
     75            assertEquals(comparator.compare(p3, p2), -1); // p3 < p2
    7776
    7877            Relation[] relations = new ArrayList<>(ds.getRelations()).toArray(new Relation[0]);
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r9942 r10218  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertSame;
    76import static org.junit.Assert.assertTrue;
    87
     
    6968        for (String file : new String[]{"osm.jos", "osm.joz"}) {
    7069            List<Layer> layers = testRead(file);
    71             assertSame(layers.size(), 1);
     70            assertEquals(layers.size(), 1);
    7271            assertTrue(layers.get(0) instanceof OsmDataLayer);
    7372            OsmDataLayer osm = (OsmDataLayer) layers.get(0);
     
    8584        for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) {
    8685            List<Layer> layers = testRead(file);
    87             assertSame(layers.size(), 1);
     86            assertEquals(layers.size(), 1);
    8887            assertTrue(layers.get(0) instanceof GpxLayer);
    8988            GpxLayer gpx = (GpxLayer) layers.get(0);
     
    10099    public void testReadGpxAndMarker() throws IOException, IllegalDataException {
    101100        List<Layer> layers = testRead("gpx_markers.joz");
    102         assertSame(layers.size(), 2);
     101        assertEquals(layers.size(), 2);
    103102        GpxLayer gpx = null;
    104103        MarkerLayer marker = null;
     
    124123    public void testReadImage() throws IOException, IllegalDataException {
    125124        final List<Layer> layers = testRead("bing.jos");
    126         assertSame(layers.size(), 1);
     125        assertEquals(layers.size(), 1);
    127126        assertTrue(layers.get(0) instanceof ImageryLayer);
    128127        final ImageryLayer image = (ImageryLayer) layers.get(0);
     
    145144        }
    146145        final List<Layer> layers = testRead("notes.joz");
    147         assertSame(layers.size(), 1);
     146        assertEquals(layers.size(), 1);
    148147        assertTrue(layers.get(0) instanceof NoteLayer);
    149148        final NoteLayer layer = (NoteLayer) layers.get(0);
Note: See TracChangeset for help on using the changeset viewer.