});
}
@Test(expected = ValidationException.class)
public void testTransferOrderWithTheSameVersion() {
final Order order = transactionService
.runOnTransaction(new IOnTransaction<Order>() {
@Override
public Order execute() {
return givenStoredOrderInScenario();
}
});
final Scenario source = transactionService
.runOnReadOnlyTransaction(new IOnTransaction<Scenario>() {
@Override
public Scenario execute() {
return PredefinedScenarios.MASTER.getScenario();
}
});
final Scenario destination = transactionService
.runOnTransaction(new IOnTransaction<Scenario>() {
@Override
public Scenario execute() {
return givenStoredScenario();
}
});
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
// reload order so it has the relationship with destination
Order orderReloaded = orderDAO.findExistingEntity(order.getId());
transferOrdersModel.setSourceScenario(source);
transferOrdersModel.setDestinationScenario(destination);
transferOrdersModel.transfer(orderReloaded);
return null;