Search in sources :

Example 6 with MetaDataIncorrectException

use of com.axway.ats.rbv.model.MetaDataIncorrectException in project ats-framework by Axway.

the class Test_MetaDataIncorrectException method constructors.

@Test
public void constructors() {
    MetaDataIncorrectException exception;
    exception = new MetaDataIncorrectException("test");
    assertEquals("test", exception.getMessage());
    assertNull(exception.getCause());
    Exception helperException = new Exception();
    exception = new MetaDataIncorrectException("test", helperException);
    assertEquals("test", exception.getMessage());
    assertEquals(helperException, exception.getCause());
    exception = new MetaDataIncorrectException(helperException);
    assertEquals("java.lang.Exception", exception.getMessage());
    assertEquals(helperException, exception.getCause());
}
Also used : MetaDataIncorrectException(com.axway.ats.rbv.model.MetaDataIncorrectException) MetaDataIncorrectException(com.axway.ats.rbv.model.MetaDataIncorrectException) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 7 with MetaDataIncorrectException

use of com.axway.ats.rbv.model.MetaDataIncorrectException in project ats-framework by Axway.

the class DbBinaryFieldRule method performMatch.

@Override
protected boolean performMatch(MetaData metaData) throws RbvException {
    boolean actualResult = false;
    //this cast is safe, as isMatch has already checked the type of meta data            
    DbMetaData dbMetaData = (DbMetaData) metaData;
    byte[] actualValue;
    try {
        actualValue = (byte[]) dbMetaData.getProperty(expectedMetaDataKey.toString());
    } catch (ClassCastException cce) {
        throw new MetaDataIncorrectException("Meta data is incorrect - expected byte[]");
    }
    if (Arrays.equals((byte[]) expectedValue, actualValue)) {
        actualResult = true;
    }
    return actualResult;
}
Also used : DbMetaData(com.axway.ats.rbv.db.DbMetaData) MetaDataIncorrectException(com.axway.ats.rbv.model.MetaDataIncorrectException)

Aggregations

MetaDataIncorrectException (com.axway.ats.rbv.model.MetaDataIncorrectException)7 DbMetaData (com.axway.ats.rbv.db.DbMetaData)4 RbvException (com.axway.ats.rbv.model.RbvException)3 Date (java.util.Date)2 BaseTest (com.axway.ats.rbv.BaseTest)1 Timestamp (java.sql.Timestamp)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 SimpleTimeZone (java.util.SimpleTimeZone)1 Pattern (java.util.regex.Pattern)1 Test (org.junit.Test)1