Пример #1
0
 // BEGIN: codeinjection.twice
 @Test
 public void testDecrementTwoTimesEnough() {
   MockServices.setServices(DecrementByTwo.class);
   CountDown counter = create(4);
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertTrue("Two Down is enough", counter.isDown());
 }
Пример #2
0
 @Test
 public void testDecrementFourTimes() {
   MockServices.setServices();
   CountDown counter = create(4);
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertFalse("Not down yet", counter.isDown());
   counter.down();
   assertTrue("Down now", counter.isDown());
 }