test_class.declarator: LOCK_CONFIGURATION = new LockConfiguration(now(),"name", Duration.ofSeconds(10), Duration.ZERO)
test_class.modifier: private static final
test_class.original_string: private static final LockConfiguration LOCK_CONFIGURATION = new LockConfiguration(now(),"name", Duration.ofSeconds(10), Duration.ZERO);
test_class.type: LockConfiguration
test_class.var_name: LOCK_CONFIGURATION
test_class.declarator: lockProvider = mock(LockProvider.class)
test_class.modifier: private final
test_class.original_string: private final LockProvider lockProvider = mock(LockProvider.class);
test_class.type: LockProvider
test_class.var_name: lockProvider
test_class.declarator: lockConfigurationExtractor = mock(LockConfigurationExtractor.class)
test_class.modifier: private final
test_class.original_string: private final LockConfigurationExtractor lockConfigurationExtractor = mock(LockConfigurationExtractor.class);
test_class.type: LockConfigurationExtractor
test_class.var_name: lockConfigurationExtractor
test_class.declarator: task = mock(Runnable.class)
test_class.modifier: private final
test_class.original_string: private final Runnable task = mock(Runnable.class);
test_class.type: Runnable
test_class.var_name: task
test_class.declarator: lock = mock(SimpleLock.class)
test_class.modifier: private final
test_class.original_string: private final SimpleLock lock = mock(SimpleLock.class);
test_class.type: SimpleLock
test_class.var_name: lock
test_class.declarator: defaultLockManager = new DefaultLockManager(lockProvider, lockConfigurationExtractor)
test_class.modifier: private final
test_class.original_string: private final DefaultLockManager defaultLockManager = new DefaultLockManager(lockProvider, lockConfigurationExtractor);
test_class.type: DefaultLockManager
test_class.var_name: defaultLockManager
test_class.file: shedlock-core/src/test/java/net/javacrumbs/shedlock/core/DefaultLockManagerTest.java
test_class.identifier: DefaultLockManagerTest
test_case.body: @Test
      void executeIfLockAvailable() {
          when(lockConfigurationExtractor.getLockConfiguration(task)).thenReturn(Optional.of(LOCK_CONFIGURATION));
          when(lockProvider.lock(LOCK_CONFIGURATION)).thenReturn(Optional.of(lock));
  
          defaultLockManager.executeWithLock(task);
          verify(task).run();
          InOrder inOrder = inOrder(task, lock);
          inOrder.verify(task).run();
          inOrder.verify(lock).unlock();
      }
test_case.class_method_signature: DefaultLockManagerTest.executeIfLockAvailable()
test_case.full_signature: @Test void executeIfLockAvailable()
test_case.identifier: executeIfLockAvailable
test_case.invocations: thenReturn when getLockConfiguration of thenReturn when lock of executeWithLock run verify inOrder run verify unlock verify
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void executeIfLockAvailable()
focal_class.declarator: logger = LoggerFactory.getLogger(DefaultLockManager.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(DefaultLockManager.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: lockingTaskExecutor
focal_class.modifier: private final
focal_class.original_string: private final LockingTaskExecutor lockingTaskExecutor;
focal_class.type: LockingTaskExecutor
focal_class.var_name: lockingTaskExecutor
focal_class.declarator: lockConfigurationExtractor
focal_class.modifier: private final
focal_class.original_string: private final LockConfigurationExtractor lockConfigurationExtractor;
focal_class.type: LockConfigurationExtractor
focal_class.var_name: lockConfigurationExtractor
focal_class.file: shedlock-core/src/main/java/net/javacrumbs/shedlock/core/DefaultLockManager.java
focal_class.identifier: DefaultLockManager
focal_class.interfaces: implements LockManager
focal_class.class_method_signature: DefaultLockManager.DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.full_signature: public  DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.identifier: DefaultLockManager
focal_class.modifiers: public
focal_class.parameters: (@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.signature:  DefaultLockManager(@NonNull LockProvider lockProvider, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.class_method_signature: DefaultLockManager.DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.full_signature: public  DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.identifier: DefaultLockManager
focal_class.modifiers: public
focal_class.parameters: (@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.signature:  DefaultLockManager(@NonNull LockingTaskExecutor lockingTaskExecutor, @NonNull LockConfigurationExtractor lockConfigurationExtractor)
focal_class.class_method_signature: DefaultLockManager.executeWithLock(@NonNull Runnable task)
focal_class.full_signature: @Override public void executeWithLock(@NonNull Runnable task)
focal_class.identifier: executeWithLock
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull Runnable task)
focal_class.return: void
focal_class.signature: void executeWithLock(@NonNull Runnable task)
focal_method.body: @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());
          }
      }
focal_method.class_method_signature: DefaultLockManager.executeWithLock(@NonNull Runnable task)
focal_method.full_signature: @Override public void executeWithLock(@NonNull Runnable task)
focal_method.identifier: executeWithLock
focal_method.invocations: getLockConfiguration isPresent debug run executeWithLock get
focal_method.modifiers: @Override public
focal_method.parameters: (@NonNull Runnable task)
focal_method.return: void
focal_method.signature: void executeWithLock(@NonNull Runnable task)