diff options
Diffstat (limited to 'feature-session-persistence/src/test')
-rw-r--r-- | feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java index 25f805d7..ec261982 100644 --- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java +++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java @@ -1098,15 +1098,9 @@ public class PersistenceFeatureTest { // return adjunct on next call when(polcont.getAdjunct(any())).thenReturn(adjcap.getValue()); - try { - doThrow(new IllegalArgumentException(EXPECTED)).when(emf).close(); - - feat.destroyKieSession(polsess); - fail(MISSING_EXCEPTION); - - } catch (IllegalArgumentException ex) { - logger.trace(EXPECTED, ex); - } + IllegalArgumentException exception = new IllegalArgumentException(EXPECTED); + doThrow(exception).when(emf).close(); + assertThatCode(() -> feat.destroyKieSession(polsess)).isEqualTo(exception); verify(bds, times(2)).close(); } @@ -1126,15 +1120,10 @@ public class PersistenceFeatureTest { // return adjunct on next call when(polcont.getAdjunct(any())).thenReturn(adjcap.getValue()); - try { - doThrow(new SQLException(EXPECTED)).when(bds).close(); - - feat.destroyKieSession(polsess); - fail(MISSING_EXCEPTION); - - } catch (PersistenceFeatureException ex) { - logger.trace(EXPECTED, ex); - } + SQLException cause = new SQLException(EXPECTED); + doThrow(cause).when(bds).close(); + assertThatCode(() -> feat.destroyKieSession(polsess)).isInstanceOf(PersistenceFeatureException.class) + .hasCause(cause); } /** |