package template.extensions;

import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

import electrosphere.engine.Main;
import testutils.EngineInit;
import testutils.TestEngineUtils;

/**
 * Spins up and tears down entity testing environment
 */
public class EntityExtension implements BeforeEachCallback, AfterEachCallback {
    
    @Override
    public void beforeEach(ExtensionContext context) throws Exception {
        //init engine
        TestEngineUtils.initGraphicalEngine();
        
        //load scene
        EngineInit.setupConnectedTestScene();
    }

    @Override
    public void afterEach(ExtensionContext context) throws Exception {
        Main.shutdown();
    }

}
