### Question:
AnomalyDetectionResource { TaskDTO generateTaskConfig(DetectionConfigDTO detectionConfigDTO, long start, long end, String nameSuffix) throws JsonProcessingException { TaskDTO taskDTO = new TaskDTO(); taskDTO.setJobName( TaskConstants.TaskType.DETECTION_ONLINE.toString() + nameSuffix); taskDTO.setStatus(TaskConstants.TaskStatus.WAITING); taskDTO.setTaskType(TaskConstants.TaskType.DETECTION_ONLINE); DetectionPipelineTaskInfo taskInfo = new DetectionPipelineTaskInfo(-1L, start, end); taskInfo.setOnline(true); taskDAO.populateDetectionConfig(detectionConfigDTO, taskInfo); String taskInfoJson = objectMapper.writeValueAsString(taskInfo); taskDTO.setTaskInfo(taskInfoJson); taskDAO.save(taskDTO); LOG.info("Created task: {}", taskDTO); return taskDTO; } @Inject  AnomalyDetectionResource(UserDashboardResource userDashboardResource); @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation("Request an anomaly detection online task") Response onlineApi(
          @QueryParam("start") Long start,
          @QueryParam("end") Long end,
          @QueryParam("data-id") Long dataId,
          @ApiParam("jsonPayload") String payload,
          @Auth ThirdEyePrincipal principal); @POST @Path("/data") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation("Register ad hoc data used in online service and created dataset/metric configs") Response createOnlineData(@ApiParam("jsonPayload") String payload,
      @Auth ThirdEyePrincipal principal); @PUT @Path("/data/{data-id}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation("Update ad hoc data used in online service and corresponding dataset/metric configs") Response updateOnlineData(
      @ApiParam("jsonPayload") String payload,
      @PathParam("data-id") Long dataId,
      @Auth ThirdEyePrincipal principal); @DELETE @Path("/data/{data-id}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation("Delete ad hoc data used in online service and corresponding dataset/metric configs") Response deleteOnlineData(@PathParam("data-id") Long dataId); @GET @Path("/data/{data-id}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation("Get ad hoc data used in online service and corresponding dataset/metric configs") Response getOnlineData(@PathParam("data-id") Long dataId); @POST @Path("/tasks") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.TEXT_PLAIN) @ApiOperation("Submit an anomaly detection task") Response taskSubmitApi(
      @QueryParam("start") long start,
      @QueryParam("end") long end,
      @QueryParam("detection-name") String detectionName); @GET @Path("/task/{task-id}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.TEXT_PLAIN) @ApiOperation("Query a task status") Response taskStatusApi(@PathParam("task-id") long taskId);  }### Answer:
@Test public void testGenerateTaskConfig() throws JsonProcessingException { long dummyId = 123456L; DetectionConfigDTO detectionConfigDTO = new DetectionConfigDTO(); detectionConfigDTO.setId(dummyId); TaskDTO taskDTO = this.anomalyDetectionResource .generateTaskConfig(detectionConfigDTO, 0, 0, this.suffix); Assert.assertEquals(taskDTO.getTaskType(), TaskConstants.TaskType.DETECTION_ONLINE); Assert.assertEquals(taskDTO.getStatus(), TaskConstants.TaskStatus.WAITING); }