Ejemplo n.º 1
0
  @Test(expected = IllegalStateException.class)
  public void activateActiveVehicle() throws Exception {

    // Given
    vehicle.applyEvent(new Activated(vehicle.id));

    // When
    vehicle.activate();

    // Should throw IllegalStateException
  }
Ejemplo n.º 2
0
  @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)));
  }