Changeset 14202 in josm


Ignore:
Timestamp:
2018-08-29T20:50:13+02:00 (11 months ago)
Author:
Don-vip
Message:

spotbugs - more fixes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r14193 r14202  
    3333import java.util.List;
    3434import java.util.Map;
     35import java.util.Objects;
    3536import java.util.Optional;
    3637import java.util.concurrent.ForkJoinPool;
     
    190191        }
    191192
     193        @Override
     194        public int hashCode() {
     195            return Objects.hash(order, osm, style, flags);
     196        }
     197
     198        @Override
     199        public boolean equals(Object obj) {
     200            if (this == obj)
     201                return true;
     202            if (obj == null || getClass() != obj.getClass())
     203                return false;
     204            StyleRecord other = (StyleRecord) obj;
     205            return flags == other.flags
     206                && order == other.order
     207                && Objects.equals(osm, other.osm)
     208                && Objects.equals(style, other.style);
     209        }
     210
    192211        /**
    193212         * Get the style for this style element.
  • trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java

    r14201 r14202  
    3636     * Lat/Lon sample values for unit tests
    3737     */
     38    @SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION")
    3839    public static final List<Double> SAMPLE_VALUES = Arrays.asList(
    3940            // CHECKSTYLE.OFF: SingleSpaceSeparator
  • trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererTest.java

    r12078 r14202  
    77import org.junit.Test;
    88import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.StyleRecord;
     9
     10import nl.jqno.equalsverifier.EqualsVerifier;
     11import nl.jqno.equalsverifier.Warning;
    912
    1013/**
     
    7073    }
    7174
    72     private long floatToFixedCheckBits(float number, int totalBits) {
     75    private static long floatToFixedCheckBits(float number, int totalBits) {
    7376        long result = StyleRecord.floatToFixed(number, totalBits);
    7477        long shouldBeZero = result >> totalBits;
     
    7780    }
    7881
     82    /**
     83     * Unit test of methods {@link StyleRecord#equals} and {@link StyleRecord#hashCode}.
     84     */
     85    @Test
     86    public void testEqualsContract() {
     87        EqualsVerifier.forClass(StyleRecord.class).usingGetClass()
     88            .suppress(Warning.NONFINAL_FIELDS)
     89            .verify();
     90    }
    7991}
Note: See TracChangeset for help on using the changeset viewer.