@Override
public Task execute() {
return createValidTask();
}
};
final Task child1 = transactionService
.runOnTransaction(createValidTask);
final Task child2 = transactionService
.runOnTransaction(createValidTask);
IOnTransaction<Void> createDependency = new IOnTransaction<Void>() {
@Override
public Void execute() {
child1.dontPoseAsTransientObjectAnymore();
child2.dontPoseAsTransientObjectAnymore();
Dependency.create(child1, child2, Type.START_END);
taskElementDAO.save(child1);
return null;
}
};
transactionService.runOnTransaction(createDependency);
assertThat(child2.getDependenciesWithThisDestination().size(),
equalTo(1));
assertTrue(child2.getDependenciesWithThisOrigin().isEmpty());
IOnTransaction<Void> checkDependencyWasSaved = new IOnTransaction<Void>() {
@Override
public Void execute() {
TaskElement fromDB = (TaskElement) taskElementDAO