TokenPolicy { public void setRefreshTokenFormat(String refreshTokenFormat) { if(TokenConstants.TokenFormat.fromStringValue(refreshTokenFormat) == null) { List<String> validFormats = TokenConstants.TokenFormat.getStringValues(); String message = String.format("Invalid refresh token format %s. Acceptable values are: %s", refreshTokenFormat, validFormats.toString()); throw new IllegalArgumentException(message); } this.refreshTokenFormat = refreshTokenFormat.toLowerCase(); } 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 public void tokenPolicy_whenInvalidUniquenessValue_throwsException() { TokenPolicy tokenPolicy = new TokenPolicy(); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Invalid refresh token format invalid. Acceptable values are: [opaque, jwt]"); tokenPolicy.setRefreshTokenFormat("invalid"); }