Search in sources :

Example 1 with DbDateFieldRule

use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.

the class Test_DbDateFieldRule method isMatchWrongActualDateFormat.

@Test(expected = RbvException.class)
public void isMatchWrongActualDateFormat() throws RbvException {
    testMetaData.putProperty("test", "test123");
    DbDateFieldRule rule = new DbDateFieldRule("test", "1191941800", MatchRelation.BEFORE_DATE, "yyyy-MM-dd HH:mm:ss", "isMatchWrongActualDateFormat", true);
    rule.isMatch(testMetaData);
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 2 with DbDateFieldRule

use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.

the class Test_DbDateFieldRule method isMatchNullExpectedValueNegative.

@Test
public void isMatchNullExpectedValueNegative() throws RbvException {
    testMetaData.putProperty("test", "1191941800");
    DbDateFieldRule rule = new DbDateFieldRule("test", null, MatchRelation.AFTER_DATE, "yyyy-MM-dd HH:mm:ss", "isMatchNullActualValue", true);
    assertFalse(rule.isMatch(testMetaData));
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 3 with DbDateFieldRule

use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.

the class Test_DbDateFieldRule method isMatchDatePositiveBefore.

@Test
public void isMatchDatePositiveBefore() throws RbvException {
    DbDateFieldRule rule = new DbDateFieldRule("test", tomorrow, MatchRelation.BEFORE_DATE, "isMatchWrongActualDateFormat", true);
    testMetaData.putProperty("test", new Timestamp(today.getTime()));
    assertTrue(rule.isMatch(testMetaData));
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) Timestamp(java.sql.Timestamp) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 4 with DbDateFieldRule

use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.

the class Test_DbDateFieldRule method setUpTest_DbDateFieldRule.

@BeforeClass
public static void setUpTest_DbDateFieldRule() {
    testMetaData = new DbMetaData();
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    today = calendar.getTime();
    timestampRule = new DbDateFieldRule("test", calendar.getTime(), MatchRelation.EXACT, "isMatchTimestamp", true);
    // go to tomorrow
    calendar.add(Calendar.DAY_OF_YEAR, 1);
    tomorrow = calendar.getTime();
}
Also used : DbMetaData(com.axway.ats.rbv.db.DbMetaData) Calendar(java.util.Calendar) DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) BeforeClass(org.junit.BeforeClass)

Example 5 with DbDateFieldRule

use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.

the class Test_DbDateFieldRule method isMatchNullActualValuePositive.

@Test
public void isMatchNullActualValuePositive() throws RbvException {
    testMetaData.putProperty("test", null);
    DbDateFieldRule rule = new DbDateFieldRule("test", null, MatchRelation.AFTER_DATE, "yyyy-MM-dd HH:mm:ss", "isMatchNullActualValue", true);
    assertTrue(rule.isMatch(testMetaData));
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

DbDateFieldRule (com.axway.ats.rbv.db.rules.DbDateFieldRule)15 BaseTest (com.axway.ats.rbv.BaseTest)11 Test (org.junit.Test)11 PublicAtsApi (com.axway.ats.common.PublicAtsApi)3 Timestamp (java.sql.Timestamp)2 DbMetaData (com.axway.ats.rbv.db.DbMetaData)1 Calendar (java.util.Calendar)1 BeforeClass (org.junit.BeforeClass)1