Пример #1
0
  // 停止中はPにシフトできる
  @Test
  public void allowsShiftToParkWhenNotMoving() {
    transmission.shift(Gear.DRIVE);
    car.accelerateTo(30);
    car.brakeToStop();

    transmission.shift(Gear.PARK);

    assertThat(transmission.getGear(), equalTo(Gear.PARK));
  }
Пример #2
0
  // 走行中にはPへのシフトを無視する
  @Test
  public void ignoresShiftToParkWhileInDrive() {
    transmission.shift(Gear.DRIVE);
    car.accelerateTo(30);

    transmission.shift(Gear.PARK);

    assertThat(transmission.getGear(), equalTo(Gear.DRIVE));
  }
Пример #3
0
 // 加速を始めたらDの状態を保つ
 @Test
 public void remainsInDriveAfterAcceleration() {
   transmission.shift(Gear.DRIVE);
   car.accelerateTo(35);
   assertThat(transmission.getGear(), equalTo(Gear.DRIVE));
 }