### Question:
ConsentHeadersBuilder extends AbstractHeadersBuilder { public ResponseHeaders buildCreateConsentHeaders(@Nullable String authorisationId, @NotNull String selfLink, @NotNull NotificationModeResponseHeaders notificationHeaders) { ResponseHeaders.ResponseHeadersBuilder responseHeadersBuilder = ResponseHeaders.builder(); buildNotificationHeaders(responseHeadersBuilder, notificationHeaders); buildCreateConsentHeaders(responseHeadersBuilder, authorisationId, selfLink); return responseHeadersBuilder.build(); } @Autowired  ConsentHeadersBuilder(ScaApproachResolver scaApproachResolver); ResponseHeaders buildCreateConsentHeaders(@Nullable String authorisationId, @NotNull String selfLink, @NotNull NotificationModeResponseHeaders notificationHeaders); ResponseHeaders buildCreateConsentHeaders(@Nullable String authorisationId, @NotNull String selfLink);  }### Answer:
@Test void buildCreateConsentHeaders_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 = consentHeadersBuilder.buildCreateConsentHeaders(AUTHORISATION_ID, SELF_LINK, responseHeadersModel); verify(scaApproachResolver, never()).resolveScaApproach(); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }
@Test void buildCreateConsentHeaders_withoutAuthorisationId_shouldReturnLocationOnly() { HttpHeaders expectedHttpHeaders = new HttpHeaders(); expectedHttpHeaders.add(LOCATION_HEADER, SELF_LINK); NotificationModeResponseHeaders responseHeadersModel = new NotificationModeResponseHeaders(null, null); ResponseHeaders responseHeaders = consentHeadersBuilder.buildCreateConsentHeaders(null, SELF_LINK, responseHeadersModel); verify(scaApproachResolver, never()).getScaApproach(any()); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }
@Test void buildCreateConsentHeaders_short_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()); ResponseHeaders responseHeaders = consentHeadersBuilder.buildCreateConsentHeaders(AUTHORISATION_ID, SELF_LINK); verify(scaApproachResolver, never()).resolveScaApproach(); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }
@Test void buildCreateConsentHeaders_short_withoutAuthorisationId_shouldReturnLocationOnly() { HttpHeaders expectedHttpHeaders = new HttpHeaders(); expectedHttpHeaders.add(LOCATION_HEADER, SELF_LINK); ResponseHeaders responseHeaders = consentHeadersBuilder.buildCreateConsentHeaders(null, SELF_LINK); verify(scaApproachResolver, never()).getScaApproach(any()); HttpHeaders actualHttpHeaders = responseHeaders.getHttpHeaders(); assertEquals(expectedHttpHeaders, actualHttpHeaders); }