@Test void noConfigNoLock() { when(lockConfigurationExtractor.getLockConfiguration(task)).thenReturn(Optional.empty()); defaultLockManager.executeWithLock(task); verify(task).run(); verifyZeroInteractions(lockProvider); }
@Override public void executeWithLock(@NonNull Runnable task) { Optional<LockConfiguration> lockConfigOptional = lockConfigurationExtractor.getLockConfiguration(task); if (!lockConfigOptional.isPresent()) { logger.debug("No lock configuration for {}. Executing without lock.", task); task.run(); } else { lockingTaskExecutor.executeWithLock(task, lockConfigOptional.get()); } }
DefaultLockManager implements LockManager { @Override public void executeWithLock(@NonNull Runnable task) { Optional<LockConfiguration> lockConfigOptional = lockConfigurationExtractor.getLockConfiguration(task); if (!lockConfigOptional.isPresent()) { logger.debug("No lock configuration for {}. Executing without lock.", task); task.run(); } else { lockingTaskExecutor.executeWithLock(task, lockConfigOptional.get()); } } }
DefaultLockManager implements LockManager { @Override public void executeWithLock(@NonNull Runnable task) { Optional<LockConfiguration> lockConfigOptional = lockConfigurationExtractor.getLockConfiguration(task); if (!lockConfigOptional.isPresent()) { logger.debug("No lock configuration for {}. Executing without lock.", task); task.run(); } else { lockingTaskExecutor.executeWithLock(task, lockConfigOptional.get()); } } DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor);  DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor); }
DefaultLockManager implements LockManager { @Override public void executeWithLock(@NonNull Runnable task) { Optional<LockConfiguration> lockConfigOptional = lockConfigurationExtractor.getLockConfiguration(task); if (!lockConfigOptional.isPresent()) { logger.debug("No lock configuration for {}. Executing without lock.", task); task.run(); } else { lockingTaskExecutor.executeWithLock(task, lockConfigOptional.get()); } } DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor);  DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor); @Override void executeWithLock(@NonNull Runnable task); }
DefaultLockManager implements LockManager { @Override public void executeWithLock(@NonNull Runnable task) { Optional<LockConfiguration> lockConfigOptional = lockConfigurationExtractor.getLockConfiguration(task); if (!lockConfigOptional.isPresent()) { logger.debug("No lock configuration for {}. Executing without lock.", task); task.run(); } else { lockingTaskExecutor.executeWithLock(task, lockConfigOptional.get()); } } DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor);  DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor); @Override void executeWithLock(@NonNull Runnable task);  }