### Question:
CommonPaymentSpiImpl extends AbstractPaymentSpi<SpiPaymentInfo, SpiPaymentInitiationResponse> implements CommonPaymentSpi { @Override public @NotNull SpiResponse<SpiGetPaymentStatusResponse> getPaymentStatusById(@NotNull SpiContextData contextData, @NotNull String acceptMediaType, @NotNull SpiPaymentInfo payment, @NotNull SpiAspspConsentDataProvider aspspConsentDataProvider) { if (MediaType.APPLICATION_XML_VALUE.equals(acceptMediaType)) { return super.getPaymentStatusById(contextData, acceptMediaType, payment, aspspConsentDataProvider); } return SpiResponse.<SpiGetPaymentStatusResponse>builder() .payload(new SpiGetPaymentStatusResponse(TransactionStatus.ACSP, null, MediaType.APPLICATION_JSON_VALUE, null, PSU_MESSAGE)) .build(); } CommonPaymentSpiImpl(GeneralPaymentService generalPaymentService); @Override @NotNull SpiResponse<SpiPaymentExecutionResponse> verifyScaAuthorisationAndExecutePaymentWithPaymentResponse(@NotNull SpiContextData contextData, @NotNull SpiScaConfirmation spiScaConfirmation, @NotNull SpiPaymentInfo payment, @NotNull SpiAspspConsentDataProvider aspspConsentDataProvider); @Override @NotNull SpiResponse<SpiPaymentConfirmationCodeValidationResponse> notifyConfirmationCodeValidation(@NotNull SpiContextData spiContextData, boolean confirmationCodeValidationResult, @NotNull SpiPaymentInfo payment, boolean isCancellation, @NotNull SpiAspspConsentDataProvider spiAspspConsentDataProvider); @Override @NotNull SpiResponse<SpiPaymentInfo> getPaymentById(@NotNull SpiContextData contextData, @NotNull String acceptMediaType, @NotNull SpiPaymentInfo payment, @NotNull SpiAspspConsentDataProvider aspspConsentDataProvider); @Override @NotNull SpiResponse<SpiGetPaymentStatusResponse> getPaymentStatusById(@NotNull SpiContextData contextData, @NotNull String acceptMediaType, @NotNull SpiPaymentInfo payment, @NotNull SpiAspspConsentDataProvider aspspConsentDataProvider);  }### Answer:
@Test void getPaymentStatusById_JSON() { String mediaType = MediaType.APPLICATION_JSON_VALUE; SpiPaymentInfo spiPaymentInfo = new SpiPaymentInfo(PAYMENT_PRODUCT); spiPaymentInfo.setPaymentType(PaymentType.SINGLE); spiPaymentInfo.setPaymentId(PAYMENT_ID); spiPaymentInfo.setPaymentStatus(TransactionStatus.ACSP); SpiGetPaymentStatusResponse spiGetPaymentStatusResponse = new SpiGetPaymentStatusResponse(spiPaymentInfo.getPaymentStatus(), null, SpiGetPaymentStatusResponse.RESPONSE_TYPE_JSON, null, PSU_MESSAGE); SpiResponse<SpiGetPaymentStatusResponse> paymentStatusById = commonPaymentSpi.getPaymentStatusById(SPI_CONTEXT_DATA, mediaType, spiPaymentInfo, spiAspspConsentDataProvider); assertEquals(spiGetPaymentStatusResponse, paymentStatusById.getPayload()); }
@Test void getPaymentStatusById_XML() { String mediaType = MediaType.APPLICATION_XML_VALUE; SpiPaymentInfo spiPaymentInfo = new SpiPaymentInfo(PAYMENT_PRODUCT); spiPaymentInfo.setPaymentType(PaymentType.SINGLE); spiPaymentInfo.setPaymentId(PAYMENT_ID); spiPaymentInfo.setPaymentStatus(TransactionStatus.ACSP); SpiGetPaymentStatusResponse spiGetPaymentStatusResponse = new SpiGetPaymentStatusResponse(spiPaymentInfo.getPaymentStatus(), null, SpiGetPaymentStatusResponse.RESPONSE_TYPE_JSON, null, PSU_MESSAGE); when(spiAspspConsentDataProvider.loadAspspConsentData()).thenReturn("".getBytes()); when(generalPaymentService.getPaymentStatusById(PaymentTypeTO.valueOf(spiPaymentInfo.getPaymentType().name()), mediaType, spiPaymentInfo.getPaymentId(), spiPaymentInfo.getPaymentStatus(), spiAspspConsentDataProvider.loadAspspConsentData())) .thenReturn(buildSpiResponse(spiGetPaymentStatusResponse)); SpiResponse<SpiGetPaymentStatusResponse> paymentStatusById = commonPaymentSpi.getPaymentStatusById(SPI_CONTEXT_DATA, mediaType, spiPaymentInfo, spiAspspConsentDataProvider); assertEquals(spiGetPaymentStatusResponse, paymentStatusById.getPayload()); }