From 1afc19984ceafa918b0258210ba87e3415629b81 Mon Sep 17 00:00:00 2001 From: Guillaume Lamirand Date: Thu, 6 Jul 2023 16:12:45 +0200 Subject: [PATCH] fix: bump gateway-api version --- pom.xml | 2 +- .../gravitee/policy/keyless/KeylessPolicyTest.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f2547742..8ce87162 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 5.0.0 - 3.0.0-alpha.7 + 3.0.0-alpha.9 1.11.0 3.1.0-alpha.10 2.1.1 diff --git a/src/test/java/io/gravitee/policy/keyless/KeylessPolicyTest.java b/src/test/java/io/gravitee/policy/keyless/KeylessPolicyTest.java index d63f640e..dab68ffe 100644 --- a/src/test/java/io/gravitee/policy/keyless/KeylessPolicyTest.java +++ b/src/test/java/io/gravitee/policy/keyless/KeylessPolicyTest.java @@ -95,7 +95,19 @@ void shouldReturnNoneTypedSecurityTokenWhenNoneTypedSecurityTokenInInternalAttri @EnumSource(value = SecurityToken.TokenType.class, names = { "CLIENT_ID", "API_KEY" }) @DisplayName("Should return an empty Maybe if there was a SecurityToken extracted by the previous plan") void shouldReturnAnEmptyWhenExtractingSecurityToken(SecurityToken.TokenType type) { - when(ctx.getInternalAttribute(ATTR_INTERNAL_SECURITY_TOKEN)).thenReturn(new SecurityToken(type, "tokenValue")); + when(ctx.getInternalAttribute(ATTR_INTERNAL_SECURITY_TOKEN)) + .thenReturn(SecurityToken.builder().tokenType(type.name()).tokenValue("tokenValue").build()); + final TestObserver obs = cut.extractSecurityToken(ctx).test(); + + obs.assertNoValues(); + } + + @ParameterizedTest + @EnumSource(value = SecurityToken.TokenType.class, names = { "CLIENT_ID", "API_KEY" }) + @DisplayName("Should return an empty Maybe if there was an invalid SecurityToken extracted by the previous plan") + void shouldReturnAnEmptyWhenExtractingInvalidSecurityToken(SecurityToken.TokenType type) { + when(ctx.getInternalAttribute(ATTR_INTERNAL_SECURITY_TOKEN)) + .thenReturn(SecurityToken.builder().tokenType(type.name()).invalid(true).build()); final TestObserver obs = cut.extractSecurityToken(ctx).test(); obs.assertNoValues();