Class TestFixedTimeController

java.lang.Object
trafficcontrol.TestFixedTimeController

public class TestFixedTimeController
extends java.lang.Object
Test the fixed time traffic controller class.

Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Version:
$Revision$, $LastChangedDate$, by $Author$, initial version Feb 21, 2019
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Summary

    Constructors 
    Constructor Description
    TestFixedTimeController()  
  • Method Summary

    Modifier and Type Method Description
    void checkState​(OTSSimulatorInterface simulator, org.opentrafficsim.trafficcontrol.FixedTimeController ftc, boolean stopSimulatorOnError)
    Check that the current state of a fixed time traffic light controller matches the design.
    OTSModelInterface createModelMock()
    Create a mocked OTSModelInterface.
    TrafficLight createTrafficLightMock​(java.lang.String id, java.lang.String networkId, OTSSimulatorInterface simulator)
    Mock a traffic light.
    void testConstructors()
    Test the constructors and initializers of the signal group and fixed time controller classes.
    void testDisjoint()
    Test detection of non-disjoint sets of traffic lights.
    void testTimings()
    Test timing of fixed time controller.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • testConstructors

      public void testConstructors() throws SimRuntimeException, javax.naming.NamingException, NetworkException
      Test the constructors and initializers of the signal group and fixed time controller classes.
      Throws:
      SimRuntimeException - if that happens uncaught; this test has failed
      javax.naming.NamingException - if that happens uncaught; this test has failed
      NetworkException - on exception
    • testDisjoint

      public void testDisjoint() throws SimRuntimeException, javax.naming.NamingException, NetworkException
      Test detection of non-disjoint sets of traffic lights.
      Throws:
      javax.naming.NamingException - on exception
      SimRuntimeException - on exception
      NetworkException - on exception
    • testTimings

      public void testTimings() throws SimRuntimeException, javax.naming.NamingException, NetworkException
      Test timing of fixed time controller.
      Throws:
      SimRuntimeException - if that happens uncaught; this test has failed
      javax.naming.NamingException - if that happens uncaught; this test has failed
      NetworkException - on exception
    • checkState

      public void checkState​(OTSSimulatorInterface simulator, org.opentrafficsim.trafficcontrol.FixedTimeController ftc, boolean stopSimulatorOnError)
      Check that the current state of a fixed time traffic light controller matches the design.
      Parameters:
      simulator - OTSSimulatorInterface; the simulator
      ftc - FixedTimeController; the fixed time traffic light controller
      stopSimulatorOnError - boolean; if true; stop the simulator on error; if false; execute the failing assert on error
    • createModelMock

      public OTSModelInterface createModelMock()
      Create a mocked OTSModelInterface.
      Returns:
      OTSModelInterface
    • createTrafficLightMock

      public TrafficLight createTrafficLightMock​(java.lang.String id, java.lang.String networkId, OTSSimulatorInterface simulator)
      Mock a traffic light.
      Parameters:
      id - String; value that will be returned by the getId method
      networkId - String; name of network (prepended to id for result of getFullId method)
      simulator - TODO
      Returns:
      TrafficLight