1 package org.opentrafficsim.core.mock;
2
3 import org.mockito.Mockito;
4 import org.opentrafficsim.core.gtu.GTU;
5
6 import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
7
8 /**
9 * MockGTU.java. <br>
10 * <br>
11 * Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12 * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
13 * source code and binary code of this software is proprietary information of Delft University of Technology.
14 * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
15 */
16 public class MockGTU
17 {
18 /** mocked GTU. */
19 private GTU mockGTU;
20
21 /** name. */
22 private String name;
23
24 /** mocked simulator. */
25 private DEVSSimulatorInterface.TimeDoubleUnit simulator = MockDEVSSimulator.createMock();
26
27 /**
28 * @param name the name
29 */
30 public MockGTU(final String name)
31 {
32 super();
33 this.name = name;
34 this.mockGTU = Mockito.mock(GTU.class);
35 Mockito.when(this.mockGTU.getSimulator()).thenReturn(this.simulator);
36 Mockito.when(this.mockGTU.getId()).thenReturn(this.name);
37 }
38
39 /**
40 * @return mocked DEVSSimulator
41 */
42 public GTU getMock()
43 {
44 return this.mockGTU;
45 }
46
47 }