@Test
    void verifyBadSignatureOperation() throws Throwable {
        val publicKey = mock(PublicJsonWebKey.class);
        when(publicKey.getPublicKey()).thenReturn(mock(PublicKey.class));

        val service = mock(BaseTokenSigningAndEncryptionService.class);
        when(service.getJsonWebKeySigningKey(Optional.empty())).thenReturn(publicKey);
        when(service.decode(anyString(), any())).thenCallRealMethod();
        when(service.verifySignature(anyString(), any())).thenReturn(null);

        assertThrows(NullPointerException.class,
            () -> service.decode(UUID.randomUUID().toString(), Optional.empty()));
    }
This is {@link TokenSigningAndEncryptionServiceTests}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/ticket/TokenSigningAndEncryptionServiceTests.java