public static void assertEquals(ECReport expected, ECReport actual) { if (expected == null || actual == null) { if (expected == null && actual == null) { return; } else { throw new AssertionFailedError(); } } assertEquals(expected.getReportName(), actual.getReportName()); assertEquals(expected.getAny(), actual.getAny()); assertEquals(expected.getExtension(), actual.getExtension()); List<ECReportGroup> expectedGroups = expected.getGroup(); List<ECReportGroup> actualGroups = actual.getGroup(); assertEquals(expectedGroups.size(), actualGroups.size()); for (ECReportGroup expectedGroup : expectedGroups) { boolean contains = false; for (ECReportGroup actualGroup : actualGroups) { try { assertEquals(expectedGroup, actualGroup); } catch (Error e) { continue; } contains = true; } if (!contains) { throw new AssertionFailedError(); } } }
public static ECReport createECReport() { // create report ECReport report = new ECReport(); // set name and group report.setReportName(REPORT_NAME); report.getGroup().add(createECReportGroup()); return report; }