test_class.declarator: COMPLETE_OK = () -> complete(StatusCodes.OK)
test_class.modifier: private final
test_class.original_string: private final Supplier<Route> COMPLETE_OK = () -> complete(StatusCodes.OK);
test_class.type: Supplier<Route>
test_class.var_name: COMPLETE_OK
test_class.file: services/gateway/endpoints/src/test/java/org/eclipse/ditto/services/gateway/endpoints/directives/ContentTypeValidationDirectiveTest.java
test_class.identifier: ContentTypeValidationDirectiveTest
test_class.superclass: extends JUnitRouteTest
test_case.body: @Test
      public void testWithoutEntityNoNPEExpected() {
          // Arrange
          final DittoHeaders dittoHeaders = DittoHeaders.empty();
          final String type = ContentTypes.APPLICATION_JSON.mediaType().toString();
  
          final RequestContext mockedCtx = mock(RequestContext.class);
          when(mockedCtx.getRequest()).thenReturn(HttpRequest.PUT("someUrl"));
  
          // Act
          final UnsupportedMediaTypeException result =
                  catchThrowableOfType(() -> ensureValidContentType(Set.of(type), mockedCtx, dittoHeaders, COMPLETE_OK),
                          UnsupportedMediaTypeException.class);
  
          // Assert
          assertThat(result.getStatusCode()).isEqualTo(HttpStatusCode.UNSUPPORTED_MEDIA_TYPE);
      }
test_case.class_method_signature: ContentTypeValidationDirectiveTest.testWithoutEntityNoNPEExpected()
test_case.full_signature: @Test public void testWithoutEntityNoNPEExpected()
test_case.identifier: testWithoutEntityNoNPEExpected
test_case.invocations: empty toString mediaType mock thenReturn when getRequest PUT catchThrowableOfType ensureValidContentType of isEqualTo assertThat getStatusCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testWithoutEntityNoNPEExpected()
focal_class.declarator: LOGGER =
               DittoLoggerFactory.getThreadSafeLogger(ContentTypeValidationDirective.class)
focal_class.modifier: private static final
focal_class.original_string: private static final ThreadSafeDittoLogger LOGGER =
               DittoLoggerFactory.getThreadSafeLogger(ContentTypeValidationDirective.class);
focal_class.type: ThreadSafeDittoLogger
focal_class.var_name: LOGGER
focal_class.file: services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/directives/ContentTypeValidationDirective.java
focal_class.identifier: ContentTypeValidationDirective
focal_class.class_method_signature: ContentTypeValidationDirective.ContentTypeValidationDirective()
focal_class.full_signature: private  ContentTypeValidationDirective()
focal_class.identifier: ContentTypeValidationDirective
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ContentTypeValidationDirective()
focal_class.class_method_signature: ContentTypeValidationDirective.ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_class.full_signature: public static Route ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_class.identifier: ensureValidContentType
focal_class.modifiers: public static
focal_class.parameters: (final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_class.return: Route
focal_class.signature: Route ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_class.class_method_signature: ContentTypeValidationDirective.extractMediaType(final HttpRequest request)
focal_class.full_signature: private static String extractMediaType(final HttpRequest request)
focal_class.identifier: extractMediaType
focal_class.modifiers: private static
focal_class.parameters: (final HttpRequest request)
focal_class.return: String
focal_class.signature: String extractMediaType(final HttpRequest request)
focal_class.class_method_signature: ContentTypeValidationDirective.requestToLogString(final HttpRequest request)
focal_class.full_signature: private static String requestToLogString(final HttpRequest request)
focal_class.identifier: requestToLogString
focal_class.modifiers: private static
focal_class.parameters: (final HttpRequest request)
focal_class.return: String
focal_class.signature: String requestToLogString(final HttpRequest request)
focal_method.body: public static Route ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner) {
  
           final String requestsMediaType = extractMediaType(ctx.getRequest());
           if (supportedMediaTypes.contains(requestsMediaType)) {
               return inner.get();
           } else {
               if (LOGGER.isInfoEnabled()) {
                   LOGGER.withCorrelationId(dittoHeaders)
                          .info("Request rejected: unsupported media-type: <{}>  request: <{}>", requestsMediaType,
                                  requestToLogString(ctx.getRequest()));
               }
               throw UnsupportedMediaTypeException
                       .withDetailedInformationBuilder(requestsMediaType, supportedMediaTypes)
                       .dittoHeaders(dittoHeaders)
                       .build();
           }
       }
focal_method.class_method_signature: ContentTypeValidationDirective.ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_method.full_signature: public static Route ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_method.identifier: ensureValidContentType
focal_method.invocations: extractMediaType getRequest contains get isInfoEnabled info withCorrelationId requestToLogString getRequest build dittoHeaders withDetailedInformationBuilder
focal_method.modifiers: public static
focal_method.parameters: (final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)
focal_method.return: Route
focal_method.signature: Route ensureValidContentType(final Set<String> supportedMediaTypes,
               final RequestContext ctx,
               final DittoHeaders dittoHeaders,
               final Supplier<Route> inner)