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