@Test
    public void testPauseWorkflow() {
        when(executionLockService.acquireLock(anyString(), anyLong())).thenReturn(true);
        doNothing().when(executionLockService).releaseLock(anyString());

        String workflowId = "testPauseWorkflowId";
        WorkflowModel workflow = new WorkflowModel();
        workflow.setWorkflowId(workflowId);

        // if workflow is in terminal state
        workflow.setStatus(WorkflowModel.Status.COMPLETED);
        when(executionDAOFacade.getWorkflowModel(workflowId, false)).thenReturn(workflow);
        try {
            workflowExecutor.pauseWorkflow(workflowId);
            fail("Expected " + ConflictException.class);
        } catch (ConflictException e) {
            verify(executionDAOFacade, never()).updateWorkflow(any(WorkflowModel.class));
            verify(queueDAO, never()).remove(anyString(), anyString());
        }

        // if workflow is already PAUSED
        workflow.setStatus(WorkflowModel.Status.PAUSED);
        when(executionDAOFacade.getWorkflowModel(workflowId, false)).thenReturn(workflow);
        workflowExecutor.pauseWorkflow(workflowId);
        assertEquals(WorkflowModel.Status.PAUSED, workflow.getStatus());
        verify(executionDAOFacade, never()).updateWorkflow(any(WorkflowModel.class));
        verify(queueDAO, never()).remove(anyString(), anyString());

        // if workflow is RUNNING
        workflow.setStatus(WorkflowModel.Status.RUNNING);
        when(executionDAOFacade.getWorkflowModel(workflowId, false)).thenReturn(workflow);
        workflowExecutor.pauseWorkflow(workflowId);
        assertEquals(WorkflowModel.Status.PAUSED, workflow.getStatus());
        verify(executionDAOFacade, times(1)).updateWorkflow(any(WorkflowModel.class));
        verify(queueDAO, times(1)).remove(anyString(), anyString());
    }
Simulate Queue push failures and assert that scheduleTask doesn't throw an exception.
core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java