SelectionInfo { void add(String id, T item) { if (!multiSelect) { reset(); } selection.put(id, item); } SelectionInfo(Function<T, String> identifier, boolean multiSelect);   SelectionInfo(Function<T, String> identifier, boolean multiSelect, Map<String, T> selection); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); List<T> getSelection(); T getSingleSelection(); boolean hasSelection(); boolean isSelected(T item); int getSelectionCount(); boolean isMultiSelect();  }
@Test public void addSingle() throws Exception { single.add("0", 0); assertSelection(single, 0); single.add("1", 1); assertSelection(single, 1); single.add("2", 2); assertSelection(single, 2); }
@Test public void addMulti() throws Exception { multi.add("0", 0); assertSelection(multi, 0); multi.add("1", 1); assertSelection(multi, 0, 1); multi.add("2", 2); assertSelection(multi, 0, 1, 2); }