### Question:
QueryController { @GetMapping(path = "/{entityId}") public ResponseEntity<byte[]> getEntity(HttpServletRequest request, @PathVariable("entityId") String entityId, @RequestParam(value = "attrs", required = false) List<String> attrs, @RequestParam(value = "options", required = false) List<String> options) { String originalQuery = NGSIConstants.QUERY_PARAMETER_ID + "=" + entityId; HashMap<String, String[]> paramMap = new HashMap<String, String[]>(); paramMap.put(NGSIConstants.QUERY_PARAMETER_ID, new String[] { entityId }); ResponseEntity<byte[]> result = getQueryData(request, originalQuery, paramMap, attrs, null, null, null, options, false, true); if (Arrays.equals(emptyResult1, result.getBody()) || Arrays.equals(emptyResult2, result.getBody())) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(new RestResponse(ErrorType.NotFound, "Resource not found.").toJsonBytes()); } return result; }  @GetMapping(path = "/{entityId}") ResponseEntity<byte[]> getEntity(HttpServletRequest request, @PathVariable("entityId") String entityId,
			@RequestParam(value = "attrs", required = false) List<String> attrs,
			@RequestParam(value = "options", required = false) List<String> options); @GetMapping() ResponseEntity<byte[]> getAllEntity(HttpServletRequest request,
			@RequestParam(value = "attrs", required = false) List<String> attrs,
			@RequestParam(value = "limit", required = false) Integer limit,
			@RequestParam(value = "offset", required = false) Integer offset,
			@RequestParam(value = "qtoken", required = false) String qToken,
			@RequestParam(name = "options", required = false) List<String> options,
			@RequestParam(name = "services", required = false) Boolean showServices); ResponseEntity<byte[]> generateReply(HttpServletRequest request, QueryResult qResult, boolean forceArray);  }### Answer:
@Test public void getEntityTest() throws Exception { try { ResponseEntity<Object> responseEntity = ResponseEntity.status(HttpStatus.OK).header("location", "<<http: .body(response); Mockito.doReturn(entity).when(queryService).retrieveEntity(any(String.class), any(List.class), any(boolean.class), any(boolean.class)); QueryResult result = new QueryResult(entities, null, ErrorType.None, -1, true); Mockito.doReturn(result).when(queryService).getData(any(), any(), any(), any(), any(), any(), any()); mockMvc.perform(get("/ngsi-ld/v1/entities/{entityId}", "urn:ngsi-ld:Vehicle:A100").accept(AppConstants.NGB_APPLICATION_JSON)) .andExpect(status().isOk()).andExpect(jsonPath("$.id").value("urn:ngsi-ld:Vehicle:A100")); verify(queryService, times(1)).getData(any(), any(), any(), any(), any(), any(), any()); } catch (Exception e) { Assert.fail(e.getMessage()); } }