TokenPolicy { @JsonIgnore public void setKeys(Map<String, String> keys) { if (keys != null) { keys.forEach((key, value) -> { if (!StringUtils.hasText(value) || !StringUtils.hasText(key)) { throw new IllegalArgumentException("KeyId and Signing key should not be null or empty"); } }); } this.keys = keys == null ? null : new HashMap<>(keys); } TokenPolicy();  TokenPolicy(int accessTokenValidity, int refreshTokenValidity);  TokenPolicy(int accessTokenValidity, int refreshTokenValidity, Map<String, ? extends Map<String, String>> signingKeysMap); int getAccessTokenValidity(); void setAccessTokenValidity(int accessTokenValidity); int getRefreshTokenValidity(); void setRefreshTokenValidity(int refreshTokenValidity); @JsonIgnore Map<String, String> getKeys(); @JsonIgnore void setKeys(Map<String, String> keys); boolean isRefreshTokenUnique(); void setRefreshTokenUnique(boolean refreshTokenUnique); String getRefreshTokenFormat(); void setRefreshTokenFormat(String refreshTokenFormat); String getActiveKeyId(); void setActiveKeyId(String activeKeyId); boolean isJwtRevocable(); void setJwtRevocable(boolean jwtRevocable);  }
@Test(expected = IllegalArgumentException.class) public void nullKeyId() { TokenPolicy tokenPolicy = new TokenPolicy(); tokenPolicy.setKeys(Collections.singletonMap(null, "signing-key")); }
@Test(expected = IllegalArgumentException.class) public void emptyKeyId() { TokenPolicy tokenPolicy = new TokenPolicy(); tokenPolicy.setKeys(Collections.singletonMap(" ", "signing-key")); }
@Test(expected = IllegalArgumentException.class) public void nullSigningKey() { TokenPolicy tokenPolicy = new TokenPolicy(); tokenPolicy.setKeys(Collections.singletonMap("key-id", null)); }
@Test(expected = IllegalArgumentException.class) public void emptySigningKey() { TokenPolicy tokenPolicy = new TokenPolicy(); tokenPolicy.setKeys(Collections.singletonMap("key-id", " ")); }