NodeAdminImpl implements NodeAdmin { @Override public Duration subsystemFreezeDuration() { if (startOfFreezeConvergence == null) { return Duration.ZERO; } else { return Duration.between(startOfFreezeConvergence, clock.instant()); } } NodeAdminImpl(NodeAgentFactory nodeAgentFactory, Metrics metrics, Clock clock);  NodeAdminImpl(NodeAgentFactory nodeAgentFactory, Metrics metrics,
                         Clock clock, Duration freezeTimeout, Duration spread);   NodeAdminImpl(NodeAgentWithSchedulerFactory nodeAgentWithSchedulerFactory,
                  Metrics metrics, Clock clock, Duration freezeTimeout, Duration spread); @Override void refreshContainersToRun(Set<NodeAgentContext> nodeAgentContexts); @Override void updateMetrics(boolean isSuspended); @Override boolean setFrozen(boolean wantFrozen); @Override boolean isFrozen(); @Override Duration subsystemFreezeDuration(); @Override void stopNodeAgentServices(List<String> hostnames); @Override void start(); @Override void stop();  }
@Test public void testSubsystemFreezeDuration() { assertTrue(nodeAdmin.isFrozen()); assertTrue(nodeAdmin.subsystemFreezeDuration().isZero()); clock.advance(Duration.ofSeconds(1)); assertEquals(Duration.ofSeconds(1), nodeAdmin.subsystemFreezeDuration()); assertTrue(nodeAdmin.setFrozen(false)); assertTrue(nodeAdmin.subsystemFreezeDuration().isZero()); clock.advance(Duration.ofSeconds(1)); assertTrue(nodeAdmin.subsystemFreezeDuration().isZero()); assertTrue(nodeAdmin.setFrozen(true)); assertTrue(nodeAdmin.subsystemFreezeDuration().isZero()); clock.advance(Duration.ofSeconds(1)); assertEquals(Duration.ofSeconds(1), nodeAdmin.subsystemFreezeDuration()); }