How to handle Assertion error messages in DBunit

Posted on 2009-04-16
Last Modified: 2013-12-13

I am workin with DBunit and I use assertSame(input,myqueryDataSet); the input file has empty rows and myqueryDataSet which is of type queryDataSet shouldn´t return any row, but in some cases does. What I want to do is to catch the error message which explain why and where the error ocurred and save this error in a file and to do this without stopping the Test, the test end when the error ocurr.

I have tried to use DiffCollectingFailureHandler and stop the test and it still has to run because I have an array that contains 3 queries that must be executed.

I have attached the function where I make all this comparisons.
Thanks in advance.
Question by:Fionageo
    LVL 12

    Expert Comment

    by:Gibu George
    try using catch(Throwable t)
    LVL 20

    Accepted Solution

    Well I wouldn't use any assert method, if you want to continue executing.

    I would suggest doing the check without an assert and to manually fail the unit test by using the fail(...) method. This way you could catch any exceptions thrown and log them and if at least one error occured, then you manually fail the test.

    Author Closing Comment

    Thank you!

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
    The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now