Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.oauth;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertNotNull;
|
---|
6 |
|
---|
7 | import org.junit.jupiter.api.Test;
|
---|
8 | import org.openstreetmap.josm.TestUtils;
|
---|
9 |
|
---|
10 | import nl.jqno.equalsverifier.EqualsVerifier;
|
---|
11 | import oauth.signpost.OAuthConsumer;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Unit tests for class {@link OAuthToken}.
|
---|
15 | */
|
---|
16 | class OAuthTokenTest {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Unit test of method {@link OAuthToken#createToken}.
|
---|
20 | */
|
---|
21 | @Test
|
---|
22 | void testCreateToken() {
|
---|
23 | OAuthConsumer defCon = OAuthParameters.createDefault().buildConsumer();
|
---|
24 | assertNotNull(defCon);
|
---|
25 | OAuthToken defTok = OAuthToken.createToken(defCon);
|
---|
26 | assertNotNull(defTok);
|
---|
27 | assertEquals(defCon.getToken(), defTok.getKey());
|
---|
28 | assertEquals(defCon.getTokenSecret(), defTok.getSecret());
|
---|
29 | assertEquals(defTok, new OAuthToken(defTok));
|
---|
30 | }
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Unit test of methods {@link OAuthToken#equals} and {@link OAuthToken#hashCode}.
|
---|
34 | */
|
---|
35 | @Test
|
---|
36 | void testEqualsContract() {
|
---|
37 | TestUtils.assumeWorkingEqualsVerifier();
|
---|
38 | EqualsVerifier.forClass(OAuthToken.class).usingGetClass().verify();
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.