### Question:
TaskAssigningRuntimeResource { @ApiOperation(value = "Executes a planning into the processes runtime.", notes = "This operation is intended for the task assigning integration implementation, third parties should avoid using it.", response = PlanningExecutionResult.class) @POST @Path(TASK_ASSIGNING_EXECUTE_PLANNING_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executePlanning(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "identifier of the user to execute the planning on behalf of", required = true) @QueryParam("user") String userId, @ApiParam(value = "planning definition represented as PlanningItemList", required = true) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { final String contentType = getContentType(headers); final PlanningItemList planningItemList = marshallerHelper.unmarshal(payload, contentType, PlanningItemList.class); final PlanningExecutionResult result = runtimeServiceBase.executePlanning(planningItemList, userId); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error executing planning {}", e.getMessage(), e); return internalServerError(errorMessage(e), v); } } TaskAssigningRuntimeResource(TaskAssigningRuntimeServiceBase runtimeServiceBase,
                                        KieServerRegistry context); @ApiOperation(value = "Executes a planning into the processes runtime.", notes = "This operation is intended for the task assigning integration implementation, third parties should avoid using it.", response = PlanningExecutionResult.class) @POST @Path(TASK_ASSIGNING_EXECUTE_PLANNING_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executePlanning(@javax.ws.rs.core.Context HttpHeaders headers,
                                    @ApiParam(value = "identifier of the user to execute the planning on behalf of", required = true) @QueryParam("user") String userId,
                                    @ApiParam(value = "planning definition represented as PlanningItemList", required = true) String payload); @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers,
                                      @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = {
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON),
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload);  }### Answer:
@Test public void executePlanning() { Marshaller marshaller = MarshallerFactory.getMarshaller(XSTREAM, this.getClass().getClassLoader()); PlanningItemList planningItemList = new PlanningItemList(); String payload = marshaller.marshall(planningItemList); PlanningExecutionResult expectedResult = PlanningExecutionResult.builder().build(); when(runtimeServiceBase.executePlanning(eq(planningItemList), eq(USER_ID))).thenReturn(expectedResult); String rawResult = resource.executePlanning(httpHeaders, USER_ID, payload).getEntity().toString(); String expectedResultInRawFormat = marshaller.marshall(expectedResult); assertEquals(expectedResultInRawFormat, rawResult); }