@Test
  public void givenLatchIsOn_whenTryToPassAfterFirstAttempt_thenAllAreSuccessful() {
    latch.turnOn();

    latch.tryToPass();
    assertAllTryToPassAttemptsAreSuccessful(anyNumAttempts());
  }
  @Test
  public void givenLatchIsOff_whenTryToPass_thenAllAreSuccessful() {
    latch.turnOff();

    assertAllTryToPassAttemptsAreSuccessful(anyNumAttempts());
  }
 private void assertAllTryToPassAttemptsAreSuccessful(int times) {
   assertTrue(latch.tryToPass());
 }
  @Test
  public void givenLatchIsOn_whenTryToPass_thenFailed() {
    latch.turnOn();

    assertFalse(latch.tryToPass());
  }