public void testGetSuggestedTransactions3() { User u1 = new User("1L", "A") { @Override public double getOverallDebt() { return -1; } }; User u2 = new User("2L", "B") { @Override public double getOverallDebt() { return -2; } }; boolean caught = false; try { List<Transaction> suggestedTransactions = Calculator.getSuggestedTransactions(Arrays.asList(u1, u2)); for (Transaction transaction : suggestedTransactions) { System.out.println(transaction); } } catch (RuntimeException ex) { caught = true; System.out.println(ex.getMessage()); } assertTrue(caught); }
public void testGetSuggestedTransactions1() { User u1 = new User("1L", "A") { @Override public double getOverallDebt() { return -1; } }; User u2 = new User("2L", "B") { @Override public double getOverallDebt() { return 2; } }; User u3 = new User("3L", "C") { @Override public double getOverallDebt() { return 3; } }; User u4 = new User("4L", "D") { @Override public double getOverallDebt() { return -4; } }; List<Transaction> suggestedTransactions = Calculator.getSuggestedTransactions(Arrays.asList(u1, u2, u3, u4)); for (Transaction transaction : suggestedTransactions) { System.out.println(transaction); } }