@Before public void setup() { ContextImpl context = new ContextImpl(); context.put(ModuleManager.class, moduleManager); context.put(NetworkSystem.class, mock(NetworkSystem.class)); context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus()); CoreRegistry.setContext(context); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); entityManager = context.get(EngineEntityManager.class); }
@Before public void setup() throws Exception { ContextImpl context = new ContextImpl(); context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus()); CoreRegistry.setContext(context); ModuleManager moduleManager = ModuleManagerFactory.create(); context.put(ModuleManager.class, moduleManager); EntitySystemSetupUtil.addReflectionBasedLibraries(context); ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager(); assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs"); ComponentLibrary componentLibrary = context.get(ComponentLibrary.class); TypeSerializationLibrary typeSerializationLibrary = context.get(TypeSerializationLibrary.class); PrefabFormat prefabFormat = new PrefabFormat(componentLibrary, typeSerializationLibrary); assetTypeManager.registerCoreFormat(Prefab.class, prefabFormat); assetTypeManager.switchEnvironment(moduleManager.getEnvironment()); context.put(AssetManager.class, assetTypeManager.getAssetManager()); NetworkSystem networkSystem = mock(NetworkSystem.class); when(networkSystem.getMode()).thenReturn(NetworkMode.NONE); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); prefabManager = new PojoPrefabManager(context); }