From a81c40773b3c819f079bd741d472ee954572cb34 Mon Sep 17 00:00:00 2001 From: vasraz Date: Fri, 23 Dec 2022 16:56:21 +0000 Subject: Fix 'NPE thrown in editing constraints'-bug Signed-off-by: Vasyl Razinkov Change-Id: Ibbd8a3baa2a2bfdbd6e2c235db5a1d59875f3e6e Issue-ID: SDC-4312 --- .../tosca/constraints/InRangeConstraintTest.java | 54 ++++------------------ 1 file changed, 9 insertions(+), 45 deletions(-) (limited to 'catalog-model/src/test/java') diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraintTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraintTest.java index 8eff6f7cdc..1491e0547d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraintTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraintTest.java @@ -30,7 +30,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintValueDoNotMatchPropertyTypeException; -public class InRangeConstraintTest { +class InRangeConstraintTest { private InRangeConstraint createStringTestSubject() { List validValues = new ArrayList<>(); @@ -47,7 +47,7 @@ public class InRangeConstraintTest { } @Test - public void testGetInRange() { + void testGetInRange() { InRangeConstraint testSubject = createStringTestSubject(); List result = testSubject.getInRange(); @@ -57,7 +57,7 @@ public class InRangeConstraintTest { } @Test - public void testSetInRange() { + void testSetInRange() { InRangeConstraint testSubject = createStringTestSubject(); List validValues = new ArrayList<>(); validValues.add("test21"); @@ -71,43 +71,7 @@ public class InRangeConstraintTest { } @Test - public void testGetRangeMinValue() throws Exception { - InRangeConstraint testSubject = createIntegerTestSubject(); - Object result = testSubject.getRangeMinValue(); - - assertEquals(1, result); - } - - @Test - public void testSetRangeMinValue() throws Exception { - InRangeConstraint testSubject = createIntegerTestSubject(); - testSubject.setRangeMinValue(21); - - Object result = testSubject.getRangeMinValue(); - - assertEquals(21, result); - } - - @Test - public void testGetRangeMaxValue() throws Exception { - InRangeConstraint testSubject = createIntegerTestSubject(); - Object result = testSubject.getRangeMaxValue(); - - assertEquals(10, result); - } - - @Test - public void testSetRangeMaxValue() throws Exception { - InRangeConstraint testSubject = createIntegerTestSubject(); - testSubject.setRangeMaxValue(30); - - Object result = testSubject.getRangeMaxValue(); - - assertEquals(30, result); - } - - @Test - public void testValidateValueTypeStringTrue() throws ConstraintValueDoNotMatchPropertyTypeException { + void testValidateValueTypeStringTrue() throws ConstraintValueDoNotMatchPropertyTypeException { InRangeConstraint testSubject = createStringTestSubject(); Boolean validTypes = testSubject.validateValueType("string"); @@ -115,7 +79,7 @@ public class InRangeConstraintTest { } @Test - public void testValidateValueTypeStringFalse() throws ConstraintValueDoNotMatchPropertyTypeException { + void testValidateValueTypeStringFalse() throws ConstraintValueDoNotMatchPropertyTypeException { InRangeConstraint testSubject = createStringTestSubject(); Boolean validTypes = testSubject.validateValueType("integer"); @@ -123,7 +87,7 @@ public class InRangeConstraintTest { } @Test - public void testValidateValueTypeIntegerTrue() throws ConstraintValueDoNotMatchPropertyTypeException { + void testValidateValueTypeIntegerTrue() throws ConstraintValueDoNotMatchPropertyTypeException { InRangeConstraint testSubject = createIntegerTestSubject(); Boolean validTypes = testSubject.validateValueType("integer"); @@ -131,7 +95,7 @@ public class InRangeConstraintTest { } @Test - public void testValidateValueTypeIntegerFalse() throws ConstraintValueDoNotMatchPropertyTypeException { + void testValidateValueTypeIntegerFalse() throws ConstraintValueDoNotMatchPropertyTypeException { InRangeConstraint testSubject = createIntegerTestSubject(); Boolean validTypes = testSubject.validateValueType("string"); @@ -139,7 +103,7 @@ public class InRangeConstraintTest { } @Test - public void testChangeStringConstraintValueTypeToIntegerThrow() { + void testChangeStringConstraintValueTypeToIntegerThrow() { String propertyType = "integer"; InRangeConstraint testSubject = createStringTestSubject(); Exception exception = assertThrows(ConstraintValueDoNotMatchPropertyTypeException.class, () -> { @@ -153,7 +117,7 @@ public class InRangeConstraintTest { } @Test - public void testChangeIntegerConstraintValueTypeToString() throws ConstraintValueDoNotMatchPropertyTypeException { + void testChangeIntegerConstraintValueTypeToString() throws ConstraintValueDoNotMatchPropertyTypeException { InRangeConstraint testSubject = createIntegerTestSubject(); testSubject.changeConstraintValueTypeTo("string"); List result = testSubject.getInRange(); -- cgit 1.2.3-korg