Manager { public Manager(final Class<T> clazz) { this.clazz = clazz; } Manager(final Class<T> clazz); T getAssociatedInstance(final String typeId); T makeInstance(final String typeId); void register(final String typeId, final T factory);  }
@Test public void testManager() { final Manager<SomeInterface> manager = new Manager<>(SomeInterface.class); final SomeInterface retrieved = manager.getAssociatedInstance(typeId); assertEquals(expectedClass, retrieved.getClass()); assertEquals(locatorCalled, Factory.locatorCalled); }