AbstractDifferenceList implements IDifferenceList { @Override public void addChild(IDifference childDiff) { if (childDiff != null) { differences.add(childDiff); } } protected  AbstractDifferenceList(); @Override void addChild(IDifference childDiff); @Override void addChildren(List<IDifference> children); @Override Iterable<IDifference> getChildren(); @Override int childCount();  }
@Test public void testAddChild() { DifferenceClass diffClass = new DifferenceClass(); diffClass.addChild(StringDifference.construct("Foo", "Bar1", "Bar2")); Assert.assertEquals(1, diffClass.childCount()); diffClass.addChild(null); Assert.assertEquals(1, diffClass.childCount()); }