Changeset 10201 in josm


Ignore:
Timestamp:
2016-05-13T04:02:38+02:00 (8 years ago)
Author:
Don-vip
Message:

add more unit tests

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/oauth/SignpostAdapters.java

    r9970 r10201  
    2020    }
    2121
     22    /**
     23     * OAuth provider.
     24     */
    2225    public static class OAuthProvider extends AbstractOAuthProvider {
    2326
     27        /**
     28         * Constructs a new {@code OAuthProvider}.
     29         * @param requestTokenEndpointUrl request token endpoint URL
     30         * @param accessTokenEndpointUrl access token endpoint URL
     31         * @param authorizationWebsiteUrl authorization website URL
     32         */
    2433        public OAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl) {
    2534            super(requestTokenEndpointUrl, accessTokenEndpointUrl, authorizationWebsiteUrl);
     
    4655    }
    4756
     57    /**
     58     * OAuth consumer.
     59     */
    4860    public static class OAuthConsumer extends AbstractOAuthConsumer {
    4961
     62        /**
     63         * Constructs a new {@code OAuthConsumer}.
     64         * @param consumerKey consumer key
     65         * @param consumerSecret consumer secret
     66         */
    5067        public OAuthConsumer(String consumerKey, String consumerSecret) {
    5168            super(consumerKey, consumerSecret);
     
    5875    }
    5976
    60     private static class HttpRequest implements oauth.signpost.http.HttpRequest {
    61         private final HttpClient request;
     77    static final class HttpRequest implements oauth.signpost.http.HttpRequest {
     78        final HttpClient request;
    6279
    6380        HttpRequest(HttpClient request) {
     
    111128    }
    112129
    113     private static class HttpResponse implements oauth.signpost.http.HttpResponse {
    114         private final HttpClient.Response response;
     130    static final class HttpResponse implements oauth.signpost.http.HttpResponse {
     131        final HttpClient.Response response;
    115132
    116133        HttpResponse(HttpClient.Response response) {
     
    138155        }
    139156    }
    140 
    141157}
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java

    r9666 r10201  
    55import static org.junit.Assert.assertNotEquals;
    66import static org.junit.Assert.assertNotNull;
    7 import nl.jqno.equalsverifier.EqualsVerifier;
    87
     8import org.junit.BeforeClass;
    99import org.junit.Test;
     10import org.openstreetmap.josm.JOSMFixture;
    1011import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.io.OsmApi;
     13
     14import nl.jqno.equalsverifier.EqualsVerifier;
    1215
    1316/**
     
    1518 */
    1619public class OAuthParametersTest {
     20
     21    /**
     22     * Setup test.
     23     */
     24    @BeforeClass
     25    public static void setUpBeforeClass() {
     26        JOSMFixture.createUnitTestFixture().init();
     27    }
    1728
    1829    /**
     
    3445
    3546    /**
     47     * Unit test of method {@link OAuthParameters#createFromPreferences}.
     48     */
     49    @Test
     50    public void testCreateFromPreferences() {
     51        assertNotNull(OAuthParameters.createFromPreferences(Main.pref));
     52    }
     53
     54    /**
    3655     * Unit test of methods {@link OAuthParameters#equals} and {@link OAuthParameters#hashCode}.
    3756     */
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthTokenTest.java

    r9666 r10201  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNotNull;
     6
     7import org.junit.Test;
     8
    69import nl.jqno.equalsverifier.EqualsVerifier;
    710import oauth.signpost.OAuthConsumer;
    8 
    9 import org.junit.Test;
    1011
    1112/**
     
    2526        assertEquals(defCon.getToken(), defTok.getKey());
    2627        assertEquals(defCon.getTokenSecret(), defTok.getSecret());
     28        assertEquals(defTok, new OAuthToken(defTok));
    2729    }
    2830
Note: See TracChangeset for help on using the changeset viewer.