diff --git a/pom.xml b/pom.xml index 82a46b5..534b3f4 100644 --- a/pom.xml +++ b/pom.xml @@ -26,10 +26,7 @@ 3.4.0 3.6.1 3.3.1 - 4.3.0 - 4.13.2 3.13.2 - 5.21.0 10.0.0 4.0.0 @@ -98,19 +95,26 @@ org.awaitility awaitility - ${awaitility.version} test org.mockito mockito-core - ${mockito.version} + test + + + org.junit.jupiter + junit-jupiter-api test junit junit - ${junit.version} + test + + + org.junit.vintage + junit-vintage-engine test diff --git a/src/main/java/org/folio/edge/api/utils/exception/AuthorizationException.java b/src/main/java/org/folio/edge/api/utils/exception/AuthorizationException.java index d6d349d..ba203ff 100644 --- a/src/main/java/org/folio/edge/api/utils/exception/AuthorizationException.java +++ b/src/main/java/org/folio/edge/api/utils/exception/AuthorizationException.java @@ -1,12 +1,16 @@ package org.folio.edge.api.utils.exception; /** - * Specific exception for handlig edge-authorization process + * Specific exception for handling edge-authorization process */ public class AuthorizationException extends RuntimeException { public AuthorizationException(String message) { super(message); } + + public AuthorizationException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/src/main/java/org/folio/edge/api/utils/util/PropertiesUtil.java b/src/main/java/org/folio/edge/api/utils/util/PropertiesUtil.java index f909ab0..20a6201 100644 --- a/src/main/java/org/folio/edge/api/utils/util/PropertiesUtil.java +++ b/src/main/java/org/folio/edge/api/utils/util/PropertiesUtil.java @@ -36,7 +36,7 @@ public static Properties getProperties(String secureStorePropFile) { logger.info("Successfully loaded properties from: {}", secureStorePropFile); } } catch (Exception e) { - throw new AuthorizationException("Failed to load secure store properties"); + throw new AuthorizationException("Failed to load secure store properties", e); } } else { logger.warn("No secure store properties file specified. Using defaults"); diff --git a/src/test/java/org/folio/edge/api/utils/exception/AuthorizationExceptionTest.java b/src/test/java/org/folio/edge/api/utils/exception/AuthorizationExceptionTest.java new file mode 100644 index 0000000..9f453f6 --- /dev/null +++ b/src/test/java/org/folio/edge/api/utils/exception/AuthorizationExceptionTest.java @@ -0,0 +1,24 @@ +package org.folio.edge.api.utils.exception; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.theInstance; +import static org.hamcrest.Matchers.is; + +import org.junit.jupiter.api.Test; + +class AuthorizationExceptionTest { + + @Test + void message() { + var e = new AuthorizationException("hi"); + assertThat(e.getMessage(), is("hi")); + } + + @Test + void messageAndCause() { + var cause = new IllegalArgumentException("bar"); + var e = new AuthorizationException("foo", cause); + assertThat(e.getMessage(), is("foo")); + assertThat(e.getCause(), is(theInstance(cause))); + } +}