aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/src/test')
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java7
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java5
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java5
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java6
4 files changed, 13 insertions, 10 deletions
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java
index 1ed27890..63c71608 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.drools.core;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.doAnswer;
@@ -97,7 +98,7 @@ public class PolicySessionTest {
// re-start
session.startThread();
- session.stopThread();
+ assertThatCode(() -> session.stopThread()).doesNotThrowAnyException();
}
@Test
@@ -140,7 +141,7 @@ public class PolicySessionTest {
}
};
- model.updated();
+ assertThatCode(() -> model.updated()).doesNotThrowAnyException();
}
@Test
@@ -156,7 +157,7 @@ public class PolicySessionTest {
/**
* Starts a thread and then invokes a function to generate an exception within the
* fireUntilHalt() method.
- *
+ *
* @param genEx function to generate an exception
* @throws Exception if an error occurs
*/
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java
index ce4ca5fd..06489a5c 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/AlwaysFailLockTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.core.lock;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -77,7 +78,7 @@ public class AlwaysFailLockTest {
@Test
public void testAlwaysFailLockNoArgs() {
// verify that no-arg constructor doesn't throw an exception
- new AlwaysFailLock();
+ assertThatCode(() -> new AlwaysFailLock()).doesNotThrowAnyException();
}
@Test
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java
index 902f3043..56cd5090 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.drools.core.lock;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
@@ -193,7 +194,7 @@ public class LockImplTest {
doThrow(new IllegalArgumentException(EXPECTED_EXCEPTION)).when(callback).lockUnavailable(any());
// should not throw an exception
- lock.notifyAvailable();
+ assertThatCode(() -> lock.notifyAvailable()).doesNotThrowAnyException();
}
@Test
@@ -210,7 +211,7 @@ public class LockImplTest {
doThrow(new IllegalArgumentException(EXPECTED_EXCEPTION)).when(callback).lockUnavailable(any());
// should not throw an exception
- lock.notifyUnavailable();
+ assertThatCode(() -> lock.notifyUnavailable()).doesNotThrowAnyException();
}
@Test
diff --git a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java
index 97110744..f230d4f9 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java
@@ -130,15 +130,15 @@ public class KieUtilsTest {
// test IOException from ClassLoader
log = new StringBuffer();
- assertNull(KieUtils.resourceToPackages(new BogusClassLoader(log), "BogusClassLoader"));
+ assertNull(KieUtils.resourceToPackages(new BogusClassLoader(log), "BogusClassLoader").orElse(null));
assertEquals("IOException(BogusClassLoader)", log.toString());
// test 'null' return when no resources are found
- assertNull(KieUtils.resourceToPackages(ClassLoader.getSystemClassLoader(), "no/such/url"));
+ assertNull(KieUtils.resourceToPackages(ClassLoader.getSystemClassLoader(), "no/such/url").orElse(null));
// test IOException in 'IOUtils.toByteArray()' -> 'InputStream.read()'
log = new StringBuffer();
- assertNull(KieUtils.resourceToPackages(new BogusClassLoader(log), "BogusUrl"));
+ assertNull(KieUtils.resourceToPackages(new BogusClassLoader(log), "BogusUrl").orElse(null));
assertEquals("", log.toString());
// don't know how to test 'KieBuilder' errors at this point