Changeset 18665 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2023-02-16T16:01:49+01:00 (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuth20AuthorizationTest.java
r18650 r18665 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 5 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertNull;7 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 … … 10 10 import java.util.HashMap; 11 11 import java.util.Map; 12 import java.util.Optional; 12 13 import java.util.concurrent.atomic.AtomicReference; 13 14 import java.util.stream.Collectors; … … 166 167 void testAuthorize(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException { 167 168 final OAuth20Authorization authorization = new OAuth20Authorization(); 168 final AtomicReference< IOAuthToken> consumer = new AtomicReference<>();169 final AtomicReference<Optional<IOAuthToken>> consumer = new AtomicReference<>(); 169 170 OAuth20Parameters parameters = (OAuth20Parameters) OAuthParameters.createDefault(OsmApi.getOsmApi().getBaseUrl(), OAuthVersion.OAuth20); 170 171 RemoteControl.start(); … … 181 182 } 182 183 assertNotNull(consumer.get()); 183 assertEquals(OAuthVersion.OAuth20, consumer.get().getOAuthType()); 184 OAuth20Token token = (OAuth20Token) consumer.get(); 184 assertTrue(consumer.get().isPresent()); 185 assertEquals(OAuthVersion.OAuth20, consumer.get().get().getOAuthType()); 186 OAuth20Token token = (OAuth20Token) consumer.get().get(); 185 187 assertEquals("test_access_token", token.getBearerToken()); 186 188 } … … 190 192 oauthServer.stateToReturn = "Bad_State"; 191 193 final OAuth20Authorization authorization = new OAuth20Authorization(); 192 final AtomicReference< IOAuthToken> consumer = new AtomicReference<>();194 final AtomicReference<Optional<IOAuthToken>> consumer = new AtomicReference<>(); 193 195 OAuth20Parameters parameters = (OAuth20Parameters) OAuthParameters.createDefault(OsmApi.getOsmApi().getBaseUrl(), OAuthVersion.OAuth20); 194 196 RemoteControl.start(); … … 206 208 client.disconnect(); 207 209 } 208 assert Null(consumer.get());210 assertFalse(consumer.get().isPresent()); 209 211 } 210 212 }
Note:
See TracChangeset
for help on using the changeset viewer.