Skip to content

Commit

Permalink
Add tests for jwk exception
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Oct 11, 2023
1 parent c708241 commit 0cc1896
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public class JwtVendorTest {
private Appender mockAppender;
private ArgumentCaptor<LogEvent> logEventCaptor;

@Test
public void testCreateJwkFromSettingsThrowsException() {
Settings faultySettings = Settings.builder().put("key.someProperty", "badValue").build();

Exception thrownException = Assert.assertThrows(Exception.class, () -> new JwtVendor(faultySettings, null));

String expectedMessagePart = "An error occurred during the creation of Jwk: ";
Assert.assertTrue(thrownException.getMessage().contains(expectedMessagePart));
}

@Test
public void testJsonWebKeyPropertiesSetFromJwkSettings() throws Exception {
Settings settings = Settings.builder().put("jwt.key.key1", "value1").put("jwt.key.key2", "value2").build();
Expand Down

0 comments on commit 0cc1896

Please sign in to comment.