Add failing test case for softdeletes

Example:
One X can have many Ys. Ys can be soft deleted.

Y1 -> X1 -> Y1

Y1 is soft deleted

When Y1 is loaded, lazy-loading X1 and then lazy-loading the list of Ys associated with X1,
the list should contain Y1. This test asserts that is true.
This commit is contained in:
Tobias
2020-07-09 20:56:33 +02:00
parent 361de9ea99
commit 18ae0a7833
@@ -136,6 +136,26 @@ public class TestSoftDeleteBasic extends BaseTestCase {
query.delete();
}
@Test
public void testFindSoftDeletedList() {
EBasicSoftDelete bean = new EBasicSoftDelete();
bean.setName("softDelFetch");
DB.save(bean);
EBasicSDChild bean2 = new EBasicSDChild(bean, "softDelFetchus", 1L);
DB.save(bean2);
DB.delete(bean2);
EBasicSDChild child = DB
.find(EBasicSDChild.class)
.setIncludeSoftDeletes()
.where()
.idEq(bean.getId())
.findOne();
assertThat(child).isNotNull();
assertThat(child.getOwner().getChildren().size()).isEqualTo(1);
}
@Test
public void testDeleteById_and_findCount() {