test(JOML): migrate and simplify PojoPrefabManagerTest
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.reflections.Reflections;
-import org.terasology.assets.AssetFactory;
import org.terasology.assets.ResourceUrn;
import org.terasology.assets.management.AssetManager;
import org.terasology.assets.module.ModuleAwareAssetTypeManager;
import org.terasology.context.internal.ContextImpl;
import org.terasology.engine.module.ModuleManager;
-import org.terasology.entitySystem.metadata.ComponentLibrary;
-import org.terasology.entitySystem.metadata.EntitySystemLibrary;
import org.terasology.entitySystem.prefab.Prefab;
import org.terasology.entitySystem.prefab.PrefabData;
import org.terasology.entitySystem.prefab.internal.PojoPrefab;
import org.terasology.entitySystem.prefab.internal.PojoPrefabManager;
import org.terasology.entitySystem.stubs.StringComponent;
-import org.terasology.math.geom.Quat4f;
-import org.terasology.math.geom.Vector3f;
-import org.terasology.persistence.typeHandling.TypeHandlerLibrary;
-import org.terasology.persistence.typeHandling.TypeHandlerLibraryImpl;
-import org.terasology.persistence.typeHandling.mathTypes.legacy.LegacyQuat4fTypeHandler;
-import org.terasology.persistence.typeHandling.mathTypes.legacy.LegacyVector3fTypeHandler;
import org.terasology.registry.CoreRegistry;
import org.terasology.testUtil.ModuleManagerFactory;
import org.terasology.utilities.Assets;
public class PojoPrefabManagerTest {
public static final String PREFAB_NAME = "unittest:myprefab";
- private EntitySystemLibrary entitySystemLibrary;
- private ComponentLibrary componentLibrary;
private PojoPrefabManager prefabManager;
@BeforeEach
@@ -47,18 +35,8 @@ public void setup() throws Exception {
CoreRegistry.setContext(context);
ModuleManager moduleManager = ModuleManagerFactory.create();
- Reflections reflections = new Reflections(getClass().getClassLoader());
- TypeHandlerLibrary lib = new TypeHandlerLibraryImpl(reflections);
-
- lib.addTypeHandler(Vector3f.class, new LegacyVector3fTypeHandler());
- lib.addTypeHandler(Quat4f.class, new LegacyQuat4fTypeHandler());
-
- entitySystemLibrary = new EntitySystemLibrary(context, lib);
- componentLibrary = entitySystemLibrary.getComponentLibrary();
-
ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager();
- assetTypeManager.registerCoreAssetType(Prefab.class,
- (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs");
+ assetTypeManager.registerCoreAssetType(Prefab.class, PojoPrefab::new, "prefabs");
assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
context.put(AssetManager.class, assetTypeManager.getAssetManager());
@@ -75,7 +53,7 @@ public void testRetrieveNonExistentPrefab() {
public void testRetrievePrefab() {
PrefabData data = new PrefabData();
data.addComponent(new StringComponent("Test"));
- Prefab prefab = Assets.generateAsset(new ResourceUrn(PREFAB_NAME), data, Prefab.class);
+ Assets.generateAsset(new ResourceUrn(PREFAB_NAME), data, Prefab.class);
Prefab ref = prefabManager.getPrefab(PREFAB_NAME);
assertNotNull(ref);
assertEquals(PREFAB_NAME, ref.getName());
