package scriptbuilder.structures;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import junit.framework.TestCase;

/**
 *
 * @author Bryan McGuffin
 */
public class SimulationScriptTest extends TestCase
{

    public SimulationScriptTest(String testName)
    {
        super(testName);
    }

    /**
     * Test of update method, of class SimulationScript.
     */
    public void testUpdate()
    {
        System.out.println("update");
        SimulationScript instance = new SimulationScript();
        instance.update();
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of broadcastEvent method, of class SimulationScript.
     */
    public void testBroadcastEvent_ScriptIncidentSliceChangedEvent()
    {
        System.out.println("broadcastEvent");
        ScriptIncident.SliceChangedEvent e = null;
        SimulationScript instance = new SimulationScript();
        instance.broadcastEvent(e);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of broadcastEvent method, of class SimulationScript.
     */
    public void testBroadcastEvent_ScriptIncidentIncidentFocusedEvent()
    {
        System.out.println("broadcastEvent");
        ScriptIncident.IncidentFocusedEvent e = null;
        SimulationScript instance = new SimulationScript();
        instance.broadcastEvent(e);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of loadScriptFromFile method, of class SimulationScript.
     */
    public void testLoadScriptFromFile()
    {
        System.out.println("loadScriptFromFile");
        File f = null;
        SimulationScript instance = new SimulationScript();
        instance.loadScriptFromFile(f);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of saveScriptToFile method, of class SimulationScript.
     */
    public void testSaveScriptToFile()
    {
        System.out.println("saveScriptToFile");
        File f = null;
        SimulationScript instance = new SimulationScript();
        instance.saveScriptToFile(f);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of toXML method, of class SimulationScript.
     */
    public void testToXML()
    {
        try
        {
            System.out.println("toXML");
            File inFile = new File("test/scriptbuilder/structures/test_input_file.xml");
            assertTrue(inFile.exists());
            SimulationScript instance = new SimulationScript();

            instance.loadScriptFromFile(inFile);

            String expResult = "";

            byte[] data = Files.readAllBytes(inFile.toPath());

            expResult = new String(data);
            String result = instance.toXML();
            assertEquals(expResult, result);
        }
        catch (IOException ex)
        {
            Logger.getLogger(SimulationScriptTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * Test of allSlices method, of class SimulationScript.
     */
    public void testAllSlices()
    {
        System.out.println("allSlices");
        SimulationScript instance = new SimulationScript();
        ArrayList<TimeSlice> expResult = null;
        ArrayList<TimeSlice> result = instance.allSlices();
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of absoluteLength method, of class SimulationScript.
     */
    public void testAbsoluteLength()
    {
        System.out.println("absoluteLength");
        SimulationScript instance = new SimulationScript();
        int expResult = 0;
        int result = instance.absoluteLength();
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

}
