Skip to content

Commit

Permalink
Update test cases in TransactionListTest class
Browse files Browse the repository at this point in the history
  • Loading branch information
chydarren committed Oct 31, 2022
1 parent 5bb275a commit 4f3a911
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/test/java/seedu/duke/data/TransactionListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;

public class TransactionListTest {
//@@author wcwy
Expand Down Expand Up @@ -183,20 +185,22 @@ public void isMatchListFilters_invalidTransactionType_exceptionThrown() {
}

@Test
public void isTransactionInstance_validTransactionInstanceAsExpense_expectTrue() {
public void isTransactionInstance_validTransactionInstanceAsExpense_expectTrue() throws
ClassNotFoundException {
TransactionList transactions = new TransactionList();
Transaction transaction = new Expense("buy_a_bear", 80, "toys",
LocalDate.of(2022, 10, 30));

assertEquals(transaction, "seedu.duke.data.transaction.Expense");
assertTrue(transactions.isTransactionInstance(transaction, "seedu.duke.data.transaction.Expense"));
}

@Test
public void isTransactionInstance_invalidTransactionInstanceAsExpense_expectFalse() {
public void isTransactionInstance_invalidTransactionInstanceAsExpense_expectFalse() throws
ClassNotFoundException {
TransactionList transactions = new TransactionList();
Transaction transaction = new Income("buy_a_bear", 80, "toys",
LocalDate.of(2022, 10, 30));

assertEquals(transaction, "seedu.duke.data.transaction.Expense");
assertFalse(transactions.isTransactionInstance(transaction, "seedu.duke.data.transaction.Expense"));
}
}

0 comments on commit 4f3a911

Please sign in to comment.