Reliable Error State Tests - Nimbus

A test against the Nimbus library was relying on specific messaging
from Nimbus as well as the JDK, making it brittle.

Now, it simply relies on the messaging that we control.

Issue: gh-4887
This commit is contained in:
Josh Cummings 2018-07-16 14:43:57 -06:00
parent a9bc384b48
commit becff23df1
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
1 changed files with 2 additions and 3 deletions

View File

@ -146,7 +146,7 @@ public class NimbusJwtDecoderJwkSupportTests {
}
@Test
public void decodeWhenJwkEndpointIsUnresponsiveThenReturnsStockException() throws Exception {
public void decodeWhenJwkEndpointIsUnresponsiveThenRetrunsJwtException() throws Exception {
try ( MockWebServer server = new MockWebServer() ) {
server.enqueue(new MockResponse().setBody(MALFORMED_JWK_SET));
String jwkSetUrl = server.url("/.well-known/jwks.json").toString();
@ -157,8 +157,7 @@ public class NimbusJwtDecoderJwkSupportTests {
assertThatCode(() -> decoder.decode(SIGNED_JWT))
.isInstanceOf(JwtException.class)
.hasMessage("An error occurred while attempting to decode the Jwt: " +
"Couldn't retrieve remote JWK set: Connection refused (Connection refused)");
.hasMessageContaining("An error occurred while attempting to decode the Jwt");
}
}
}