public Operation createOperation(OperationType operationType, BigDecimal cost) { Operation operation = new Operation(); operation.account = persistAccount(new BigDecimal(1000L)); operation.cost = cost; operation.date = new Date(); operation.description = "Test description"; operation.operationType = operationType; Set<Label> labelSet = new HashSet<>(); labelSet.add(persistLabel()); operation.labels = labelSet; return operation; }
public List<Operation> persistOperationList() { Account account = persistAccount(new BigDecimal(1000L)); List<Operation> operations = new ArrayList<>(); for (int i = 0; i < 10; i++) { Operation operation = new Operation(); operation.operationType = OperationType.expense; operation.cost = new BigDecimal(100L); operation.date = new Date(); operation.account = account; manager.persist(operation); operations.add(operation); } manager.flush(); return operations; }