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