aboutsummaryrefslogtreecommitdiffstats
path: root/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
diff options
context:
space:
mode:
Diffstat (limited to 'common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java')
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java35
1 files changed, 15 insertions, 20 deletions
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
index 2d263fc7..1e5764c6 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
@@ -1,19 +1,20 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -21,25 +22,28 @@
package org.onap.policy.common.parameters.testclasses;
import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterConstants;
import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
public class TestParametersLGeneric implements ParameterGroup {
private String name;
private int lgenericIntField = 0;
+
+ @NotNull @NotBlank
private String lgenericStringField = "Legal " + this.getClass().getCanonicalName();
-
+
/**
* Default constructor.
*/
public TestParametersLGeneric() {
// Default Constructor
}
-
+
/**
* Create a test parameter group.
- *
+ *
* @param name the parameter group name
*/
public TestParametersLGeneric(final String name) {
@@ -68,7 +72,7 @@ public class TestParametersLGeneric implements ParameterGroup {
/**
* Trigger a validation message.
- *
+ *
* @param level Number of levels to recurse before stopping
*/
public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) {
@@ -111,18 +115,12 @@ public class TestParametersLGeneric implements ParameterGroup {
public GroupValidationResult validate() {
GroupValidationResult validationResult = new GroupValidationResult(this);
- if (lgenericStringField == null || lgenericStringField.trim().length() == 0) {
- validationResult.setResult("lgenericStringField", ValidationStatus.INVALID,
- "lgenericStringField must be a non-blank string");
- } else if (lgenericStringField.equals("lgenericStringField")) {
+ if ("lgenericStringField".equals(lgenericStringField)) {
validationResult.setResult("lgenericStringField", ValidationStatus.WARNING,
"using the field name for the parameter value is dangerous");
- } else if (lgenericStringField.equals("aString")) {
+ } else if ("aString".equals(lgenericStringField)) {
validationResult.setResult("lgenericStringField", ValidationStatus.OBSERVATION,
"this value for name is unhelpful");
- } else {
- validationResult.setResult("lgenericStringField", ValidationStatus.CLEAN,
- ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString());
}
if (lgenericIntField < 0) {
@@ -134,9 +132,6 @@ public class TestParametersLGeneric implements ParameterGroup {
} else if (lgenericIntField == 2) {
validationResult.setResult("lgenericIntField", ValidationStatus.OBSERVATION,
"this field has been set to 2");
- } else {
- validationResult.setResult("lgenericIntField", ValidationStatus.CLEAN,
- ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString());
}
return validationResult;