0
에게 내가 가진 예외 메시지 오류를 사용하여AssertionError를 JUnit을
[email protected]예상된다
데이터 형식이 같고 예외가 throw되는 이유를 알 수 없다고 생각합니다.
내 소스 코드는 다음과 같습니다
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++;
}
'(그리고 좋은 측정을 위해 : 당신이 이것을 구현하는 방법의 포괄적 인 개요를
는이 항목을 읽어'.hashCode()') 사용자 정의 클래스 'TransactionReportItem'. –감사합니다. 나 해보자 :) – ndnguyen