### Question:
TaskManager { public static AbstractTask newTask(TaskExecutionContext taskExecutionContext, Logger logger) throws IllegalArgumentException { TaskType anEnum = EnumUtils.getEnum(TaskType.class, taskExecutionContext.getTaskType()); if (anEnum == null) { logger.error("not support task type: {}", taskExecutionContext.getTaskType()); throw new IllegalArgumentException("not support task type"); } switch (anEnum) { case SHELL: case WATERDROP: return new ShellTask(taskExecutionContext, logger); case PROCEDURE: return new ProcedureTask(taskExecutionContext, logger); case SQL: return new SqlTask(taskExecutionContext, logger); case MR: return new MapReduceTask(taskExecutionContext, logger); case SPARK: return new SparkTask(taskExecutionContext, logger); case FLINK: return new FlinkTask(taskExecutionContext, logger); case PYTHON: return new PythonTask(taskExecutionContext, logger); case HTTP: return new HttpTask(taskExecutionContext, logger); case DATAX: return new DataxTask(taskExecutionContext, logger); case SQOOP: return new SqoopTask(taskExecutionContext, logger); default: logger.error("not support task type: {}", taskExecutionContext.getTaskType()); throw new IllegalArgumentException("not support task type"); } }  static AbstractTask newTask(TaskExecutionContext taskExecutionContext, Logger logger);  }### Answer:
@Test public void testNewTask() { taskExecutionContext.setTaskType("SHELL"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("WATERDROP"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("HTTP"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("MR"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("SPARK"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("FLINK"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("PYTHON"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("DATAX"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); taskExecutionContext.setTaskType("SQOOP"); Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger)); }
@Test(expected = IllegalArgumentException.class) public void testNewTaskIsNull() { taskExecutionContext.setTaskType(null); TaskManager.newTask(taskExecutionContext,taskLogger); }
@Test(expected = IllegalArgumentException.class) public void testNewTaskIsNotExists() { taskExecutionContext.setTaskType("XXX"); TaskManager.newTask(taskExecutionContext,taskLogger); }