### Question:
TaskProducer { public static boolean produceTask(ExecutorTask executorTask) { if (executorTask.isPersistent()) { try { DBQueue.getInstance().put(executorTask); } catch (SQLException e) { SwiftLoggers.getLogger().error("task {} insert db failed! ", executorTask, e); } } return MemoryQueue.getInstance().offer(executorTask); }  static boolean produceTasks(Set<ExecutorTask> executorTasks); static boolean produceTask(ExecutorTask executorTask); static boolean retriggerDeleteTasks();  }### Answer:
@Test public void testProduceTask() throws SQLException { try { TaskProducer.produceTask(dbTask); Mockito.verify(executorTaskService).save(dbTask); TaskProducer.produceTask(memTask); Mockito.verify(memoryQueue).offer(dbTask); Mockito.verify(memoryQueue).offer(memTask); } catch (SQLException e) { assertTrue(false); } Set<ExecutorTask> executorTaskSet = new HashSet<ExecutorTask>() {{ add(dbTask); add(memTask); }}; try { TaskProducer.produceTasks(executorTaskSet); Assert.assertTrue(false); } catch (NotDBTaskException e) { Assert.assertTrue(true); Assert.assertEquals(e.getMessage(), "memTask"); } Set<ExecutorTask> executorTaskSet2 = new HashSet<ExecutorTask>() {{ add(dbTask); }}; try { TaskProducer.produceTasks(executorTaskSet2); Mockito.verify(executorTaskService).batchSave(executorTaskSet2); Mockito.verify(memoryQueue, Mockito.times(2)).offer(dbTask); Assert.assertTrue(true); } catch (NotDBTaskException e) { Assert.assertTrue(false); } }