### Question:
PaymentInitiationHeadersBuilder extends AbstractHeadersBuilder { public ResponseHeaders buildInitiatePaymentHeaders(@Nullable String authorisationId, @NotNull String selfLink, @NotNull NotificationModeResponseHeaders notificationHeaders) { ResponseHeaders.ResponseHeadersBuilder responseHeadersBuilder = ResponseHeaders.builder() .notificationSupport(notificationHeaders.getAspspNotificationSupport()) .notificationContent(notificationHeaders.getAspspNotificationContent()); if (authorisationId == null) { return responseHeadersBuilder .location(selfLink) .build(); } ScaApproach scaApproach = scaApproachResolver.getScaApproach(authorisationId); return responseHeadersBuilder .aspspScaApproach(scaApproach) .location(selfLink) .build(); } @Autowired  PaymentInitiationHeadersBuilder(ScaApproachResolver scaApproachResolver); ResponseHeaders buildInitiatePaymentHeaders(@Nullable String authorisationId, @NotNull String selfLink, @NotNull NotificationModeResponseHeaders notificationHeaders);  }### Answer:
@Test void buildInitiatePaymentHeaders_withAuthorisationId_shouldReturnLocationAndScaApproachFromAuthorisation() { when(scaApproachResolver.getScaApproach(AUTHORISATION_ID)) .thenReturn(SCA_APPROACH); HttpHeaders expectedHttpHeaders = new HttpHeaders(); expectedHttpHeaders.add(LOCATION_HEADER, SELF_LINK); expectedHttpHeaders.add(ASPSP_SCA_APPROACH_HEADER, SCA_APPROACH.name()); NotificationModeResponseHeaders responseHeadersModel = new NotificationModeResponseHeaders(null, null); ResponseHeaders responseHeaders = paymentInitiationHeadersBuilder.buildInitiatePaymentHeaders(AUTHORISATION_ID, SELF_LINK, responseHeadersModel); verify(scaApproachResolver, never()).resolveScaApproach(); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }
@Test void buildInitiatePaymentHeaders_withoutAuthorisationId_shouldReturnLocationOnly() { HttpHeaders expectedHttpHeaders = new HttpHeaders(); expectedHttpHeaders.add(LOCATION_HEADER, SELF_LINK); NotificationModeResponseHeaders responseHeadersModel = new NotificationModeResponseHeaders(null, null); ResponseHeaders responseHeaders = paymentInitiationHeadersBuilder.buildInitiatePaymentHeaders(null, SELF_LINK, responseHeadersModel); verify(scaApproachResolver, never()).getScaApproach(any()); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }