### Question:
AssetManager extends Manager { protected void create(int entityId) { setup(entityId, mMetadataType.get(entityId), mReferenceType.create(entityId)); } AssetManager(Class<A> metadataType, Class<B> referenceType);   }### Answer:
@Test public void new_asset_should_setup_reference() { @Wire(injectInherited = true) class TestManager extends AssetManager<Sound, SoundReference> { public TestManager() { super(Sound.class, SoundReference.class); } @Override protected void setup(int entity, Sound sound, SoundReference soundReference) { Assert.assertNotNull(sound); Assert.assertNotNull(soundReference); } } World world = createWorld(new TestManager()); world.createEntity().edit().create(Sound.class); world.process(); }
@Test public void existing_asset_should_do_nothing() { @Wire(injectInherited = true) class TestManager extends AssetManager<Sound, SoundReference> { int count=0; public TestManager() { super(Sound.class, SoundReference.class); } @Override protected void setup(int entity, Sound sound, SoundReference soundReference) { count++; } } TestManager manager = new TestManager(); World world = createWorld(manager); world.createEntity().edit().create(Sound.class); world.process(); world.process(); Assert.assertEquals(manager.count, 1); }