From ee056d6cc097a2157cf96f4fda88b6fdd11040be Mon Sep 17 00:00:00 2001 From: Les Hazlewood <121180+lhazlewood@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:30:47 -0700 Subject: [PATCH] Code coverage to 100% --- .../impl/security/DefaultJwkParserTest.groovy | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/impl/src/test/groovy/io/jsonwebtoken/impl/security/DefaultJwkParserTest.groovy b/impl/src/test/groovy/io/jsonwebtoken/impl/security/DefaultJwkParserTest.groovy index 60945e761..175e8c613 100644 --- a/impl/src/test/groovy/io/jsonwebtoken/impl/security/DefaultJwkParserTest.groovy +++ b/impl/src/test/groovy/io/jsonwebtoken/impl/security/DefaultJwkParserTest.groovy @@ -28,8 +28,7 @@ import java.nio.charset.StandardCharsets import java.security.Key import java.security.Provider -import static org.junit.Assert.assertEquals -import static org.junit.Assert.fail +import static org.junit.Assert.* class DefaultJwkParserTest { @@ -84,6 +83,18 @@ class DefaultJwkParserTest { } } + @Test + void testParseWithProvider() { + def provider = Providers.findBouncyCastle(Conditions.TRUE) + def jwk = Jwks.builder().provider(provider).key(TestKeys.HS256).build() + def serializer = Services.loadFirst(Serializer) + def data = serializer.serialize(jwk) + String json = new String(data, StandardCharsets.UTF_8) + def parsed = Jwks.parser().provider(provider).build().parse(json) + assertEquals jwk, parsed + assertSame provider, parsed.@context.@provider + } + @Test void testDeserializationFailure() { def parser = new DefaultJwkParser(null, Services.loadFirst(Deserializer)) {