ComponentManager { public void saveComponent(Class clazz, IComponent component) { logger.debug("saveComponent() called with: clazz = [{}], component = [{}]", clazz, component); components.put(clazz, 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 saveComponent() throws Exception { IComponent component = Mockito.mock(IComponent.class); manager.saveComponent(getClass(), component); Optional<IComponent> optional = manager.restoreComponent(getClass()); assertThat(optional.get(), is(sameInstance(component))); }