Esempio n. 1
0
  /**
   * @author Robert Dempsey, Student Number: N5400872 Tests that trainCanMove() returns false when
   *     appropriate
   * @throws TrainException
   */
  @Test
  public void testTrainCanMoveFalseOneCarriage() throws TrainException {
    final Integer GROSS_WEIGHT = 590;
    final String CLASSIFICATION = "4S";
    final Locomotive LOCOMOTIVE = new Locomotive(GROSS_WEIGHT, CLASSIFICATION);

    DepartingTrain departingTrain = new DepartingTrain();

    departingTrain.addCarriage(LOCOMOTIVE);
    assertFalse(departingTrain.trainCanMove());
  }
Esempio n. 2
0
  /**
   * @author Robert Dempsey, Student Number: N5400872 Tests that trainCanMove() returns false when
   *     appropriate with multiple carriages
   * @throws TrainException
   */
  @Test
  public void testTrainCanMoveFalseMultipleCarriages() throws TrainException {
    final Integer SEATS = 20;
    final Integer GROSS_WEIGHT = 290;
    final String CLASSIFICATION = "4S";
    final Locomotive LOCOMOTIVE = new Locomotive(GROSS_WEIGHT, CLASSIFICATION);
    final PassengerCar PASSENGERCAR_01 = new PassengerCar(GROSS_WEIGHT, SEATS);

    DepartingTrain departingTrain = new DepartingTrain();

    departingTrain.addCarriage(LOCOMOTIVE);
    departingTrain.addCarriage(PASSENGERCAR_01);

    assertFalse(departingTrain.trainCanMove());
  }