private AnItem findItem(Collection<AnItem> collection, String name) { for (AnItem item : collection) { if (item.getName().equals(name)) { return item; } } fail("'" + name + "' not found"); return null; }
private void assertCollectionSame(List<String> strings, Collection<AnItem> collection) { assertEquals(strings.size(), collection.size()); int i = 0; for (AnItem item : collection) { String naturalOrder = strings.get(i++); String indexed = item.getName(); assertEquals(naturalOrder, indexed); } }
public int compare(AnItem o1, AnItem o2) { return o1.getName().compareTo(o2.getName()); }