本文整理汇总了Java中org.dbunit.assertion.FailureHandler类的典型用法代码示例。如果您正苦于以下问题:Java FailureHandler类的具体用法?Java FailureHandler怎么用?Java FailureHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FailureHandler类属于org.dbunit.assertion包,在下文中一共展示了FailureHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareDataContains
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
private void compareDataContains(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler) throws DataSetException {
logger.debug("compareData(expectedTable={}, actualTable={}, " + "comparisonCols={}, failureHandler={}) - start", new Object[] { expectedTable, actualTable, comparisonCols, failureHandler });
if (expectedTable == null) {
throw new NullPointerException("The parameter 'expectedTable' must not be null");
}
if (actualTable == null) {
throw new NullPointerException("The parameter 'actualTable' must not be null");
}
if (comparisonCols == null) {
throw new NullPointerException("The parameter 'comparisonCols' must not be null");
}
if (failureHandler == null) {
throw new NullPointerException("The parameter 'failureHandler' must not be null");
}
for (int index = 0; index < actualTable.getRowCount(); index++) {
if (!findRowInExpectedTable(expectedTable, actualTable, comparisonCols, failureHandler, index)) {
throw new IllegalStateException();
}
}
}
示例2: getComparisonColumns
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
@Override
protected ComparisonColumn[] getComparisonColumns(String expectedTableName, Column[] expectedColumns, Column[] actualColumns, FailureHandler failureHandler) {
ComparisonColumn[] result = new ComparisonColumn[expectedColumns.length];
for (int j = 0; j < expectedColumns.length; j++) {
Column expectedColumn = expectedColumns[j];
Column actualColumn = actualColumns[j];
result[j] = new HackedComparisonColumn(expectedTableName, expectedColumn, actualColumn, failureHandler);
}
return result;
}
示例3: HackedComparisonColumn
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
public HackedComparisonColumn(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
// super class is actually useless, all public methods are overridden below
super(tableName, expectedColumn, expectedColumn, failureHandler);
this.columnName = expectedColumn.getColumnName();
this.dataType = getComparisonDataType(tableName, expectedColumn, actualColumn, failureHandler);
}
示例4: getComparisonDataType
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
private DataType getComparisonDataType(String tableName, Column expectedColumn, Column actualColumn, FailureHandler failureHandler) {
if (logger.isDebugEnabled())
logger.debug("getComparisonDataType(tableName={}, expectedColumn={}, actualColumn={}, failureHandler={}) - start", new Object[] { tableName, expectedColumn, actualColumn, failureHandler });
DataType expectedDataType = expectedColumn.getDataType();
DataType actualDataType = actualColumn.getDataType();
// The two columns have different data type
if (!expectedDataType.getClass().isInstance(actualDataType)) {
// Expected column data type is unknown, use actual column data type
if (expectedDataType instanceof UnknownDataType) {
return actualDataType;
}
// Actual column data type is unknown, use expected column data type
if (actualDataType instanceof UnknownDataType) {
return expectedDataType;
}
if (hackIgnoreIntBigIntMismatch) {
if (expectedDataType instanceof IntegerDataType && actualDataType instanceof BigIntegerDataType)
return actualDataType;
}
// Impossible to determine which data type to use
String msg = "Incompatible data types: (table=" + tableName + ", col=" + expectedColumn.getColumnName() + ")";
throw failureHandler.createFailure(msg, String.valueOf(expectedDataType), String.valueOf(actualDataType));
}
// Both columns have same data type, return any one of them
return expectedDataType;
}
示例5: findRowInExpectedTable
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
private boolean findRowInExpectedTable(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler, int index) throws DataSetException {
// iterate over all rows
for (int i = 0; i < expectedTable.getRowCount(); i++) {
// iterate over all columns of the current row
for (int j = 0; j < comparisonCols.length; j++) {
ComparisonColumn compareColumn = comparisonCols[j];
String columnName = compareColumn.getColumnName();
DataType dataType = compareColumn.getDataType();
Object expectedValue = expectedTable.getValue(i, columnName);
Object actualValue = actualTable.getValue(index, columnName);
// Compare the values
if (skipCompare(columnName, expectedValue, actualValue)) {
if (logger.isTraceEnabled()) {
logger.trace("ignoring comparison " + expectedValue + "=" + actualValue + " on column " + columnName);
}
continue;
}
if (dataType.compare(expectedValue, actualValue) != 0) {
break;
// Difference diff = new Difference(expectedTable, actualTable, i, columnName, expectedValue, actualValue);
//
// // Handle the difference (throw error immediately or something else)
// failureHandler.handle(diff);
} else {
if (j == comparisonCols.length - 1) {
return true;
} else {
continue;
}
}
}
}
return false;
}
示例6: ValidatorFailureHandler
import org.dbunit.assertion.FailureHandler; //导入依赖的package包/类
/**
* @param delegateFailureHandler
*/
public ValidatorFailureHandler(FailureHandler delegateFailureHandler) {
super();
this.delegateFailureHandler = delegateFailureHandler;
}