### Question:
CmsPsuPiisController implements CmsPsuPiisApi { @Override public ResponseEntity<List<CmsPiisConsent>> getConsentsForPsu(String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String instanceId) { PsuIdData psuIdData = new PsuIdData(psuId, psuIdType, psuCorporateId, psuCorporateIdType, null); return new ResponseEntity<>(cmsPsuPiisService.getConsentsForPsu(psuIdData, instanceId), HttpStatus.OK); }  @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 getConsentsForPsu_withValidRequest_shouldReturnList() throws Exception { String cmsPiisConsentsJson = jsonReader.getStringFromFile("json/piis/response/cms-piis-consent-list.json"); List<CmsPiisConsent> cmsPiisConsents = jsonReader.getListFromString(cmsPiisConsentsJson, CmsPiisConsent.class); when(cmsPsuPiisService.getConsentsForPsu(psuIdData, INSTANCE_ID)) .thenReturn(cmsPiisConsents); mockMvc.perform(get("/psu-api/v1/piis/consents") .headers(INSTANCE_ID_HEADERS) .headers(PSU_HEADERS)) .andExpect(status().isOk()) .andExpect(content().json(cmsPiisConsentsJson)); }
@Test void getConsentsForPsu_withEmptyListServiceResponse_shouldReturnList() throws Exception { String emptyListJson = "[]"; when(cmsPsuPiisService.getConsentsForPsu(psuIdData, INSTANCE_ID)) .thenReturn(Collections.emptyList()); mockMvc.perform(get("/psu-api/v1/piis/consents") .headers(INSTANCE_ID_HEADERS) .headers(PSU_HEADERS)) .andExpect(status().isOk()) .andExpect(content().json(emptyListJson)); }