Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-05-11 12:39:38 -0400
committerAngel Avila2016-05-11 12:39:38 -0400
commit760d2c2fecad51b30f62fe9f2f88bddc8cb9f975 (patch)
tree88b3f63923dbbc6e07d9e2989e24a551deb69a90 /plugins/org.eclipse.osee.ats.core.test
parent4b3627fc33af06223f0eb43a22bac7dff5232a4a (diff)
downloadorg.eclipse.osee-760d2c2fecad51b30f62fe9f2f88bddc8cb9f975.tar.gz
org.eclipse.osee-760d2c2fecad51b30f62fe9f2f88bddc8cb9f975.tar.xz
org.eclipse.osee-760d2c2fecad51b30f62fe9f2f88bddc8cb9f975.zip
feature[ats_UFM31]: Add workItem to XWidget validator
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.test')
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProviderTest.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboBooleanValidatorTest.java26
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboValidatorTest.java18
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXDateValidatorTest.java22
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java27
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java27
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java27
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXTextValidatorTest.java17
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java39
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java3
10 files changed, 126 insertions, 83 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProviderTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProviderTest.java
index f55a0bc497..3158e8fdca 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProviderTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProviderTest.java
@@ -22,8 +22,7 @@ public class AtsCoreXWidgetValidatorProviderTest {
@Test
public void testGetValidators() {
- Assert.assertNotNull(AtsCoreXWidgetValidatorProvider.instance.getValidators());
- Assert.assertNotNull(AtsCoreXWidgetValidatorProvider.instance.getValidators());
+ Assert.assertNotNull(new AtsCoreXWidgetValidatorProvider().getValidators());
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboBooleanValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboBooleanValidatorTest.java
index e1089ece00..b50de1421b 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboBooleanValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboBooleanValidatorTest.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.core.validator;
import static org.mockito.MockitoAnnotations.initMocks;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
@@ -24,10 +25,11 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mock;
/**
* Test unit for {@link AtsXComboBooleanValidator}
- *
+ *
* @author Donald G. Dunne
*/
public class AtsXComboBooleanValidatorTest {
@@ -35,6 +37,10 @@ public class AtsXComboBooleanValidatorTest {
private AtsXComboBooleanValidator validator;
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
+
@Before
public void setUp() {
initMocks(this);
@@ -54,36 +60,36 @@ public class AtsXComboBooleanValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XComboBooleanDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
// Check for "true" value
MockValueProvider valueProvider = new MockValueProvider(Arrays.asList("true"));
- result = validator.validateTransition(valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Valid, result.getStatus());
// Check for "false" value
valueProvider = new MockValueProvider(Arrays.asList("false"));
- result = validator.validateTransition(valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Valid, result.getStatus());
// Check for "junk" value
valueProvider = new MockValueProvider(Arrays.asList("junk"));
- result = validator.validateTransition(valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, valueProvider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboValidatorTest.java
index ee522e45f0..2524ffa7dd 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXComboValidatorTest.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.validator;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
@@ -19,6 +20,7 @@ import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
@@ -26,6 +28,10 @@ import org.junit.Assert;
public class AtsXComboValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
+
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
AtsXComboValidator validator = new AtsXComboValidator();
@@ -39,21 +45,21 @@ public class AtsXComboValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XComboDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXDateValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXDateValidatorTest.java
index e15742f1cf..5c3585a365 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXDateValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXDateValidatorTest.java
@@ -15,6 +15,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
@@ -23,6 +24,7 @@ import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
@@ -30,6 +32,10 @@ import org.junit.Assert;
public class AtsXDateValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
+
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
AtsXDateValidator validator = new AtsXDateValidator();
@@ -43,21 +49,21 @@ public class AtsXDateValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XDateDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
@@ -77,7 +83,7 @@ public class AtsXDateValidatorTest {
// Valid for valid date
WidgetResult result =
- validator.validateTransition(dateProvider, widgetDef, fromStateDef, toStateDef, atsServices);
+ validator.validateTransition(workItem, dateProvider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Valid, result.getStatus());
}
@@ -100,7 +106,7 @@ public class AtsXDateValidatorTest {
// Not valid for pastDate
WidgetResult result =
- validator.validateTransition(dateProvider, widgetDef, fromStateDef, toStateDef, atsServices);
+ validator.validateTransition(workItem, dateProvider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java
index c17ea67d9a..f521efb15e 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
@@ -23,12 +24,16 @@ import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
*/
public class AtsXFloatValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
@@ -43,21 +48,21 @@ public class AtsXFloatValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XFloatDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
@@ -78,26 +83,26 @@ public class AtsXFloatValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid is nothing entered
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
//Invalid_Range if > than what should be
constraint.set(0.0, 2.0);
MockValueProvider provider = new MockValueProvider(Arrays.asList("0.0", "2.0", "3.0"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Invalid_Range if less than supposed to
constraint.set(1.0, 2.0);
provider = new MockValueProvider(Arrays.asList("0.0"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Valid if == what supposed to be
constraint.set(2.0, 2.0);
provider = new MockValueProvider(Arrays.asList("2.0", "2.0"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
// test nulls
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java
index 71bbddb92a..7b1315ba49 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
@@ -23,12 +24,16 @@ import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
*/
public class AtsXIntegerValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
@@ -43,21 +48,21 @@ public class AtsXIntegerValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XIntegerDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
@@ -77,26 +82,26 @@ public class AtsXIntegerValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid is nothing entered
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
//Invalid_Range if > than what should be
constraint.set(0, 2);
MockValueProvider provider = new MockValueProvider(Arrays.asList("0", "2", "3"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Invalid_Range if less than supposed to
constraint.set(1, 2);
provider = new MockValueProvider(Arrays.asList("0"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Valid if == what supposed to be
constraint.set(2, 2);
provider = new MockValueProvider(Arrays.asList("2", "2"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
// test nulls
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
index 312a1ec353..49ceec558d 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
@@ -23,12 +24,16 @@ import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
*/
public class AtsXListValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
@@ -43,21 +48,21 @@ public class AtsXListValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XListDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
@@ -78,26 +83,26 @@ public class AtsXListValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid is nothing entered
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
//Invalid_Range if select more than supposed to
constraint.set(0, 2);
MockValueProvider provider = new MockValueProvider(Arrays.asList("this", "is", "selected"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Invalid_Range if less than supposed to
constraint.set(2, 2);
provider = new MockValueProvider(Arrays.asList("this"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Valid if less what supposed to
constraint.set(2, 2);
provider = new MockValueProvider(Arrays.asList("this", "is"));
- result = validator.validateTransition(provider, widgetDef, fromStateDef, toStateDef, atsServices);
+ result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
// test nulls
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXTextValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXTextValidatorTest.java
index e146e5f3db..56159af3e9 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXTextValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXTextValidatorTest.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.validator;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
@@ -19,12 +20,16 @@ import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
+import org.mockito.Mock;
/**
* @author Donald G. Dunne
*/
public class AtsXTextValidatorTest {
private IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
@@ -39,21 +44,21 @@ public class AtsXTextValidatorTest {
toStateDef.setStateType(StateType.Working);
// Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
+ WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.setXWidgetName("XTextDam");
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
// Not valid if widgetDef required and no values set
- result = validator.validateTransition(ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef, toStateDef,
- atsServices);
+ result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
+ toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
index f2ca69db67..92b9499ac9 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
@@ -14,6 +14,7 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IValueProvider;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
@@ -25,6 +26,7 @@ import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.junit.Assert;
import org.junit.Test;
+import org.mockito.Mock;
/**
* Test case for {@link AtsXWidgetValidateManager}
@@ -33,13 +35,16 @@ import org.junit.Test;
*/
public class AtsXWidgetValidateManagerTest {
IAtsServices atsServices;
+ // @formatter:off
+ @Mock IAtsWorkItem workItem;
+ // @formatter:on
@Test
public void testValidateTransition_emptyValidators() {
List<WidgetResult> results = new LinkedList<>();
- AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
- atsServices);
+ AtsXWidgetValidateManager.validateTransition(workItem, results, ValidatorTestUtil.emptyValueProvider, null, null,
+ null, atsServices);
Assert.assertTrue(results.isEmpty());
}
@@ -49,11 +54,11 @@ public class AtsXWidgetValidateManagerTest {
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
TestValidatorProvider provider = new TestValidatorProvider(new AtsValidator());
- manager.add(provider);
- AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
- atsServices);
+ manager.addWidgetValidatorProvider(provider);
+ AtsXWidgetValidateManager.validateTransition(workItem, results, ValidatorTestUtil.emptyValueProvider, null, null,
+ null, atsServices);
Assert.assertTrue(results.isEmpty());
- manager.remove(provider);
+ manager.removeWidgetValidatorProvider(provider);
}
@Test
@@ -62,11 +67,11 @@ public class AtsXWidgetValidateManagerTest {
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
TestValidatorProvider provider = new TestValidatorProvider(new AtsErrorValidator());
- manager.add(provider);
- AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
- atsServices);
+ manager.addWidgetValidatorProvider(provider);
+ AtsXWidgetValidateManager.validateTransition(workItem, results, ValidatorTestUtil.emptyValueProvider, null, null,
+ null, atsServices);
Assert.assertFalse(results.isEmpty());
- manager.remove(provider);
+ manager.removeWidgetValidatorProvider(provider);
}
@Test
@@ -75,23 +80,23 @@ public class AtsXWidgetValidateManagerTest {
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
TestValidatorProvider provider = new TestValidatorProvider(new AtsExceptoinValidator());
- manager.add(provider);
+ manager.addWidgetValidatorProvider(provider);
MockWidgetDefinition widgetDef = new MockWidgetDefinition("Widget Name");
- AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, widgetDef, null, null,
- atsServices);
+ AtsXWidgetValidateManager.validateTransition(workItem, results, ValidatorTestUtil.emptyValueProvider, widgetDef,
+ null, null, atsServices);
Assert.assertFalse(results.isEmpty());
Assert.assertEquals(results.iterator().next().getStatus(), WidgetStatus.Exception);
Assert.assertEquals(
"Exception - Widget Name - Exception retriving validation for widget [AtsExceptoinValidator] Exception [problem]",
results.iterator().next().toString());
Assert.assertTrue(results.iterator().next().getException() instanceof OseeStateException);
- manager.remove(provider);
+ manager.removeWidgetValidatorProvider(provider);
}
private class AtsValidator implements IAtsXWidgetValidator {
@Override
- public WidgetResult validateTransition(IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
+ public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
return new WidgetResult(WidgetStatus.Valid, null, "Here it is");
}
@@ -99,7 +104,7 @@ public class AtsXWidgetValidateManagerTest {
private class AtsErrorValidator implements IAtsXWidgetValidator {
@Override
- public WidgetResult validateTransition(IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
+ public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
return new WidgetResult(WidgetStatus.Invalid_Incompleted, null, "Here it is");
}
@@ -107,7 +112,7 @@ public class AtsXWidgetValidateManagerTest {
private class AtsExceptoinValidator implements IAtsXWidgetValidator {
@Override
- public WidgetResult validateTransition(IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) throws OseeStateException {
+ public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) throws OseeStateException {
throw new OseeStateException("problem");
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
index 9a2c5667e2..07fa900e87 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import java.util.Date;
import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IValueProvider;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
@@ -43,7 +44,7 @@ public class AtsXWidgetValidatorTest {
private static AtsXWidgetValidator validator = new AtsXWidgetValidator() {
@Override
- public WidgetResult validateTransition(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
+ public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider valueProvider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) {
return null;
}
};

Back to the top