Changeset 10334 in josm for trunk/test/unit


Ignore:
Timestamp:
2016-06-07T21:26:44+02:00 (8 years ago)
Author:
Don-vip
Message:

fix equals methods for Coordinate classes

Location:
trunk/test/unit/org/openstreetmap/josm/data/coor
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java

    r10222 r10334  
    33
    44import static org.junit.Assert.assertEquals;
     5
     6import java.text.DecimalFormat;
    57
    68import org.junit.Before;
     
    911
    1012import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import nl.jqno.equalsverifier.EqualsVerifier;
    1114
    1215/**
     
    120123
    121124    /**
    122      * Test of {@link LatLon#equals}
     125     * Unit test of methods {@link LatLon#equals} and {@link LatLon#hashCode}.
    123126     */
    124127    @Test
    125     public void testEquals() {
    126         for (int i = 1; i < SAMPLE_VALUES.length; i++) {
    127             LatLon a = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]);
    128             LatLon b = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]);
    129             assertEquals(a, b);
    130         }
    131     }
    132 
    133     /**
    134      * Test of {@link LatLon#hashCode}
    135      */
    136     @Test
    137     public void testHashCode() {
    138         for (int i = 1; i < SAMPLE_VALUES.length; i++) {
    139             LatLon a = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]);
    140             LatLon b = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]);
    141             assertEquals(a.hashCode(), b.hashCode());
    142         }
     128    public void equalsContract() {
     129        EqualsVerifier.forClass(LatLon.class).usingGetClass()
     130            .withPrefabValues(DecimalFormat.class, new DecimalFormat("00.0"), new DecimalFormat("00.000"))
     131            .verify();
    143132    }
    144133
Note: See TracChangeset for help on using the changeset viewer.