ComponentManager { public <Component extends IComponent> Optional<Component> restoreComponent(Class clazz) { logger.debug("restoreComponent() called with: clazz = [{}]", clazz); @SuppressWarnings("unchecked") Component component = (Component) components.remove(clazz); logger.debug("restoreComponent() returned: [{}]", component); return Optional.ofNullable(component); } private  ComponentManager(long maxSize, long expirationValue, TimeUnit expirationUnit); static ComponentManager buildDefault(); Optional<Component> restoreComponent(Class clazz); void saveComponent(Class clazz, IComponent component); static final int MAX_SIZE; static final int EXPIRATION_MINUTES; }
@Test public void restoreEmptyComponent() throws Exception { Optional<IComponent> optional = manager.restoreComponent(getClass()); assertThat(optional, is(Optional.empty())); }