### Question:
DBStackStatusSyncJob extends StatusCheckerJob { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { Long dbStackId = Long.valueOf(getLocalId()); DBStack dbStack = dbStackService.getById(dbStackId); MDCBuilder.buildMdcContext(dbStack); if (flowLogService.isOtherFlowRunning(dbStackId)) { LOGGER.debug("DBStackStatusCheckerJob cannot run, because flow is running for stack: {}", dbStackId); } else { try { measure(() -> { ThreadBasedUserCrnProvider.doAsInternalActor(() -> { dbStackStatusSyncService.sync(dbStack); }); }, LOGGER, ":::Auto sync::: DB stack sync in {}ms"); } catch (Exception e) { LOGGER.info(":::Auto sync::: Error occurred during DB sync: {}", e.getMessage(), e); } } MDCBuilder.cleanupMdc(); }    }### Answer:
@Test public void shouldNotCallSyncWhenOtherFlowIsRunning() throws JobExecutionException { when(flowLogService.isOtherFlowRunning(DB_STACK_ID)).thenReturn(true); victim.executeInternal(jobExecutionContext); verifyZeroInteractions(dbStackStatusSyncService); }
@Test public void shouldCallSync() throws JobExecutionException { when(flowLogService.isOtherFlowRunning(DB_STACK_ID)).thenReturn(false); victim.executeInternal(jobExecutionContext); verify(dbStackStatusSyncService).sync(dbStack); }