Пример #1
0
 @Test
 public void createsCarWithSpeedOfZero() {
   Car car1 = new Car("Red", 100);
   assertThat(car1.getSpeed(), is(0));
 }
Пример #2
0
 @Test
 public void canDecelerate() {
   Car car1 = new Car("Red", 100);
   car1.decelerate(10);
   assertThat(car1.getSpeed(), is(0));
 }
Пример #3
0
 @Test
 public void cannotDecelerateBeyondMinSpeed() {
   Car car1 = new Car("Red", 100);
   car1.decelerate(-1);
   assertThat(car1.getSpeed(), is(0));
 }
Пример #4
0
 @Test
 public void cannotAccelerateBeyondMaxSpeed() {
   Car car1 = new Car("Red", 100);
   car1.accelerate(101);
   assertThat(car1.getSpeed(), is(100));
 }