@Test public void shouldThrowExceptionIfConversionInformationIsNotConsistent() throws Exception { final Nobt nobt = aNobt() .withCurrency(new CurrencyKey("EUR")) .build(); final ExpenseDraft expenseDraft = anExpenseDraft() .withConversionInformation(new ConversionInformation(new CurrencyKey("EUR"), BigDecimal.TEN)) .build(); expectedException.expect(ConversionInformationInconsistentException.class); nobt.createExpenseFrom(expenseDraft); }
public void createExpenseFrom(ExpenseDraft expenseDraft) { final Expense expense = Expense.fromDraft(getNextIdentifier(), currencyKey, expenseDraft); expenses.add(expense); }
Nobt { public void createExpenseFrom(ExpenseDraft expenseDraft) { final Expense expense = Expense.fromDraft(getNextIdentifier(), currencyKey, expenseDraft); expenses.add(expense); } }
Nobt { public void createExpenseFrom(ExpenseDraft expenseDraft) { final Expense expense = Expense.fromDraft(getNextIdentifier(), currencyKey, expenseDraft); expenses.add(expense); } Nobt(NobtId id, CurrencyKey currencyKey, String name, Set<Person> explicitParticipants, Set<Expense> expenses, Set<DeletedExpense> deletedExpenses, Set<Payment> payments, Instant createdOn, Optimizer optimizer); }
Nobt { public void createExpenseFrom(ExpenseDraft expenseDraft) { final Expense expense = Expense.fromDraft(getNextIdentifier(), currencyKey, expenseDraft); expenses.add(expense); } Nobt(NobtId id, CurrencyKey currencyKey, String name, Set<Person> explicitParticipants, Set<Expense> expenses, Set<DeletedExpense> deletedExpenses, Set<Payment> payments, Instant createdOn, Optimizer optimizer); NobtId getId(); CurrencyKey getCurrencyKey(); String getName(); Optimizer getOptimizer(); Set<Expense> getExpenses(); Set<DeletedExpense> getDeletedExpenses(); Set<Payment> getPayments(); Set<Person> getParticipatingPersons(); List<Debt> getOptimizedDebts(); Instant getCreatedOn(); void createExpenseFrom(ExpenseDraft expenseDraft); void createPaymentFrom(PaymentDraft paymentDraft); void deleteExpense(long expenseId); }
Nobt { public void createExpenseFrom(ExpenseDraft expenseDraft) { final Expense expense = Expense.fromDraft(getNextIdentifier(), currencyKey, expenseDraft); expenses.add(expense); } Nobt(NobtId id, CurrencyKey currencyKey, String name, Set<Person> explicitParticipants, Set<Expense> expenses, Set<DeletedExpense> deletedExpenses, Set<Payment> payments, Instant createdOn, Optimizer optimizer); NobtId getId(); CurrencyKey getCurrencyKey(); String getName(); Optimizer getOptimizer(); Set<Expense> getExpenses(); Set<DeletedExpense> getDeletedExpenses(); Set<Payment> getPayments(); Set<Person> getParticipatingPersons(); List<Debt> getOptimizedDebts(); Instant getCreatedOn(); void createExpenseFrom(ExpenseDraft expenseDraft); void createPaymentFrom(PaymentDraft paymentDraft); void deleteExpense(long expenseId);  }