org.dbunit.assertion
Class DiffCollectingFailureHandler

java.lang.Object
  extended by org.dbunit.assertion.DefaultFailureHandler
      extended by org.dbunit.assertion.DiffCollectingFailureHandler
All Implemented Interfaces:
DifferenceListener, FailureFactory, FailureHandler

public class DiffCollectingFailureHandler
extends DefaultFailureHandler

A FailureHandler that collects the Differences that were found without throwing an exception.

You can use it as follows:

 IDataSet dataSet = getDataSet();
 DiffCollectingFailureHandler myHandler = new DiffCollectingFailureHandler();
 //invoke the assertion with the custom handler
 assertion.assertEquals(dataSet.getTable("TEST_TABLE"),
                        dataSet.getTable("TEST_TABLE_WITH_WRONG_VALUE"),
                        myHandler);
 // Evaluate the results
 List diffList = myHandler.getDiffList();
 Difference diff = (Difference)diffList.get(0);
 ...
 

Since:
2.4.0
Version:
$Revision: 872 $ $Date: 2008-11-08 09:45:52 -0600 (Sat, 08 Nov 2008) $
Author:
gommma (gommma AT users.sourceforge.net), Last changed by: $Author: gommma $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dbunit.assertion.DefaultFailureHandler
DefaultFailureHandler.DefaultFailureFactory
 
Constructor Summary
DiffCollectingFailureHandler()
           
 
Method Summary
 List getDiffList()
           
 void handle(Difference diff)
          Is invoked by the DbUnitAssert when a data cell difference has been found.
 String toString()
           
 
Methods inherited from class org.dbunit.assertion.DefaultFailureHandler
buildMessage, createFailure, createFailure, getAdditionalInfo, setFailureFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiffCollectingFailureHandler

public DiffCollectingFailureHandler()
Method Detail

handle

public void handle(Difference diff)
Description copied from interface: DifferenceListener
Is invoked by the DbUnitAssert when a data cell difference has been found.

Specified by:
handle in interface DifferenceListener
Overrides:
handle in class DefaultFailureHandler
Parameters:
diff - The difference that has been found

getDiffList

public List getDiffList()
Returns:
The list of collected Differences

toString

public String toString()
Overrides:
toString in class DefaultFailureHandler


Copyright © 2002-2012. All Rights Reserved.