use of com.example.expenses.model.Expense in project aws-java-serverless by hermanlintvelt.
the class DataRepositoryTest method addTwoExpensesForPerson.
@Test
@DisplayName("If multiple expenses are added for a person, it should be found")
void addTwoExpensesForPerson() {
Person me = new Person("me@me.com");
Expense expense1 = new Expense(BigDecimal.valueOf(150.0), me);
dataRepository.addExpense(expense1);
Expense expense2 = new Expense(BigDecimal.valueOf(80.0), me);
dataRepository.addExpense(expense2);
List<Expense> foundExpenses = dataRepository.findExpensesPaidBy(me);
assertThat(foundExpenses).isNotNull();
assertThat(foundExpenses).asList().isNotEmpty();
assertThat(foundExpenses).asList().contains(expense1, expense2);
}
use of com.example.expenses.model.Expense in project aws-java-serverless by hermanlintvelt.
the class DataRepositoryTest method addExpenseTest.
@Test
@DisplayName("A new expense added to repository should be found")
void addExpenseTest() {
Person me = new Person("me@me.com");
Expense expense = new Expense(BigDecimal.valueOf(150.0), me);
dataRepository.addExpense(expense);
assertThat(dataRepository.allExpenses()).asList().contains(expense);
}
Aggregations