### Question:
CmsPsuPiisController implements CmsPsuPiisApi { @Override public ResponseEntity<CmsPiisConsent> getConsent(String consentId, String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String instanceId) { PsuIdData psuIdData = new PsuIdData(psuId, psuIdType, psuCorporateId, psuCorporateIdType, null); return cmsPsuPiisService.getConsent(psuIdData, consentId, instanceId) .map(con -> new ResponseEntity<>(con, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); }  @Override ResponseEntity<CmsPiisConsent> getConsent(String consentId, String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String instanceId); @Override ResponseEntity<List<CmsPiisConsent>> getConsentsForPsu(String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String instanceId); @Override ResponseEntity<Boolean> revokeConsent(String consentId, String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String instanceId);  }### Answer:
@Test void getConsent_withValidRequest_shouldReturnConsent() throws Exception { String cmsPiisConsentJson = jsonReader.getStringFromFile("json/piis/response/cms-piis-consent.json"); CmsPiisConsent cmsPiisConsent = jsonReader.getObjectFromString(cmsPiisConsentJson, CmsPiisConsent.class); when(cmsPsuPiisService.getConsent(psuIdData, CONSENT_ID, INSTANCE_ID)) .thenReturn(Optional.of(cmsPiisConsent)); mockMvc.perform(get("/psu-api/v1/piis/consents/{consent-id}", CONSENT_ID) .headers(INSTANCE_ID_HEADERS) .headers(PSU_HEADERS)) .andExpect(status().isOk()) .andExpect(content().json(cmsPiisConsentJson)); }
@Test void getConsent_withEmptyServiceResponse_shouldReturnNotFound() throws Exception { when(cmsPsuPiisService.getConsent(psuIdData, CONSENT_ID, INSTANCE_ID)) .thenReturn(Optional.empty()); mockMvc.perform(get("/psu-api/v1/piis/consents/{consent-id}", CONSENT_ID) .headers(INSTANCE_ID_HEADERS) .headers(PSU_HEADERS)) .andExpect(status().isNotFound()) .andExpect(content().bytes(EMPTY_BODY)); }