### Question:
ScenarioSimulatorMain { protected Scenario loadScenario(Simulation simulation) { Scenario scenario=null; try { java.io.InputStream is=ClassLoader.getSystemResourceAsStream(simulation.getScenario()); if (is == null) { java.io.File f=new java.io.File(simulation.getScenario()); if (f.exists()) { is = new java.io.FileInputStream(f); } } if (is != null) { scenario = ScenarioModelUtil.deserialize(is); is.close(); } else { logger.severe("Failed to find scenario '"+simulation.getScenario()+"'"); } } catch(Throwable e) { logger.log(Level.SEVERE, "Failed to load scenario '"+simulation.getScenario()+"'", e); } return(scenario); }  static void main(String[] args); int simulate(Simulation simulation); int simulate(Simulation simulation, SimulationHandler handler);  }### Answer:
@Test public void testLoadScenarioValid() { ScenarioSimulatorMain simulator=new ScenarioSimulatorMain(); Simulation simulation=new Simulation(); simulation.setScenario("scenarios/SuccessfulPurchase.scn"); if (simulator.loadScenario(simulation) == null) { fail("Simulation failed to load scenario"); } }
@Test public void testLoadScenarioInvalid() { ScenarioSimulatorMain simulator=new ScenarioSimulatorMain(); Simulation simulation=new Simulation(); simulation.setScenario("scenarios/SuccessfulPurchaseX.scn"); if (simulator.loadScenario(simulation) != null) { fail("Simulation should have failed to load scenario"); } }