Package trafficcontrol
Class TestFixedTimeController
java.lang.Object
trafficcontrol.TestFixedTimeController
Test the fixed time traffic controller class.
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckState(org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, FixedTimeController ftc, boolean stopSimulatorOnError) Check that the current state of a fixed time traffic light controller matches the design.org.opentrafficsim.core.dsol.OtsModelInterfaceCreate a mocked OtsModelInterface.org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLightcreateTrafficLightMock(String id, String networkId, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator) Mock a traffic light.voidTest the constructors and initializers of the signal group and fixed time controller classes.voidTest detection of non-disjoint sets of traffic lights.voidTest timing of fixed time controller.
-
Constructor Details
-
TestFixedTimeController
public TestFixedTimeController()
-
-
Method Details
-
testConstructors
public void testConstructors() throws SimRuntimeException, NamingException, org.opentrafficsim.core.network.NetworkExceptionTest the constructors and initializers of the signal group and fixed time controller classes.- Throws:
SimRuntimeException- if that happens uncaught; this test has failedNamingException- if that happens uncaught; this test has failedorg.opentrafficsim.core.network.NetworkException- on exception
-
testDisjoint
public void testDisjoint() throws SimRuntimeException, NamingException, org.opentrafficsim.core.network.NetworkExceptionTest detection of non-disjoint sets of traffic lights.- Throws:
NamingException- on exceptionSimRuntimeException- on exceptionorg.opentrafficsim.core.network.NetworkException- on exception
-
testTimings
public void testTimings() throws SimRuntimeException, NamingException, org.opentrafficsim.core.network.NetworkExceptionTest timing of fixed time controller.- Throws:
SimRuntimeException- if that happens uncaught; this test has failedNamingException- if that happens uncaught; this test has failedorg.opentrafficsim.core.network.NetworkException- on exception
-
checkState
public void checkState(org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, FixedTimeController ftc, boolean stopSimulatorOnError) Check that the current state of a fixed time traffic light controller matches the design.- Parameters:
simulator- OtsSimulatorInterface; the simulatorftc- FixedTimeController; the fixed time traffic light controllerstopSimulatorOnError- boolean; if true; stop the simulator on error; if false; execute the failing assert on error
-
createModelMock
public org.opentrafficsim.core.dsol.OtsModelInterface createModelMock()Create a mocked OtsModelInterface.- Returns:
- OtsModelInterface
-
createTrafficLightMock
public org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight createTrafficLightMock(String id, String networkId, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator) Mock a traffic light.- Parameters:
id- String; value that will be returned by the getId methodnetworkId- String; name of network (prepended to id for result of getFullId method)simulator- TODO- Returns:
- TrafficLight
-