Пример #1
0
  @Test
  public void testStop() {
    // setup
    Vehicle vehicle = new Vehicle();
    vehicle.setAngle(0);
    vehicle.setOwner("hoge");
    vehicle.setSpeed(60);

    // execute
    vehicle.stop();
    double actual = vehicle.getSpeed();

    // test
    assertTrue(0.0 == actual);
  }
Пример #2
0
  @Test
  public void testTurnBoolean() {
    // setup
    Vehicle vehicle = new Vehicle();
    vehicle.setAngle(0);
    vehicle.setOwner("hoge");
    vehicle.setSpeed(60);

    // execute
    vehicle.turn(Vehicle.TURN_LEFT);
    double actual = vehicle.getAngle();

    // test
    assertEquals(90.0, actual, 0.1);
  }
Пример #3
0
  // ex15 test
  @Test
  public void testChangeSpeed() {
    // setup
    Vehicle vehicle = new Vehicle();
    vehicle.setAngle(0);
    vehicle.setOwner("hoge");
    vehicle.setSpeed(60);

    // execute
    vehicle.changeSpeed(12.34);
    double actual = vehicle.getSpeed();

    // test
    assertEquals(12.34, actual, 0.01);
  }