Sonar Fixes policy/models, removing model-yaml
[policy/models.git] / models-tosca / src / test / java / org / onap / policy / models / tosca / simple / concepts / JpaToscaEntrySchemaTest.java
index b306685..83d6aad 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications 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.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -48,10 +49,10 @@ public class JpaToscaEntrySchemaTest {
         assertNotNull(new JpaToscaEntrySchema(new JpaToscaEntrySchema(new PfConceptKey())));
 
         assertThatThrownBy(() -> new JpaToscaEntrySchema((PfConceptKey) null))
-                        .hasMessage("type is marked @NonNull but is null");
+                .hasMessageMatching("type is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> new JpaToscaEntrySchema((JpaToscaEntrySchema) null))
-                        .hasMessage("copyConcept is marked @NonNull but is null");
+                .hasMessageMatching("copyConcept is marked .*on.*ull but is null");
 
         PfConceptKey typeKey = new PfConceptKey("type", "0.0.1");
         JpaToscaEntrySchema tes = new JpaToscaEntrySchema(typeKey);
@@ -78,15 +79,15 @@ public class JpaToscaEntrySchemaTest {
 
         JpaToscaEntrySchema otherEs = new JpaToscaEntrySchema(typeKey);
 
-        assertFalse(tes.compareTo(otherEs) == 0);
+        assertNotEquals(0, tes.compareTo(otherEs));
         otherEs.setType(typeKey);
-        assertFalse(tes.compareTo(otherEs) == 0);
+        assertNotEquals(0, tes.compareTo(otherEs));
         otherEs.setDescription(A_DESCRIPTION);
-        assertFalse(tes.compareTo(otherEs) == 0);
+        assertNotEquals(0, tes.compareTo(otherEs));
         otherEs.setConstraints(constraints);
         assertEquals(0, tes.compareTo(otherEs));
 
-        assertThatThrownBy(() -> tes.copyTo(null)).hasMessage("target is marked @NonNull but is null");
+        assertThatThrownBy(() -> tes.copyTo(null)).hasMessageMatching("target is marked .*on.*ull but is null");
 
         assertEquals(1, tes.getKeys().size());
         assertEquals(1, new JpaToscaEntrySchema(typeKey).getKeys().size());
@@ -105,7 +106,8 @@ public class JpaToscaEntrySchemaTest {
         tes.setType(typeKey);
         assertTrue(tes.validate(new PfValidationResult()).isValid());
 
-        tes.setDescription("");;
+        tes.setDescription("");
+
         assertFalse(tes.validate(new PfValidationResult()).isValid());
         tes.setDescription(A_DESCRIPTION);
         assertTrue(tes.validate(new PfValidationResult()).isValid());
@@ -115,6 +117,6 @@ public class JpaToscaEntrySchemaTest {
         tes.getConstraints().remove(null);
         assertTrue(tes.validate(new PfValidationResult()).isValid());
 
-        assertThatThrownBy(() -> tes.validate(null)).hasMessage("resultIn is marked @NonNull but is null");
+        assertThatThrownBy(() -> tes.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
     }
 }