@Test
public void shouldUpdatePersistentClasses() {

    // when
    task.run();
    // then
    assertEquals(2, repository.list(PersistentPreparation.class).count());
    List<PersistentPreparation> persistentPreparationList = repository
            .list(PersistentPreparation.class)
            .sorted(Comparator.comparingInt(p1 -> p1.getSteps().size()))
            .collect(Collectors.toList());
    persistentPreparationList.forEach(p -> {
        assertNotNull(p.getSteps());
        assertNotNull(p.getRowMetadata());
        assertFalse(p.getSteps().isEmpty());
        assertEquals(Type.INTEGER.getName(), p.getRowMetadata().getColumns().get(0).getType());
    });
    assertEquals(6, persistentPreparationList.get(0).getRowMetadata().getColumns().size());
    assertEquals(5, persistentPreparationList.get(1).getRowMetadata().getColumns().size());
    repository.list(Preparation.class).forEach(p -> {
        // make sure preparation steps are read
        assertNotNull(p.getSteps());
        assertFalse(p.getSteps().isEmpty());
    });
    // root step is filtered
    assertEquals(10, repository.list(PersistentStep.class).filter(s -> s.getParentId() != null).count());
    repository.list(Step.class).forEach(s -> assertNotNull(s.getId()));
}