### Question:
PIIS403ErrorMapper extends Psd2ErrorMapper<MessageError, Error403NGPIIS> { @Override public Function<MessageError, Error403NGPIIS> getMapper() { return this::mapToPsd2Error; }  @Override Function<MessageError, Error403NGPIIS> getMapper(); @Override HttpStatus getErrorStatus();  }### Answer:
@Test void getMapper_shouldReturnCorrectErrorMapper() { when(messageService.getMessage(CONSENT_UNKNOWN_403.name())) .thenReturn("Some %s"); Error403NGPIIS expectedError = jsonReader.getObjectFromFile(ERROR_JSON_PATH, Error403NGPIIS.class); Function<MessageError, Error403NGPIIS> mapper = piis403ErrorMapper.getMapper(); Error403NGPIIS actualError = mapper.apply(MESSAGE_ERROR); assertEquals(expectedError, actualError); }
@Test void getMapper_withNoTextInTppMessage_shouldGetTextFromMessageService() { when(messageService.getMessage(CONSENT_UNKNOWN_403.name())) .thenReturn(CUSTOM_ERROR_TEXT); Error403NGPIIS expectedError = jsonReader.getObjectFromFile(ERROR_CUSTOM_TEXT_JSON_PATH, Error403NGPIIS.class); Function<MessageError, Error403NGPIIS> mapper = piis403ErrorMapper.getMapper(); Error403NGPIIS actualError = mapper.apply(MESSAGE_ERROR_WITHOUT_TEXT); assertEquals(expectedError, actualError); verify(messageService).getMessage(CONSENT_UNKNOWN_403.name()); }