### Question:
ResourcesHolder { public void close() { PriorityQueue<SortedResource> queue = new PriorityQueue<SortedResource>(resources.values()); SortedResource resource = queue.poll(); while (resource != null) { try { logger.info("close {}:{}", resource.getClass().getSimpleName(), resource); resource.close(); } catch (RuntimeException exception) { logger.error("fail to close resource " + resource + ", an exception occured", exception); } resource = queue.poll(); } resources.clear(); } ResourcesHolder(); void remove(Class<? extends SortedResource> clazz); void put(Class<T> clazz, T resource); T get(Class<T> clazz); void close(); static final String RESOURCES; }### Answer:
@Test public void closeShouldNoopWhenNoResource() { testee.close(); }