public static DependencyProvider empty() { return builder().build(); }
public DependencyProvider build() { return new FakeDependencyProvider( modelMapBuilder.build(), classMapBuilder.build()); } }
/** * Sets up a fake dependency provider and a working model instance. */ @Before public void setUp() { clock = spy((RealtimeClockController) TimeModel.builder() .withRealTime() .build(FakeDependencyProvider.empty())); doNothing().when(clock).switchToRealTime(); doNothing().when(clock).switchToSimulatedTime(); final RoadModelSnapshot planeSnapshot = RoadModelSnapshotTestUtil.createPlaneRoadModelSnapshot(new Point(0, 0), new Point(10, 10), SI.KILOMETER); final PDPRoadModel rm = mock(PDPRoadModel.class); when(rm.getSpeedUnit()).thenReturn(NonSI.KILOMETERS_PER_HOUR); when(rm.getDistanceUnit()).thenReturn(SI.KILOMETER); when(rm.getSnapshot()).thenReturn(planeSnapshot); dependencyProvider = FakeDependencyProvider.builder() .add(clock, RealtimeClockController.class) .add(rm, PDPRoadModel.class) .add(DefaultPDPModel.builder()) .build(); model = RtSolverModel.builder().build(dependencyProvider); ((TimeModel) clock).register(model); assertThat(model.mode).isEqualTo(Mode.UNKNOWN); TestUtil.testEnum(Mode.class); TestUtil.testEnum(RtSimSolver.EventType.class); }
/** * Sets up the model. */ @SuppressWarnings("unchecked") @Before public void setUp() { TestUtil.testEnum(ClockEventType.class); TestUtil.testEnum(Trigger.class); TestUtil.testEnum(SimpleState.class); TestUtil.testEnum(ClockMode.class); model = (T) builder.build(FakeDependencyProvider.empty()); }
static DependencyProvider fakeDependencies() { return FakeDependencyProvider.builder() .add(RandomModel.builder()) .build(); }
@Before public void setUp() { model = RoadModelBuilders.plane() .withCollisionAvoidance() .withMinPoint(new Point(0, 0)) .withMaxPoint(new Point(100, 100)) .withDistanceUnit(SI.METER) .withSpeedUnit(SI.METERS_PER_SECOND) .withMaxSpeed(1) .withObjectRadius(.5d) .build(FakeDependencyProvider.builder() .add(TimeModel.builder() .withTickLength(tickLength)) .build()); }