### Question:
CmsConsentController implements CmsConsentApi { @Override public ResponseEntity<ConsentStatusResponse> getConsentStatusById(String encryptedConsentId) { CmsResponse<ConsentStatus> consentStatusById = consentServiceEncrypted.getConsentStatusById(encryptedConsentId); if (consentStatusById.hasError()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } return new ResponseEntity<>(new ConsentStatusResponse(consentStatusById.getPayload()), HttpStatus.OK); }  @Override ResponseEntity<Object> createConsent(@RequestBody CmsConsent request); @Override ResponseEntity<CmsConsent> getConsentById(String encryptedConsentId); @Override ResponseEntity<ConsentStatusResponse> getConsentStatusById(String encryptedConsentId); @Override ResponseEntity<Object> updateConsentStatus(String encryptedConsentId, String status); @Override ResponseEntity<Void> findAndTerminateOldConsentsByNewConsentId(String encryptedConsentId); @Override ResponseEntity<Object> updateMultilevelScaRequired(String encryptedConsentId, boolean multilevelSca);  }### Answer:
@Test void getConsentStatusById_Success() throws Exception { when(consentServiceEncrypted.getConsentStatusById(EXTERNAL_ID)).thenReturn(CmsResponse.<ConsentStatus>builder().payload(ConsentStatus.VALID).build()); ResultActions resultActions = mockMvc.perform(MockMvcRequestBuilders.get(UriComponentsBuilder.fromPath("/api/v1/consent/{encrypted-consent-id}/status") .buildAndExpand(EXTERNAL_ID) .toUriString()) .contentType(MediaType.APPLICATION_JSON_VALUE) .content(EXTERNAL_ID)); resultActions.andExpect(status().is(HttpStatus.OK.value())) .andExpect(content().json(jsonReader.getStringFromFile(CONSENT_STATUS_RESPONSE_PATH))); }
@Test void getConsentStatusById_returnsNotFoundResponse() throws Exception { when(consentServiceEncrypted.getConsentStatusById(EXTERNAL_ID)).thenReturn(CmsResponse.<ConsentStatus>builder().error(CmsError.LOGICAL_ERROR).build()); mockMvc.perform(MockMvcRequestBuilders.get(UriComponentsBuilder.fromPath("/api/v1/consent/{encrypted-consent-id}/status") .buildAndExpand(EXTERNAL_ID) .toUriString()) .contentType(MediaType.APPLICATION_JSON_VALUE) .content(EXTERNAL_ID)).andExpect(status().is(HttpStatus.NOT_FOUND.value())); }