I am experiencing the same problem with AdministrationServiceTest. The tests which fail are:
getAllGlobalProperties_shouldReturnAllGlobalPropertiesInTheDatabase purgeGlobalProperty_shouldDeleteGlobalPropertyFromDatabase
The both fail with: AssertionError: expected:<21> but was:<25>
This happens every time I run the full set of tests using mvn clean test. However, if I run the full suite of tests from within IntelliJ, the problem does not occur.
I placed some print statements in the tests to list the names and values of all the global properties, and re-ran the tests from IntelliJ and the command line. There are four properties which appear in the latter but not the former:
test1.mandatory=false
test1.started=true
test2.mandatory=false
test2.started=true
I then did a grep on the codebase and found one file, ModuleFactoryTest.java which looked very guilty. Running the test suite from the command line, skipping this test, results in no tests failing: mvn test -Dtest=!ModuleFactoryTest*
Placing print statements in the @Before in ModuleFactoryTest shows that initially these properties are not present. After running tests within this class, these properties do appear - and donât seem to remove themselves. Maybe this is correct behaviour, Iâm not sure what the intention is.
I believe the order of execution of JUnit tests is unpredictable. So it seems likely that if ModuleFactoryTest creates extra global properties for new modules before AdministrationServiceTest runs, these will cause the latter to fail. (Also, the ModuleFactory creates new modules via the Daemon and DaemonThread classes, so separate threads are used and order of execution is unpredictable - this may be relevant).
One approach to fixing this might be to force ModuleFactoryTest to clean up after itself (assuming that is desirable). Another might be to make AdministrationServiceTest count how many global properties exist before it creates/removes any, and then count them again immediately afterwards, rather than expecting a fixed number (21) to be present initially. One could do both fixes.