I’m working with a project that’s built on Apache Causeway. So far we’ve been using version 2.0.0-RC2, but we need to get it updated to 2.0.0-RC4. I found that one of our unit tests fails under the new version, but I can’t quite figure out why. The root cause of the failure happens in this line of the test code:
fixtureScripts.run(new RuleDefinition_persona.PersistAll());
where RuleDefinition_persona is an enum implementing Persona<RuleDefinition, RuleDefinition_persona.Builder> containing three example RuleDefinition persistence entities. In Causeway -RC2 this call runs normally, but in -RC4 we get an error:
java.lang.AssertionError: bookmark required for non-empty scalars ObjectSpecificationDefault@2f2e4c19[class=rpe.modules.rules.dom.rule.RuleDefinition,type=ENTITY,superclass=rpe.modules.rules.dom.audited.AuditedEntity] ==> expected: but was:
I’ve looked through the documentation, release notes, and migration notes for -RC3 and -RC4 but can’t find anything regarding bookmarks or “non-empty scalars”. Furthermore I’ve looked at the Causeway source code where this assertion is tested — org.apache.causeway.core.runtimeservices.executor.MemberExecutorServiceDefault:188 — and it looks like this code hasn’t changed between RC2 and RC4. Does anyone have an idea what change would cause this assertion to fail? And does this require a change to our test code, or could it be the result of a bug in Causeway?
(The test class extends CausewayIntegrationTestAbstractWithFixtures.)
Test method:
@Test
public void happyCase() {
// given
fixtureScripts.run(new RuleDefinition_persona.PersistAll());
interactionService.nextInteraction();
// when
final List<RuleDefinition> all = wrap(menu).listAll();
// then
assertThat(all).hasSize(RuleDefinition_persona.values().length);
}
Expected that the test passes; in other words, all (the menu list) has 3 items. The actual result is a failure:
Expected size: 3 but was: 0 in:
[]
If the first line of the test method is changed to:
fixtureScripts.runPersonas(RuleDefinition_persona.values());
then the root cause of the failure is revealed:
java.lang.AssertionError: bookmark required for non-empty scalars ObjectSpecificationDefault@2f2e4c19[class=rpe.modules.rules.dom.rule.RuleDefinition,type=ENTITY,superclass=rpe.modules.rules.dom.audited.AuditedEntity] ==> expected: <true> but was: <false>