@Test
    void verifyEncodingWithPublicKeyOnly() throws Throwable {
        val jwksKeystore = new ClassPathResource("sample.jwks");
        val data = IOUtils.toString(jwksKeystore.getInputStream(), StandardCharsets.UTF_8);
        val json = new JsonWebKeySet(data).toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY);
        val keystoreFile = File.createTempFile("keystorepub", ".json");
        FileUtils.write(keystoreFile, json, StandardCharsets.UTF_8);
        try (val cipher = new JsonWebKeySetStringCipherExecutor(keystoreFile, Optional.of("cas"))) {
            assertThrows(IllegalArgumentException.class, () -> cipher.encode("value", EMPTY_OBJECT_ARRAY));
        }
    }
This is {@link JsonWebKeySetStringCipherExecutorTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-util/src/test/java/org/apereo/cas/util/cipher/JsonWebKeySetStringCipherExecutorTests.java