@Test(expected = IllegalStateException.class) public void moveInactiveVehicleTest() throws Exception { // When vehicle.changeLocation(1f, 1f); // Should throw IllegalStateException }
@Test public void moveActiveVehicleTest() throws Exception { // Given vehicle.applyEvent(new Activated(vehicle.id)); // When vehicle.changeLocation(1f, 1f); // Then List<Event> events = vehicle.getPendingEvents(); assertTrue(events.size() == 2); assertTrue(events.get(1).equals(new LocationChanged(1f, 1f))); }