Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cleanup..
  • Loading branch information
Josh Long committed Aug 16, 2011
1 parent 64ccbc1 commit 442e9f6
Showing 1 changed file with 5 additions and 74 deletions.
Expand Up @@ -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);
Expand All @@ -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 {
}
}

0 comments on commit 442e9f6

Please sign in to comment.