aboutsummaryrefslogtreecommitdiffstats
path: root/policy-utils
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-25 17:05:37 -0400
committerJim Hahn <jrh3@att.com>2020-08-25 18:47:23 -0400
commit72cf248dced4e272e69a8c48f5ee24c9d345f41d (patch)
treeb09ed0f9b7ee7aac6493119d950d78d50ae08da1 /policy-utils
parent5c71b5a62f4208030b3c3cd18b3f42398a0a86e5 (diff)
Address more sonars in drools-pdp
Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-utils')
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java6
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java1
2 files changed, 4 insertions, 3 deletions
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
index 47d6c2d8..5bc767cd 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
@@ -108,7 +108,8 @@ public class DomainMakerTest {
assertDomainPolicy(domainAPolicy);
domainAPolicy.getProperties().getNested().setNested1("");
- assertThatThrownBy(() -> domainMaker.conformance(policy1.getTypeIdentifier(), domainAPolicy))
+ ToscaPolicyTypeIdentifier ident1 = policy1.getTypeIdentifier();
+ assertThatThrownBy(() -> domainMaker.conformance(ident1, domainAPolicy))
.isInstanceOf(ValidationFailedException.class)
.hasMessageContaining("Pattern ^(.+)$ is not contained in text");
}
@@ -142,8 +143,9 @@ public class DomainMakerTest {
@Test
public void testConvertToSchema() {
+ ToscaPolicyType type = new ToscaPolicyType();
assertThatThrownBy(() -> domainMaker
- .convertToSchema(new ToscaPolicyType()))
+ .convertToSchema(type))
.isInstanceOf(UnsupportedOperationException.class);
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
index dbf6a67c..82a2b2e6 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
@@ -164,7 +164,6 @@ public class MdcTransactionTest {
assertEquals(trans.getInvocationId(), MDC.get(MdcTransactionConstants.INVOCATION_ID));
assertEquals(trans.timestamp(trans.getStartTime()), MDC.get(MdcTransactionConstants.BEGIN_TIMESTAMP));
assertEquals(trans.timestamp(trans.getEndTime()), MDC.get(MdcTransactionConstants.END_TIMESTAMP));
- assertNotEquals(trans.getElapsedTime(), MDC.get(MdcTransactionConstants.ELAPSED_TIME));
assertEquals(String.valueOf(Duration.between(trans.getStartTime(), trans.getEndTime()).toMillis()),
MDC.get(MdcTransactionConstants.ELAPSED_TIME));
assertEquals(trans.getServiceInstanceId(), MDC.get(MdcTransactionConstants.SERVICE_INSTANCE_ID));