Search in sources :

Example 1 with SqlDateWrapper

use of org.drools.workbench.models.testscenarios.backend.SqlDateWrapper in project drools by kiegroup.

the class FactFieldValueVerifierTest method testSQLDate.

public void testSQLDate() throws Exception {
    SqlDateWrapper sqlDateWrapper = new SqlDateWrapper();
    sqlDateWrapper.setSqlDate(new Date(2012 - 1900, 11, 12));
    HashMap<String, Object> populatedData = new HashMap<String, Object>();
    populatedData.put("sqlDateWrapper", sqlDateWrapper);
    TypeResolver typeResolver = mock(TypeResolver.class);
    FactFieldValueVerifier verifier = new FactFieldValueVerifier(populatedData, "sqlDateWrapper", sqlDateWrapper, typeResolver);
    List<VerifyField> fieldValues = new ArrayList<VerifyField>();
    VerifyField verifyField = new VerifyField("sqlDate", "12-DEC-2012", "==");
    fieldValues.add(verifyField);
    verifier.checkFields(fieldValues);
    assertTrue(verifyField.getSuccessResult());
}
Also used : HashMap(java.util.HashMap) VerifyField(org.drools.workbench.models.testscenarios.shared.VerifyField) TypeResolver(org.kie.soup.project.datamodel.commons.types.TypeResolver) ArrayList(java.util.ArrayList) SqlDateWrapper(org.drools.workbench.models.testscenarios.backend.SqlDateWrapper) Date(java.sql.Date)

Example 2 with SqlDateWrapper

use of org.drools.workbench.models.testscenarios.backend.SqlDateWrapper in project drools by kiegroup.

the class FactPopulatorTest method testSQLDateField.

@Test
public void testSQLDateField() throws Exception {
    factPopulator.add(new NewFactPopulator(populatedData, getTypeResolver(), new FactData("SqlDateWrapper", "c1", Arrays.<Field>asList(new FieldData("sqlDate", "10-Jul-2008")), false)));
    factPopulator.populate();
    assertTrue(populatedData.containsKey("c1"));
    SqlDateWrapper sqlDateWrapper = (SqlDateWrapper) populatedData.get("c1");
    assertNotNull(sqlDateWrapper.getSqlDate());
}
Also used : CollectionFieldData(org.drools.workbench.models.testscenarios.shared.CollectionFieldData) FieldData(org.drools.workbench.models.testscenarios.shared.FieldData) FactData(org.drools.workbench.models.testscenarios.shared.FactData) SqlDateWrapper(org.drools.workbench.models.testscenarios.backend.SqlDateWrapper) Test(org.junit.Test)

Aggregations

SqlDateWrapper (org.drools.workbench.models.testscenarios.backend.SqlDateWrapper)2 Date (java.sql.Date)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CollectionFieldData (org.drools.workbench.models.testscenarios.shared.CollectionFieldData)1 FactData (org.drools.workbench.models.testscenarios.shared.FactData)1 FieldData (org.drools.workbench.models.testscenarios.shared.FieldData)1 VerifyField (org.drools.workbench.models.testscenarios.shared.VerifyField)1 Test (org.junit.Test)1 TypeResolver (org.kie.soup.project.datamodel.commons.types.TypeResolver)1