The message error in exception that I got is
expected:sg.team7ft.model.TransactionReportItem@2c2dc991 but was:sg.team7ft.model.TransactionReportItem@720c653f
I think that the data type is the same, and I dont know why it throws exception.
My source code is:
ArrayList<TransactionReportItem> tranItemReport = new ArrayList<TransactionReportItem>();
tranItemReport.add(new TransactionReportItem("NUS Notepad", "Great Notepad for those lectures", "Annand B", 1, "21/04/2014"));
tranItemReport.add(new TransactionReportItem("Centenary Jumper", "A really nice momento", "Danial B", 1, "21/04/2014"));
ArrayList<TransactionReportItem> tranItemReportTests = report.generateTransactionReport(startDate, endDate);
Iterator<TransactionReportItem> tranReportI = tranItemReportTests.iterator();
int i = 0;
while(tranReportI.hasNext())
{
TransactionReportItem tranReportTe = tranReportI.next();
// assertEquals(tranReportTe.getQuantity(), tranItemReport.get(i).getQuantity());
try
{
assertEquals(tranReportTe, tranItemReport.get(i));
}
catch(AssertionError e)
{
String msg = e.getMessage();
}
i++;
}