test_class.declarator: KNOWN_DITTO_HEADERS = DittoHeaders.empty()
test_class.modifier: private static final
test_class.original_string: private static final DittoHeaders KNOWN_DITTO_HEADERS = DittoHeaders.empty();
test_class.type: DittoHeaders
test_class.var_name: KNOWN_DITTO_HEADERS
test_class.declarator: underTest
test_class.modifier: private
test_class.original_string: private DefaultAuthenticationFailureAggregator underTest;
test_class.type: DefaultAuthenticationFailureAggregator
test_class.var_name: underTest
test_class.file: services/gateway/security/src/test/java/org/eclipse/ditto/services/gateway/security/authentication/DefaultAuthenticationFailureAggregatorTest.java
test_class.identifier: DefaultAuthenticationFailureAggregatorTest
test_case.body: @Test
      public void aggregateAuthenticationFailuresWitNestedDittoRuntimeExceptionWithoutDescription() {
          final DittoRuntimeException expectedException =
                  DittoRuntimeException.newBuilder("test:my.error", HttpStatusCode.UNAUTHORIZED).build();
          final IllegalStateException reasonOfFailure = new IllegalStateException("Not a DRE", expectedException);
          final List<AuthenticationResult> authenticationResults =
                  Collections.singletonList(DefaultAuthenticationResult.failed(KNOWN_DITTO_HEADERS, reasonOfFailure));
  
          assertThatExceptionOfType(IllegalArgumentException.class)
                  .isThrownBy(() -> underTest.aggregateAuthenticationFailures(authenticationResults));
      }
test_case.class_method_signature: DefaultAuthenticationFailureAggregatorTest.aggregateAuthenticationFailuresWitNestedDittoRuntimeExceptionWithoutDescription()
test_case.full_signature: @Test public void aggregateAuthenticationFailuresWitNestedDittoRuntimeExceptionWithoutDescription()
test_case.identifier: aggregateAuthenticationFailuresWitNestedDittoRuntimeExceptionWithoutDescription
test_case.invocations: build newBuilder singletonList failed isThrownBy assertThatExceptionOfType aggregateAuthenticationFailures
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void aggregateAuthenticationFailuresWitNestedDittoRuntimeExceptionWithoutDescription()
focal_class.declarator: AGGREGATED_AUTH_FAILURE_MESSAGE =
              "Multiple authentication mechanisms were applicable but none succeeded."
focal_class.modifier: private static final
focal_class.original_string: private static final String AGGREGATED_AUTH_FAILURE_MESSAGE =
              "Multiple authentication mechanisms were applicable but none succeeded.";
focal_class.type: String
focal_class.var_name: AGGREGATED_AUTH_FAILURE_MESSAGE
focal_class.declarator: AGGREGATED_AUTH_FAILURE_DESCRIPTION_PREFIX =
              "For a successful authentication see the following suggestions: "
focal_class.modifier: private static final
focal_class.original_string: private static final String AGGREGATED_AUTH_FAILURE_DESCRIPTION_PREFIX =
              "For a successful authentication see the following suggestions: ";
focal_class.type: String
focal_class.var_name: AGGREGATED_AUTH_FAILURE_DESCRIPTION_PREFIX
focal_class.declarator: INSTANCE = new DefaultAuthenticationFailureAggregator()
focal_class.modifier: private static final
focal_class.original_string: private static final DefaultAuthenticationFailureAggregator INSTANCE = new DefaultAuthenticationFailureAggregator();
focal_class.type: DefaultAuthenticationFailureAggregator
focal_class.var_name: INSTANCE
focal_class.file: services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/DefaultAuthenticationFailureAggregator.java
focal_class.identifier: DefaultAuthenticationFailureAggregator
focal_class.interfaces: implements AuthenticationFailureAggregator
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.DefaultAuthenticationFailureAggregator()
focal_class.full_signature: private  DefaultAuthenticationFailureAggregator()
focal_class.identifier: DefaultAuthenticationFailureAggregator
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  DefaultAuthenticationFailureAggregator()
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.getInstance()
focal_class.full_signature: static DefaultAuthenticationFailureAggregator getInstance()
focal_class.identifier: getInstance
focal_class.modifiers: static
focal_class.parameters: ()
focal_class.return: DefaultAuthenticationFailureAggregator
focal_class.signature: DefaultAuthenticationFailureAggregator getInstance()
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)
focal_class.full_signature: @Override public DittoRuntimeException aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)
focal_class.identifier: aggregateAuthenticationFailures
focal_class.modifiers: @Override public
focal_class.parameters: (final List<AuthenticationResult> failedAuthResults)
focal_class.return: DittoRuntimeException
focal_class.signature: DittoRuntimeException aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.getDittoRuntimeExceptionReasonsWithDescription(
              final Collection<AuthenticationResult> failedAuthenticationResults)
