@Test public void disablingServiceAccessesNothing() throws IOException { lastShutdownTimeService = new LastShutdownTimeServiceImpl(logManager, false); Optional<Date> result = lastShutdownTimeService.estimateLastShutdownTime(); assertThat(result.isPresent(), equalTo(false)); verify(reader, never()).readLine(); }
@Override public synchronized Optional<Date> estimateLastShutdownTime() { if (shutdownTimeGuess == null) { shutdownTimeGuess = findBestEstimate(logManager); } return shutdownTimeGuess; }
LastShutdownTimeServiceImpl extends ComponentSupport implements LastShutdownTimeService { @Override public synchronized Optional<Date> estimateLastShutdownTime() { if (shutdownTimeGuess == null) { shutdownTimeGuess = findBestEstimate(logManager); } return shutdownTimeGuess; } }
LastShutdownTimeServiceImpl extends ComponentSupport implements LastShutdownTimeService { @Override public synchronized Optional<Date> estimateLastShutdownTime() { if (shutdownTimeGuess == null) { shutdownTimeGuess = findBestEstimate(logManager); } return shutdownTimeGuess; } @Inject  LastShutdownTimeServiceImpl(final LogManager logManager,
                                     @Named("${nexus.log.lastShutdownTime.enabled:-true}") final boolean enabled); }
LastShutdownTimeServiceImpl extends ComponentSupport implements LastShutdownTimeService { @Override public synchronized Optional<Date> estimateLastShutdownTime() { if (shutdownTimeGuess == null) { shutdownTimeGuess = findBestEstimate(logManager); } return shutdownTimeGuess; } @Inject  LastShutdownTimeServiceImpl(final LogManager logManager,
                                     @Named("${nexus.log.lastShutdownTime.enabled:-true}") final boolean enabled); @Override synchronized Optional<Date> estimateLastShutdownTime(); }
LastShutdownTimeServiceImpl extends ComponentSupport implements LastShutdownTimeService { @Override public synchronized Optional<Date> estimateLastShutdownTime() { if (shutdownTimeGuess == null) { shutdownTimeGuess = findBestEstimate(logManager); } return shutdownTimeGuess; } @Inject  LastShutdownTimeServiceImpl(final LogManager logManager,
                                     @Named("${nexus.log.lastShutdownTime.enabled:-true}") final boolean enabled); @Override synchronized Optional<Date> estimateLastShutdownTime();  }