@Test
public void aggregateAuthenticationFailuresWithExceptionNotUnauthorized() {

    final DittoHeaders fooHeader = DittoHeaders.newBuilder().putHeader("foo-header", "foo").build();
    final DittoRuntimeException exceptionA =
            DittoRuntimeException.newBuilder("test:my.error", HttpStatusCode.BAD_REQUEST)
                    .dittoHeaders(fooHeader)
                    .description("do this")
                    .build();
    final DittoHeaders barHeader = DittoHeaders.newBuilder().putHeader("bar-header", "bar").build();
    final DittoRuntimeException exceptionB =
            DittoRuntimeException.newBuilder("test:my.error", HttpStatusCode.UNAUTHORIZED)
                    .dittoHeaders(barHeader)
                    .description("do that")
                    .build();
    final List<AuthenticationResult> authenticationResults =
            Arrays.asList(DefaultAuthenticationResult.failed(KNOWN_DITTO_HEADERS, exceptionA),
                    DefaultAuthenticationResult.failed(KNOWN_DITTO_HEADERS, exceptionB));
    final DittoRuntimeException dittoRuntimeException =
            underTest.aggregateAuthenticationFailures(authenticationResults);
    assertThat(dittoRuntimeException).isEqualTo(exceptionA);
}