summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-12-15 11:59:21 +0100
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-12-15 11:59:28 +0100
commit8727de26783eb496703bb82280ddad0e328964cb (patch)
tree1b8313341dee37dd46ae2b75a83793b53be86c66 /csarvalidation/src
parenta89c8ab70e6c8fcbb9b147d626d69dee6ecf7c5e (diff)
Fix validation of error messages.
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: Id0e83041823558a56932286895363503f77f6de4 Issue-ID: VNFSDK-715
Diffstat (limited to 'csarvalidation/src')
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java
index d011a6e..f48e3cf 100644
--- a/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java
+++ b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java
@@ -17,8 +17,10 @@
package org.onap.functional.cli;
+import java.util.Arrays;
import java.util.List;
import java.util.Objects;
+import java.util.stream.Collectors;
public class OnapCliValidationResponseWrapper {
@@ -72,13 +74,33 @@ public class OnapCliValidationResponseWrapper {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- return o.hashCode() == this.hashCode();
+ List<String> m1 = prepareMessages((ValidationErrorWrapper) o);
+ List<String> m2 = prepareMessages(this);
+ return o.hashCode() == this.hashCode() && m1.containsAll(m2);
+ }
+
+ private List<String> prepareMessages(ValidationErrorWrapper other) {
+ return Arrays.stream(other.message.split(" "))
+ .map(it -> it.replaceAll("[\\[\\](){},]", ""))
+ .collect(Collectors.toList());
}
@Override
public int hashCode() {
- return Objects.hash(vnfreqNo, code, message, file, lineNumber);
+ return Objects.hash(vnfreqNo, code, file, lineNumber);
+ }
+
+ @Override
+ public String toString() {
+ return "ValidationErrorWrapper{" +
+ "vnfreqNo='" + vnfreqNo + '\'' +
+ ", code='" + code + '\'' +
+ ", message='" + message + '\'' +
+ ", file='" + file + '\'' +
+ ", lineNumber='" + lineNumber + '\'' +
+ '}';
}
+
}
}
}