boolean testEquality(Equality equality) { Reporter reporter = Reporter.start(); equality.accept(reporter); return reporter.lineList().isEmpty(); }
protected void testEquality(Equality equality) { Reporter reporter = Reporter.start(); equality.accept(reporter); reporter.test(); }
protected void testEquality(Equality equality) { Reporter reporter = Reporter.start(); equality.accept(reporter); reporter.test(); }
@Override protected boolean matchesSafely(List<T> thatList) { if (thisList == thatList) { return true; } if (thisList.size() != thatList.size()) { return false; } List<Equality> equalityList = new ArrayList<>(); Iterator<T> thisIter = thisList.iterator(); Iterator<T> thatIter = thatList.iterator(); int index = -1; while (thisIter.hasNext()) { index++; Testable thisObj = thisIter.next(); T thatObj = thatIter.next(); if (thisObj == null && thatObj != null) { equalityList.add(Equality.elementNotExpected(index, thatObj)); break; } equalityList.add(thisObj.isEqualTo(thatObj)); } Reporter reporter = Reporter.start(); for (Equality equality : equalityList) { if (!equality.isEqual()) { equality.accept(reporter); } } return reporter.lineList().isEmpty(); }
public final SELF isEqualTo(COL thatList) { if (subject() == thatList) { return self(); } hasSize(thatList.size()); List<Equality> equalityList = new ArrayList<>(); Iterator<T> thisIter = subject().iterator(); Iterator<T> thatIter = thatList.iterator(); int index = -1; while (thisIter.hasNext()) { index++; Testable thisObj = (Testable) thisIter.next(); T thatObj = thatIter.next(); if (thisObj == null && thatObj != null) { equalityList.add(Equality.elementNotExpected(index, thatObj)); break; } equalityList.add(thisObj.isEqualTo(thatObj)); } Reporter reporter = Reporter.start(); for (Equality equality : equalityList) { if (!equality.isEqual()) { equality.accept(reporter); } } reporter.test(); return self(); }
public final SELF isEqualTo(List<T> thatList) { if (subject() == thatList) { return self(); } hasSize(thatList.size()); List<Equality> equalityList = new ArrayList<>(); Iterator<T> thisIter = subject().iterator(); Iterator<T> thatIter = thatList.iterator(); int index = -1; while (thisIter.hasNext()) { index++; Testable thisObj = (Testable) thisIter.next(); T thatObj = thatIter.next(); if (thisObj == null && thatObj != null) { equalityList.add(Equality.elementNotExpected(index, thatObj)); break; } equalityList.add(thisObj.isEqualTo(thatObj)); } Reporter reporter = Reporter.start(); for (Equality equality : equalityList) { if (!equality.isEqual()) { equality.accept(reporter); } } reporter.test(); return self(); }