Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:07:49+00:00 2026-06-04T11:07:49+00:00

Why doesn’t this work? I’m trying to test that an empty database is the

  • 0

Why doesn’t this work? I’m trying to test that an empty database is the same before doing nothing as after doing nothing. In other words, this is the simplest dbunit test with a database that I can think of. And it doesn’t work. The test methods are practically lifted from http://www.dbunit.org/howto.html

The error message I’m getting for comparing empty database is:

java.lang.AssertionError: expected:
org.dbunit.dataset.xml.FlatXmlDataSet<AbstractDataSet[_orderedTableNameMap=null]>
but was:
org.dbunit.database.DatabaseDataSet<AbstractDataSet[_orderedTableNameMap=null]>

The error message I’m getting for comparing empty table is:

java.lang.AssertionError: expected:
<org.dbunit.dataset.DefaultTable[_metaData=tableName=test, columns=[], keys=[], _rowList.size()=0]>
but was:
<org.dbunit.database.CachedResultSetTable[_metaData=table=test, cols=[(id, DOUBLE, noNulls), (txt, VARCHAR, nullable)], pk=[(id, DOUBLE, noNulls)], _rowList.size()=0]>

(I’ve added newlines for readability)

I can edit in the full stack trace (or anything else) if it’ll be useful. Or you can browse through the public git repo: https://bitbucket.org/djeikyb/simple_dbunit

Do I need to somehow convert my actual IDataSet to xml then back to IDataSet to properly compare? What am I doing/expecting wrong?

 34 public class TestCase
 35 {
 36 
 37   private IDatabaseTester database_tester;
 38 
 39   @Before
 40   public void setUp() throws Exception
 41   {
 42     database_tester = new JdbcDatabaseTester("com.mysql.jdbc.Driver",
 43                                             "jdbc:mysql://localhost/cal",
 44                                             "cal",
 45                                             "cal");
 46 
 47     IDataSet data_set = new FlatXmlDataSetBuilder().build(
 48         new FileInputStream("src/simple_dbunit/dataset.xml"));
 49     database_tester.setDataSet(data_set);
 50 
 51     database_tester.onSetup();
 52   }
 53 
 54   @Test
 55   public void testDbNoChanges() throws Exception
 56   {
 57     // expected
 58     IDataSet expected_data_set = new FlatXmlDataSetBuilder().build(
 59         new FileInputStream("src/simple_dbunit/dataset.xml"));
 60 
 61     // actual
 62     IDatabaseConnection connection = database_tester.getConnection();
 63     IDataSet actual_data_set = connection.createDataSet();
 64 
 65     // test
 66     assertEquals(expected_data_set, actual_data_set);
 67   }
 68 
 69   @Test
 70   public void testTableNoChanges() throws Exception
 71   {
 72     // expected
 73     IDataSet expected_data_set = new FlatXmlDataSetBuilder().build(
 74         new FileInputStream("src/simple_dbunit/dataset.xml"));
 75     ITable expected_table = expected_data_set.getTable("test");
 76 
 77     // actual
 78     IDatabaseConnection connection = database_tester.getConnection();
 79     IDataSet actual_data_set = connection.createDataSet();
 80     ITable actual_table = actual_data_set.getTable("test");
 81 
 82     // test
 83     assertEquals(expected_table, actual_table);
 84   }
 85 
 86 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:07:52+00:00Added an answer on June 4, 2026 at 11:07 am

    When you compare the IDataSet and other DBUnit components, you have to use the assert method that provided by DBUnit.

    If you use assert methods provided by JUnit, it will only be compared via equals method in Object
    That’s why you get the error complaining about different object type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This doesn't work: $to = 'myemail@gmail.com'; $from = 'test@test.com'; $subj = 'test'; $message =
Why doesn't this work? I have bypassed this before but i can't remember how
Why doesn't this work? var newbody = <body><div>hello</div></body>; $(body).remove(); $(head).after(newbody); All i get after
Doesn't seem to work for me, maybe I just doing it wrong
Why doesn't this work: <Style TargetType=s:Substance> <Setter Property=Template> <Setter.Value> <DataTemplate> <StackPanel> <TextBlock Text={TemplateBinding Name}/>
Why doesn't this code work? I'am using FF. <head> <script type=text/javascript> document.getElementById(someID).onclick = function(){
There doesn't seem to be a question for this, and it seems strange that
Why doesn't this work? type RetryBuilder(max) = member x.Return(a) = a // Enable 'return'
Why doesn't this work? Can Anyone tell me whats wrong with this onitemclicklistener? It
Why doesn't this work? HTML <div class=gallery> <div class=viewport> <div class=wrapper> <img src=img/boat1.png />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.