public <T> void singleOccurence(Collection<T> collection, T item) { int number = countOccurences(collection, item); if (number != 1) { enumerate(collection); Assert.fail(myStringConvertion.convert(item) + "\n occured " + number + " times"); } }
public void containsAll(Collection list, Collection subCollection) { if (list.containsAll(subCollection)) return; for (Object item : subCollection) { boolean isContained = false; for (Object superSetItem : list) { if (myEquality.equals(superSetItem, item)) { isContained = true; break; } } Assert.assertTrue(myStringConvertion.convert(item), isContained); } }
private String convertToString(Object object) { if (object == null) return "null"; return myStringConvertion.convert(object); }