Changeset 9220 in josm for trunk/test/unit


Ignore:
Timestamp:
2015-12-30T03:21:52+01:00 (9 years ago)
Author:
Don-vip
Message:

update unitils-core to 3.4.2, increase unit test coverage with EqualsVerifier, make OAuthParameters immutable

Location:
trunk/test/unit/org/openstreetmap/josm/data/oauth
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java

    r9201 r9220  
    55import static org.junit.Assert.assertNotEquals;
    66import static org.junit.Assert.assertNotNull;
     7import nl.jqno.equalsverifier.EqualsVerifier;
    78
    89import org.junit.Test;
     10import org.openstreetmap.josm.Main;
    911import org.openstreetmap.josm.io.OsmApi;
    1012
     
    2527        assertNotNull(dev);
    2628        assertNotEquals(def, dev);
     29        Main.logLevel = 5; // enable trace for line coverage
    2730        assertEquals(def, OAuthParameters.createDefault("wrong_url"));
    2831    }
    2932
    3033    /**
    31      * Unit test of method {@link OAuthParameters#equals}.
     34     * Unit test of methods {@link OAuthParameters#equals} and {@link OAuthParameters#hashCode}.
    3235     */
    3336    @Test
    34     public void testEquals() {
    35         OAuthParameters dev = OAuthParameters.createDefault("http://master.apis.dev.openstreetmap.org/api");
    36         OAuthParameters dev2 = new OAuthParameters(dev);
    37         assertEquals(dev, dev2);
     37    public void equalsContract() {
     38        EqualsVerifier.forClass(OAuthParameters.class).usingGetClass().verify();
    3839    }
    3940}
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthTokenTest.java

    r9201 r9220  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNotNull;
     6import nl.jqno.equalsverifier.EqualsVerifier;
    67import oauth.signpost.OAuthConsumer;
    78
     
    2728
    2829    /**
    29      * Unit test of method {@link OAuthToken#equals}.
     30     * Unit test of methods {@link OAuthToken#equals} and {@link OAuthToken#hashCode}.
    3031     */
    3132    @Test
    32     public void testEquals() {
    33         OAuthToken tok = new OAuthToken(
    34                 OAuthParameters.DEFAULT_JOSM_CONSUMER_KEY,
    35                 OAuthParameters.DEFAULT_JOSM_CONSUMER_SECRET);
    36         OAuthToken tok2 = new OAuthToken(tok);
    37         assertEquals(tok, tok2);
     33    public void equalsContract() {
     34        EqualsVerifier.forClass(OAuthToken.class).usingGetClass().verify();
    3835    }
    3936}
Note: See TracChangeset for help on using the changeset viewer.