summaryrefslogtreecommitdiffstats
path: root/models-base/src/test/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-02-10 16:17:10 -0500
committerJim Hahn <jrh3@att.com>2021-02-10 17:17:34 -0500
commitb7097d21c25a48c9d209548ac8afdc09b1679457 (patch)
treeee7a911622c333818a9ac30f2cae68aee7eb6601 /models-base/src/test/java/org/onap
parentf04d89c55ab4dfa94dfed1cc9b65471d1d3140c5 (diff)
More sonars in models
Addressed the following: - make constructors protected - check exception type - too many assertions - remove annotation lists - use "<>" - reduce cognitive complexity - extract constant - multiple method calls in one assert - don't use eq() in verify() - indentation Issue-ID: POLICY-2905 Change-Id: I25bb3951f781250e9cdfe8f5f3b80cb63e129184 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-base/src/test/java/org/onap')
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
index 91fa301f9..8fa757a00 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
@@ -110,7 +110,8 @@ public class ValidatedTest {
BeanValidationResult result2 = new BeanValidationResult("", this);
// null parameter tests
- assertThatThrownBy(() -> Validated.validateKeyNotNull(result2, null, new PfConceptKey()))
+ PfConceptKey conceptKey = new PfConceptKey();
+ assertThatThrownBy(() -> Validated.validateKeyNotNull(result2, null, conceptKey))
.isInstanceOf(NullPointerException.class);
assertThatCode(() -> Validated.validateKeyNotNull(result2, MY_FIELD, null)).doesNotThrowAnyException();
@@ -131,7 +132,8 @@ public class ValidatedTest {
assertThat(result.getResult()).contains(MY_FIELD).contains("version").contains(Validated.IS_NULL);
BeanValidationResult result2 = new BeanValidationResult("", this);
- assertThatThrownBy(() -> Validated.validateKeyVersionNotNull(result2, null, new PfConceptKey()))
+ PfConceptKey conceptKey = new PfConceptKey();
+ assertThatThrownBy(() -> Validated.validateKeyVersionNotNull(result2, null, conceptKey))
.isInstanceOf(NullPointerException.class);
assertThatCode(() -> Validated.validateKeyVersionNotNull(result2, MY_FIELD, null)).doesNotThrowAnyException();