@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); }
@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); }
// 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); }