diff --git a/starting/expense_reports/services-engine/src/test/java/org/springsource/examples/expenses/TestExpenseReport.java b/starting/expense_reports/services-engine/src/test/java/org/springsource/examples/expenses/TestExpenseReport.java index 3b3d752..4ac4d2c 100644 --- a/starting/expense_reports/services-engine/src/test/java/org/springsource/examples/expenses/TestExpenseReport.java +++ b/starting/expense_reports/services-engine/src/test/java/org/springsource/examples/expenses/TestExpenseReport.java @@ -24,10 +24,10 @@ public class TestExpenseReport { private ManagedFile file = new ManagedFile(new File(new File(SystemUtils.getUserHome(), "Desktop"), "coffee.jpg")); @Test - public void testSubmittingExpenseReport() throws Throwable { + public void testValidation() throws Throwable { ExpenseReport expenseReport = new ExpenseReport(); - Assert.assertFalse( expenseReport.validate()); + Assert.assertFalse(expenseReport.validate()); expenseReport.addExpense(inexpensiveCharge); Assert.assertTrue(expenseReport.validate()); Expense expensiveExpense = expenseReport.addExpense(expensiveCharge); @@ -36,76 +36,7 @@ public void testSubmittingExpenseReport() throws Throwable { Assert.assertTrue(expenseReport.validate()); } - /* private File desktop = new File(SystemUtils.getUserHome(), "Desktop"); - - @Test - public void testSubmittingExpenseReport() throws Throwable { - - String[] users = "jlong,kdonald".split(","); - - long counter = 0; - - for (String userId : users) { - ExpenseReport expenseReport = new ExpenseReport(userId); - Assert.assertTrue("new reports are always 'OPEN'", expenseReport.getState().equals(ExpenseReport.ExpenseReportState.OPEN)); - for (int i = 0; i < 5; i++) { - expenseReport.addLineItemFromCharge(++counter, (Math.random() * 50)); - } - expenseReport.addLineItemFromCharge(++counter, 26); // to make sure one fails - - Assert.assertTrue("the expense report should be invalid", !expenseReport.isValid()); - - int i = 0; - for (Expense lineItem : expenseReport.getExpenses()) { - i += 1; - *//*if (lineItem.isRequiresReceipt()) { - ManagedFile receipt = new ManagedFile(new File(desktop, i + "_receipt.jpg")); - // Receipt attachment = lineItem.addAttachment("this is the receipt for the hotel (#" + i + ") I stayed in ", receipt); - Assert.assertNotNull("the attachment can't be null", attachment); - }*//* - } - Assert.assertTrue("after corrections, the report should be valid now", expenseReport.isValid()); - expenseReport.setPendingReview(); - Assert.assertTrue(expenseReport.isValid()); - } - } - - - @Test - public void testCreatingAFaultyExpenseReport() throws Throwable { - - String[] users = "jlong,kdonald".split(","); - - long counter = 0; - - for (String userId : users) { - ExpenseReport expenseReport = new ExpenseReport(userId); - Assert.assertTrue("new reports are always 'OPEN'", expenseReport.getState().equals(ExpenseReport.ExpenseReportState.OPEN)); - for (int i = 0; i < 5; i++) { - expenseReport.addLineItemFromCharge(++counter, (Math.random() * 50)); - } - expenseReport.addLineItemFromCharge(++counter, 26); // to make sure one fails - - Assert.assertTrue("the expense report should be invalid", !expenseReport.isValid()); - try { - expenseReport.setPendingReview(); - Assert.fail("we should never be able to file an invalid report"); - } catch (Throwable th) { - // noop - } - - Assert.assertTrue("the expense report's no longer valid", !expenseReport.isValid()); - - *//*Expense li = (Expense) CollectionUtils.find(expenseReport.getExpenses(), new Predicate() { - @Override - public boolean evaluate(Object object) { - Expense li = (Expense) object; - return li.isRequiresReceipt(); - } - }); - - Assert.assertTrue(li != null && li.isRequiresReceipt());*//* - - } - }*/ + @Test + public void testSubmission() throws Throwable { + } }