### Question:
PsuIdTypeHeaderInterceptor implements Interceptor { @Override public Request.Builder preHandle(Request.Builder builder) { if (builder.headers().get(RequestHeaders.PSU_ID) != null && builder.headers().get(RequestHeaders.PSU_ID_TYPE) == null) { setPsuIdType(builder); } return builder; }  @Override Request.Builder preHandle(Request.Builder builder);  }### Answer:
@Test void setsPsuIdTypeForDeutscheBankInGermanyWhenPsuIdIsPresent() { builder.uri("https: interceptor.preHandle(builder); assertEquals("DE_ONLB_DB", builder.headers().get(RequestHeaders.PSU_ID_TYPE)); }
@Test void doesNothingWhenPsuIdIsNotSet() { builder.uri("https: builder.headers().remove(RequestHeaders.PSU_ID); interceptor.preHandle(builder); assertNull(builder.headers().get(RequestHeaders.PSU_ID_TYPE)); }
@Test void doesNothingIfPsuIdTypeIsAlreadySet() { builder.uri("https: String psuIdTypeOverride = "PSU_ID_TYPE_OVERRIDE"; builder.header(RequestHeaders.PSU_ID_TYPE, psuIdTypeOverride); interceptor.preHandle(builder); assertEquals(psuIdTypeOverride, builder.headers().get(RequestHeaders.PSU_ID_TYPE)); }
@Test void setsPsuIdTypeForPostbankInGermany() { builder.uri("https: interceptor.preHandle(builder); assertEquals("DE_ONLB_POBA", builder.headers().get(RequestHeaders.PSU_ID_TYPE)); }
@Test void hasBoundsChecksInCasePathIsTooShort() { builder.uri("https: try { interceptor.preHandle(builder); } catch (IndexOutOfBoundsException e) { fail(); } }
@Test void setsPsuIdTypeForNorisbankInGermany() { builder.uri("https: interceptor.preHandle(builder); assertEquals("DE_ONLB_NORIS", builder.headers().get(RequestHeaders.PSU_ID_TYPE)); }