I'm using DBUnit for an integration test, and before executing the test code I'm running into this error:
badges.track_types data type (2003, '_text') not recognized and will be ignored. See FAQ for more information.
org.dbunit.dataset.NoSuchColumnException: badges.TRACK_TYPES - (Non-uppercase input column: track_types) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
the column that is ignored is a list of enums. In the dataset it's written like this :
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
// More info ...
<badges name="30'000" description="30k a day" image_name="30000.png" threshold_val="30000.00000000" has_many="true" id="45" track_types="{TRACK_GENERIC}" "/>
</dataset>
I looked in the DBUnit FAQ and saw this issue , that says that I have to override the isEnumType() method to support my enum is Postgresql, so I did this:
/**
* Override method to set custom properties/features
*/
protected void setUpDatabaseConfig(DatabaseConfig config) {
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory(){
public boolean isEnumType(String sqlTypeName) {
if(sqlTypeName.equalsIgnoreCase("track_types")){
return true;
}
return false;
}
});
config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, new DefaultMetadataHandler());
}
But I still get the same error, and I don't know why. Maybe I'm not overriding well the method? Maybe it's not even the cause of my problem? If you need any other code just ask, thanks!
badges
contain a columnTRACK_TYPES
? – Nickolas