### Question:
RegistryController { @PatchMapping("{registrationId}") public ResponseEntity<byte[]> updateCSource(HttpServletRequest request, @PathVariable("registrationId") String registrationId, @RequestBody String payload) { try { HttpUtils.doPreflightCheck(request, payload); logger.debug("update CSource() ::" + registrationId); String resolved = httpUtils.expandPayload(request, payload, AppConstants.CSOURCE_URL_ID); csourceService.updateCSourceRegistration(registrationId, resolved); logger.debug("update CSource request completed::" + registrationId); return ResponseEntity.noContent().build(); } catch (ResponseException exception) { return ResponseEntity.status(exception.getHttpStatus()).body(new RestResponse(exception).toJsonBytes()); } catch (Exception e) { e.printStackTrace(); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(new RestResponse(ErrorType.InternalError, e.getLocalizedMessage()).toJsonBytes()); } }  @GetMapping ResponseEntity<byte[]> discoverCSource(HttpServletRequest request,
			@RequestParam HashMap<String, String> queryMap); @PostMapping ResponseEntity<byte[]> registerCSource(HttpServletRequest request,
			@RequestBody(required = false) String payload); @GetMapping("{registrationId}") ResponseEntity<byte[]> getCSourceById(HttpServletRequest request,
			@PathVariable("registrationId") String registrationId); @PatchMapping("{registrationId}") ResponseEntity<byte[]> updateCSource(HttpServletRequest request,
			@PathVariable("registrationId") String registrationId, @RequestBody String payload); @DeleteMapping("{registrationId}") ResponseEntity<byte[]> deleteCSource(@PathVariable("registrationId") String registrationId);  }### Answer:
@Test public void updateCSourceTest() { try { when(csourceService.updateCSourceRegistration("urn:ngsi-ld:ContextSourceRegistration:csr1a3458", updatePayload)).thenReturn(true); mockMvc.perform(patch("/ngsi-ld/v1/csourceRegistrations/{registrationId}", "urn:ngsi-ld:ContextSourceRegistration:csr1a3458") .contentType(AppConstants.NGB_APPLICATION_JSONLD).content(payload)) .andExpect(status().isNoContent()).andDo(print()); verify(csourceService, times(1)).updateCSourceRegistration(any(), any()); } catch (Exception e) { Assert.fail(e.getMessage()); e.printStackTrace(); } }