Add failing test case for softdeletes (#2034)

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:
Snōwball
2020-07-14 09:43:54 +12:00
committed by GitHub
parent c6487e56cf
commit a231c136a9
@@ -247,6 +247,26 @@ public class TestSoftDeleteBasic extends BaseTestCase {
DB.deleteAllPermanent(singletonList(bean));
}
@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() {