### Question:
InstanceSelector { void close( Consumer<T> consumer ) { if ( !closed ) { try { forInstantiated( consumer ); } finally { closed = true; } } } InstanceSelector();   InstanceSelector( EnumMap<IndexSlot,T> map ); @Override String toString();  }### Answer:
@SuppressWarnings( "ResultOfMethodCallIgnored" ) @Test public void shouldNotThrowOnNonInstantiatedClose() { InstanceSelector<String> selector = selector( NUMBER, "0" ); selector.close( Integer::parseInt ); }
@Test public void shouldCloseAll() { InstanceSelector<String> selector = selectorFilledWithOrdinal(); MutableInt count = new MutableInt(); selector.close( s -> count.increment() ); assertEquals( IndexSlot.values().length, count.intValue() ); }