I have not actually run the test, I was just following a link to sample code I found in the Spock manual and found these:
To me it looks as if the H2 database table is created, but not populated with any values the test tries to validate. If so, maybe you want to fix the test.
It sounds reasonably, however, there were some "special" ways in Unitils to populate DB with data in tests (e.g. loading it from an XML file following the naming convention), so that tests could be ok.
Btw, probably no-one took a look at that module for at least 6 yeas (looking briefly at the last modification date in Git). I've been using Unitils in integration tests, but I was over a decade ago. The projects doesn't seem to be actively maintained and the the Spock module is in place mostly due to the fact it was created long time ago and the automatic tests are still passing...
Yeah the unitils and tapestry modules are kept around since they still seem to work. I've never used any of those frameworks so I just maintain the status quo. tapestry seems to have an issue with java 10+ so maybe it is time to remove it? I need to check the download stats to see if they are used at all.
I agree that it is generally a good idea to clean up the code base once in a while, even if it means throwing away something that used to be useful in the past. So if you keep it, please fix it and make sure the tests are run automatically. If you drop it, the problem is also solved. :-)
@kriegaex the tests are always executed as stated above, that is the reason why the modules are still around.
The data is populated via org/spockframework/unitils/dbunit/UserDaoSpec.xml/UserDaoSpec.xml
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
<user first_name="john" last_name="doe" age="16"/>
<user first_name="jack" last_name="smith" age="39"/>
</dataset>
This would be a functionality of the Unitils Framework
Maybe try running the code in question in the future 馃槈
This answer was actually the one which I was looking for when opening the ticket. I was wondering where the data for the test were coming from. Instead the first reply was inconclusive and the second one about removing old code. Thanks for the spot-on explanation, now I understand. I would have expected a comment in the code about the data source. Never having used DbUtils before, it was a bit counter-intuitive that the database has to be created manually in the test, but the test data declaratively. I would have expected both in the same way. The convention-over-configuration way of using an annotation in combination with a resource with a file name matching the class name was kinda unexpected. But I do agree it would have made sense to actually analyse the cloned source code. My mistake was to just browse the manual and the link to this test from my iPad (no chance to run the code).