### Question:
PaymentModelMapperPsd2 { public PaymentInitiationParameters mapToPaymentRequestParameters(String paymentProduct, String paymentService, byte[] tpPSignatureCertificate, String tpPRedirectURI, String tpPNokRedirectURI, boolean tppExplicitAuthorisationPreferred, PsuIdData psuData, TppNotificationData tppNotificationData, String tppBrandLoggingInformation, String instanceId) { PaymentInitiationParameters parameters = new PaymentInitiationParameters(); parameters.setPaymentType(PaymentType.getByValue(paymentService).orElseThrow(() -> new WrongPaymentTypeException(paymentService))); parameters.setPaymentProduct(Optional.ofNullable(paymentProduct).orElseThrow(() -> new IllegalArgumentException("Unsupported payment product"))); parameters.setQwacCertificate(new String(Optional.ofNullable(tpPSignatureCertificate).orElse(new byte[]{}), StandardCharsets.UTF_8)); parameters.setTppRedirectUri(tppRedirectUriMapper.mapToTppRedirectUri(tpPRedirectURI, tpPNokRedirectURI)); parameters.setTppExplicitAuthorisationPreferred(tppExplicitAuthorisationPreferred); parameters.setPsuData(psuData); parameters.setTppNotificationData(tppNotificationData); parameters.setTppBrandLoggingInformation(tppBrandLoggingInformation); parameters.setInstanceId(instanceId); return parameters; }  Object mapToGetPaymentResponse(CommonPayment commonPayment); PaymentInitiationStatusResponse200Json mapToStatusResponseJson(GetPaymentStatusResponse response); byte[] mapToStatusResponseRaw(GetPaymentStatusResponse response); PaymentInitationRequestResponse201 mapToPaymentInitiationResponse(PaymentInitiationResponse response); PaymentInitiationParameters mapToPaymentRequestParameters(String paymentProduct, String paymentService, byte[] tpPSignatureCertificate, String tpPRedirectURI,
                                                                     String tpPNokRedirectURI, boolean tppExplicitAuthorisationPreferred, PsuIdData psuData,
                                                                     TppNotificationData tppNotificationData, String tppBrandLoggingInformation, String instanceId); PisPaymentCancellationRequest mapToPaymentCancellationRequest(String paymentProduct, String paymentService, String paymentId,
                                                                         Boolean tppExplicitAuthorisationPreferred,
                                                                         String tpPRedirectURI, String tpPNokRedirectURI); PaymentInitiationCancelResponse202 mapToPaymentInitiationCancelResponse(CancelPaymentResponse cancelPaymentResponse);  }### Answer:
@Test void mapToPaymentRequestParameters() { TppNotificationData tppNotificationData = new TppNotificationData(NOTIFICATION_MODES, "notification.uri"); PaymentInitiationParameters expected = new PaymentInitiationParameters(); expected.setPaymentProduct(PAYMENT_PRODUCT); expected.setPaymentType(PaymentType.SINGLE); expected.setQwacCertificate("certificate"); expected.setTppRedirectUri(new TppRedirectUri("ok.uri", "nok.uri")); expected.setTppExplicitAuthorisationPreferred(true); expected.setPsuData(PSU_ID_DATA); expected.setTppNotificationData(tppNotificationData); expected.setTppBrandLoggingInformation(TPP_BRAND_LOGGING_INFORMATION); PaymentInitiationParameters actual = mapper.mapToPaymentRequestParameters(PAYMENT_PRODUCT, PaymentType.SINGLE.getValue(), "certificate".getBytes(), "ok.uri", "nok.uri", true, PSU_ID_DATA, tppNotificationData, TPP_BRAND_LOGGING_INFORMATION, null); assertEquals(expected, actual); }
@Test void mapToPaymentRequestParameters_incorrect_payment_type_throw_wrong_payment_type_exception() { TppNotificationData tppNotificationData = new TppNotificationData(NOTIFICATION_MODES, "notification.uri"); assertThrows(WrongPaymentTypeException.class, () -> mapper.mapToPaymentRequestParameters(PAYMENT_PRODUCT, "incorrect payment type", "certificate".getBytes(), "ok.uri", "nok.uri", true, PSU_ID_DATA, tppNotificationData, TPP_BRAND_LOGGING_INFORMATION, null)); }