@Override
public String execute() {
return givenLabelStored().getCode();
}
});
LabelReferenceDTO labelReferenceDTO = new LabelReferenceDTO(labelCode);
orderDTO.labels.add(labelReferenceDTO);
OrderListDTO orderListDTO = createOrderListDTO(orderDTO);
List<InstanceConstraintViolationsDTO> instanceConstraintViolationsList = orderElementService
.addOrders(orderListDTO).instanceConstraintViolationsList;
assertThat(instanceConstraintViolationsList.size(), equalTo(0));
final OrderElement orderElement = transactionService
.runOnTransaction(new IOnTransaction<OrderElement>() {
@Override
public OrderElement execute() {
try {
OrderElement element = orderElementDAO
.findUniqueByCode(code);
element.getLabels().size();
return element;
} catch (InstanceNotFoundException e) {
throw new RuntimeException(e);
}
}
});
assertNotNull(orderElement);
assertThat(orderElement.getLabels().size(), equalTo(1));
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
orderElementDAO.flush();
sessionFactory.getCurrentSession().evict(orderElement);
return null;
}
});
LabelReferenceDTO labelReferenceDTO2 = new LabelReferenceDTO(labelCode);
orderDTO.labels.add(labelReferenceDTO2);
orderListDTO = createOrderListDTO(orderDTO);
instanceConstraintViolationsList = orderElementService
.addOrders(orderListDTO).instanceConstraintViolationsList;