From ed127f2838e19bf104399e92d181a512e6761ee3 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sun, 20 Jan 2019 20:17:45 -0500 Subject: ensure data for si matches on macro requests Fixed failing ValidationExceptionTest Moved MacroRequest.json to test specific folder Moved resource files to test specific folder Cleaned up comments from UserParamsValidationTest Refactored modelInfoValidation method Removed unused constants from ValidationException Removed unused ValidationException ADded overrideExistingMessage boolean Added test for missing modelType in userParams service object Fixed failing JUnit tests in MsoRequestTest Started fixing failing JUnit tests Began adding validation and tests for userParams modelInfo Began adding validation for instanceName Change-Id: I442f6b660af4e716d75746f8d8155aac1e183e80 Issue-ID: SO-1405 Signed-off-by: Benjamin, Max (mb388a) --- .../main/java/org/onap/so/exceptions/ValidationException.java | 10 +++++----- .../java/org/onap/so/exceptions/ValidationExceptionTest.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/src/main/java/org/onap/so/exceptions/ValidationException.java b/common/src/main/java/org/onap/so/exceptions/ValidationException.java index 713fac70f3..b91c30c598 100644 --- a/common/src/main/java/org/onap/so/exceptions/ValidationException.java +++ b/common/src/main/java/org/onap/so/exceptions/ValidationException.java @@ -32,9 +32,9 @@ public class ValidationException extends Exception { private static final long serialVersionUID = 1L; private static final String VALIDATION_FAIL = "No valid $ELEMENT is specified"; - private static final String INVALID_ELEMENT = "$ELEMENT is not valid in the $VERSION version"; + private static final String UNMATCHED_ELEMENTS = "$ELEMENT does not match $SECOND_ELEMENT"; private static final String REPLACE_ELEMENT_KEY = "\\$ELEMENT"; - private static final String REPLACE_VERSION_KEY = "\\$VERSION"; + private static final String REPLACE_SECOND_ELEMENT_KEY = "\\$SECOND_ELEMENT"; @Deprecated public ValidationException (String msg) { @@ -48,7 +48,7 @@ public class ValidationException extends Exception { public ValidationException (String msg, Exception cause) { super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg), cause); } - public ValidationException(String msg, String version) { - super(INVALID_ELEMENT.replaceAll(REPLACE_ELEMENT_KEY, msg).replaceAll(REPLACE_VERSION_KEY, version)); + public ValidationException(String firstElement, String secondElement) { + super(UNMATCHED_ELEMENTS.replaceAll(REPLACE_ELEMENT_KEY, firstElement).replaceAll(REPLACE_SECOND_ELEMENT_KEY, secondElement)); } -} +} \ No newline at end of file diff --git a/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java b/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java index b3ae7ba9f5..27fb584b3b 100644 --- a/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java +++ b/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java @@ -47,7 +47,7 @@ public class ValidationExceptionTest { @Test public void validationExceptionVersion(){ - ValidationException e = new ValidationException("testMessage", "1.0"); - Assert.assertEquals("testMessage is not valid in the 1.0 version", e.getMessage()); + ValidationException e = new ValidationException("testMessage", "secondTestMessage"); + Assert.assertEquals("testMessage does not match secondTestMessage", e.getMessage()); } } -- cgit 1.2.3-korg