@Test public void setJwtValidatorFactoryWhenNullThenThrowIllegalArgumentException() { assertThatThrownBy(() -> this.idTokenDecoderFactory.setJwtValidatorFactory(null)) .isInstanceOf(IllegalArgumentException.class); }
@Test public void createDecoderWhenCustomJwtValidatorFactorySetThenApplied() { Function<ClientRegistration, OAuth2TokenValidator<Jwt>> customJwtValidatorFactory = mock(Function.class); this.idTokenDecoderFactory.setJwtValidatorFactory(customJwtValidatorFactory); when(customJwtValidatorFactory.apply(any(ClientRegistration.class))) .thenReturn(this.defaultJwtValidatorFactory.apply(this.registration.build())); this.idTokenDecoderFactory.createDecoder(this.registration.build()); verify(customJwtValidatorFactory).apply(any(ClientRegistration.class)); } }