focal_class.full_signature: private static List<DittoRuntimeException> getDittoRuntimeExceptionReasonsWithDescription(
              final Collection<AuthenticationResult> failedAuthenticationResults)
focal_class.identifier: getDittoRuntimeExceptionReasonsWithDescription
focal_class.modifiers: private static
focal_class.parameters: (
              final Collection<AuthenticationResult> failedAuthenticationResults)
focal_class.return: List<DittoRuntimeException>
focal_class.signature: List<DittoRuntimeException> getDittoRuntimeExceptionReasonsWithDescription(
              final Collection<AuthenticationResult> failedAuthenticationResults)
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.toDittoRuntimeException(final Throwable throwable)
focal_class.full_signature: @Nullable private static DittoRuntimeException toDittoRuntimeException(final Throwable throwable)
focal_class.identifier: toDittoRuntimeException
focal_class.modifiers: @Nullable private static
focal_class.parameters: (final Throwable throwable)
focal_class.return: DittoRuntimeException
focal_class.signature: DittoRuntimeException toDittoRuntimeException(final Throwable throwable)
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.buildAggregatedDescriptionFromDittoRuntimeExceptions(
              final Collection<DittoRuntimeException> reasonsOfFailure)
focal_class.full_signature: private static String buildAggregatedDescriptionFromDittoRuntimeExceptions(
              final Collection<DittoRuntimeException> reasonsOfFailure)
focal_class.identifier: buildAggregatedDescriptionFromDittoRuntimeExceptions
focal_class.modifiers: private static
focal_class.parameters: (
              final Collection<DittoRuntimeException> reasonsOfFailure)
focal_class.return: String
focal_class.signature: String buildAggregatedDescriptionFromDittoRuntimeExceptions(
              final Collection<DittoRuntimeException> reasonsOfFailure)
focal_class.class_method_signature: DefaultAuthenticationFailureAggregator.buildAggregatedHeaders(final Iterable<DittoRuntimeException> reasonsOfFailure)
focal_class.full_signature: private static DittoHeaders buildAggregatedHeaders(final Iterable<DittoRuntimeException> reasonsOfFailure)
focal_class.identifier: buildAggregatedHeaders
focal_class.modifiers: private static
focal_class.parameters: (final Iterable<DittoRuntimeException> reasonsOfFailure)
focal_class.return: DittoHeaders
focal_class.signature: DittoHeaders buildAggregatedHeaders(final Iterable<DittoRuntimeException> reasonsOfFailure)
focal_method.body: @Override
      public DittoRuntimeException aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults) {
          final List<DittoRuntimeException> reasonsOfFailure = getDittoRuntimeExceptionReasonsWithDescription(failedAuthResults);
  
          if (reasonsOfFailure.isEmpty()) {
              final String msgPattern = "The failed authentication results did not contain any failure reason of type " +
                      "<{0}> containing a description!";
              final String message = MessageFormat.format(msgPattern, DittoRuntimeException.class.getSimpleName());
              throw new IllegalArgumentException(message);
          }
  
          if (1 == reasonsOfFailure.size()) {
              return reasonsOfFailure.get(0);
          }
  
          return reasonsOfFailure.stream()
                  .filter(reasonOfFailure -> !HttpStatusCode.UNAUTHORIZED.equals(reasonOfFailure.getStatusCode()))
                  .findFirst()
                  .orElseGet(() -> GatewayAuthenticationFailedException.newBuilder(AGGREGATED_AUTH_FAILURE_MESSAGE)
                          .description(buildAggregatedDescriptionFromDittoRuntimeExceptions(reasonsOfFailure))
                          .dittoHeaders(buildAggregatedHeaders(reasonsOfFailure))
                          .build());
      }
focal_method.class_method_signature: DefaultAuthenticationFailureAggregator.aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)
focal_method.full_signature: @Override public DittoRuntimeException aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)
focal_method.identifier: aggregateAuthenticationFailures
focal_method.invocations: getDittoRuntimeExceptionReasonsWithDescription isEmpty format getSimpleName size get orElseGet findFirst filter stream equals getStatusCode build dittoHeaders description newBuilder buildAggregatedDescriptionFromDittoRuntimeExceptions buildAggregatedHeaders
focal_method.modifiers: @Override public
focal_method.parameters: (final List<AuthenticationResult> failedAuthResults)
focal_method.return: DittoRuntimeException
focal_method.signature: DittoRuntimeException aggregateAuthenticationFailures(final List<AuthenticationResult> failedAuthResults)