### Question:
JobExecutionController { @Operation(summary = "Get all Spring batch job execution by ID") @GetMapping("/{id}") public JobExecutionResource get(@PathVariable long id) { return new JobExecutionResource(jobExecutionService.jobExecution(id)); }  @Operation(summary = "Get all Spring batch job execution by ID") @GetMapping("/{id}") JobExecutionResource get(@PathVariable long id); @Operation(summary = "Find Spring batch job executions by job name and exit code") @GetMapping CollectionModel<JobExecutionResource> all(
            @RequestParam(value = "jobName", required = false) String jobName,
            @RequestParam(value = "exitCode", required = false) String exitCode,
            @RequestParam(value = "limitPerJob", defaultValue = "3") Integer limitPerJob); @Operation(summary = "Start a Spring Batch job execution") @PostMapping ResponseEntity<JobExecutionResource> put(@RequestBody JobConfig jobConfig);  }### Answer:
@Test public void jobExecutionById() throws Exception { when(jobExplorer.getJobExecution(je11.getId())).thenReturn(je11); mockMvc.perform(get("/jobExecutions/" + je11.getId())) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(1))); }
@Test public void jobExecutionByIdNotFound() throws Exception { mockMvc.perform(get("/jobExecutions/" + 10)) .andExpect(status().isNotFound()) .andExpect(content().string("{\"status\":\"404 NOT_FOUND\",\"message\":\"Could not find job execution with ID 10\",\"exception\":\"NoSuchJobExecutionException\",\"detail\":\"\"}")); }
@Test public void jobExecutions() throws Exception { mockMvc.perform(get("/jobExecutions")) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(5))); }
@Test public void successfulJobExecutions() throws Exception { mockMvc.perform(get("/jobExecutions?exitCode=COMPLETED")) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(3))); }
@Test public void failedJobExecutions() throws Exception { mockMvc.perform(get("/jobExecutions?exitCode=FAILED")) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(3))); }
@Test public void successfulJobExecutionsPerJob() throws Exception { mockMvc.perform(get("/jobExecutions?jobName=j2&exitCode=COMPLETED")) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(2))); }
@Test public void successfulJobExecutionsPerJobAndLimited() throws Exception { mockMvc.perform(get("/jobExecutions?jobName=j2&exitCode=COMPLETED&limitPerJob=1")) .andExpect(status().isOk()) .andExpect(jsonPath("$..jobExecution", hasSize(1))); }