use of com.blazebit.persistence.view.testsuite.update.entity.mutableonly.model.UpdatableDocumentEntityWithMapsView in project blaze-persistence by Blazebit.
the class EntityViewUpdateMutableOnlyEntityMapsTest method testUpdateModifyEntityInCollection.
@Test
public void testUpdateModifyEntityInCollection() {
// Given & When
final UpdatableDocumentEntityWithMapsView docView = modifyEntityInCollection();
// Then
// Assert that the document and the people are loaded i.e. a full fetch
// Since only an existing person was update, only a single update is generated
AssertStatementBuilder builder = assertUnorderedQuerySequence();
if (isQueryStrategy()) {
builder.select(Person.class);
} else {
fullFetch(builder);
}
if (version || isQueryStrategy() && isFullMode()) {
versionUpdate(builder);
}
builder.update(Person.class).validate();
// Unfortunately, even after an update, we have to reload the entity to merge again
AssertStatementBuilder afterBuilder = assertQueriesAfterUpdate(docView);
if (isQueryStrategy()) {
afterBuilder.select(Person.class);
} else {
fullFetch(afterBuilder);
}
if (version || isQueryStrategy() && isFullMode()) {
versionUpdate(afterBuilder);
}
afterBuilder.validate();
assertEquals(doc1.getContacts(), docView.getContacts());
assertEquals("newPerson", p1.getName());
}
Aggregations