[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 757
  • Last Modified:

How to handle Assertion error messages in DBunit

Hello:

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.
0
Fionageo
Asked:
Fionageo
1 Solution
 
Gibu GeorgeCTOCommented:
try using catch(Throwable t)
0
 
ChristoferDutzCommented:
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.
0
 
FionageoAuthor Commented:
Thank you!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now