@Test(groups = "Integration") // because one second wait in succeedsContinually
  public void testDoesNotPromoteIfMasterTimeoutNotExpired() throws Exception {
    persister.delta(
        ManagementPlaneSyncRecordDeltaImpl.builder()
            .node(newManagerMemento(ownNodeId, ManagementNodeState.STANDBY, tickerCurrentMillis()))
            .node(newManagerMemento("node1", ManagementNodeState.MASTER, tickerCurrentMillis()))
            .setMaster("node1")
            .build());

    manager.start(HighAvailabilityMode.AUTO);

    tickerAdvance(Duration.seconds(29));

    // Expect not to be notified, as 29s < 30s timeout (it's a fake clock so won't hit 30, even
    // waiting 1s below)
    Asserts.succeedsContinually(
        new Runnable() {
          @Override
          public void run() {
            assertTrue(
                promotionListener.callTimestamps.isEmpty(),
                "calls=" + promotionListener.callTimestamps);
          }
        });
  }
 private void assertNoEventsContinually() {
   Asserts.succeedsContinually(
       new Runnable() {
         @Override
         public void run() {
           assertTrue(events.isEmpty(), "events=" + events);
         }
       });
 }
 private void assertNoEventsContinually(Duration duration) {
   Asserts.succeedsContinually(
       ImmutableMap.of("timeout", duration),
       new Runnable() {
         @Override
         public void run() {
           assertTrue(events.isEmpty(), "events=" + events);
         }
       });
 }