com.github.springtestdbunit.assertion.NonStrictUnorderedDatabaseAssertion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-test-dbunit Show documentation
Show all versions of spring-test-dbunit Show documentation
Integration between the Spring testing framework and DBUnit
/*
* Copyright 2002-2013 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.springtestdbunit.assertion;
import org.dbunit.DatabaseUnitException;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.SortedTable;
/**
* Implements non-strict unordered database assertion strategy : compares data sets ignoring all tables and columns
* which are not specified in expected data set but possibly exist in actual data set and sorting rows in expected and
* actual data sets with column order in expected data set to ignore row orders in expected and actual data sets.
*
* @author Mario Zagar
* @author Sunitha Rajarathnam
* @author Mehmet Aslan
*/
class NonStrictUnorderedDatabaseAssertion extends NonStrictDatabaseAssertion {
@Override
public void assertEquals(ITable expectedSortedTable, ITable actualSortedTable) throws DatabaseUnitException {
Column[] expectedColumns = expectedSortedTable.getTableMetaData().getColumns();
expectedSortedTable = new SortedTable(expectedSortedTable, expectedColumns);
actualSortedTable = new SortedTable(actualSortedTable, expectedColumns);
super.assertEquals(expectedSortedTable, actualSortedTable);
}
}