Java Code Examples for org.dbunit.dataset.Column#getDataType()
The following examples show how to use
org.dbunit.dataset.Column#getDataType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HackedDbUnitAssert.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
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; }
Example 2
Source File: HackedDbUnitAssert.java From kylin with Apache License 2.0 | 5 votes |
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; }