### Question:
PIS403ErrorMapper extends Psd2ErrorMapper<MessageError, Error403NGPIS> { @Override public Function<MessageError, Error403NGPIS> getMapper() { return this::mapToPsd2Error; }  @Override Function<MessageError, Error403NGPIS> getMapper(); @Override HttpStatus getErrorStatus();  }### Answer:
@Test void getMapper_shouldReturnCorrectErrorMapper() { Error403NGPIS expectedError = jsonReader.getObjectFromFile(ERROR_JSON_PATH, Error403NGPIS.class); when(messageService.getMessage(PRODUCT_INVALID.getName())).thenReturn("The addressed %s product is not available for the PSU"); Function<MessageError, Error403NGPIS> mapper = pis403ErrorMapper.getMapper(); Error403NGPIS actualError = mapper.apply(MESSAGE_ERROR); assertEquals(expectedError, actualError); }
@Test void getMapper_withNoTextInTppMessage_shouldGetTextFromMessageService() { when(messageService.getMessage(PRODUCT_INVALID.name())) .thenReturn(CUSTOM_ERROR_TEXT); Error403NGPIS expectedError = jsonReader.getObjectFromFile(ERROR_CUSTOM_TEXT_JSON_PATH, Error403NGPIS.class); Function<MessageError, Error403NGPIS> mapper = pis403ErrorMapper.getMapper(); Error403NGPIS actualError = mapper.apply(MESSAGE_ERROR_WITHOUT_TEXT); assertEquals(expectedError, actualError); verify(messageService).getMessage(PRODUCT_INVALID.name()); }