public void testChangeResetToMany() { prepareToMany(1, 3); ToManyEntity testEntity = toManyEntityDao.load(1L); List<ToManyTargetEntity> resolvedToMany1 = testEntity.getToManyTargetEntityList(); testEntity.resetToManyTargetEntityList(); ToManyTargetEntity newEntity = new ToManyTargetEntity(); newEntity.setToManyId(1L); daoSession.insert(newEntity); List<ToManyTargetEntity> resolvedToMany2 = testEntity.getToManyTargetEntityList(); assertNotSame(resolvedToMany1, resolvedToMany2); assertEquals(resolvedToMany1.size() + 1, resolvedToMany2.size()); testEntity.resetToManyTargetEntityList(); toManyTargetEntityDao.deleteAll(); List<ToManyTargetEntity> resolvedToMany3 = testEntity.getToManyTargetEntityList(); assertEquals(0, resolvedToMany3.size()); }
public void testResetToMany() { ToManyTargetEntity[] targetEntities = prepareToMany(1, 3); ToManyEntity testEntity = toManyEntityDao.load(1L); List<ToManyTargetEntity> resolvedToMany1 = testEntity.getToManyTargetEntityList(); testEntity.resetToManyTargetEntityList(); List<ToManyTargetEntity> resolvedToMany2 = testEntity.getToManyTargetEntityList(); assertNotSame(resolvedToMany1, resolvedToMany2); assertSameEntities(targetEntities, resolvedToMany2); }