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