@Test
public void testNonValidContentType() {

    // Arrange
    final DittoHeaders dittoHeaders = DittoHeaders.empty();
    final String type = MediaTypes.APPLICATION_JSON.toString();
    final ContentType differentType = ContentTypes.APPLICATION_X_WWW_FORM_URLENCODED;
    final RequestContext mockedCtx = mock(RequestContext.class);
    when(mockedCtx.getRequest())
            .thenReturn(HttpRequest.PUT("someUrl").withEntity(differentType,"something".getBytes()));
    // Act
    final UnsupportedMediaTypeException result =
            catchThrowableOfType(() -> ensureValidContentType(Set.of(type), mockedCtx, dittoHeaders, COMPLETE_OK),
                    UnsupportedMediaTypeException.class);
    // Assert
    assertThat(result).hasMessageContaining(differentType.toString());
    assertThat(result.getStatusCode()).isEqualTo(HttpStatusCode.UNSUPPORTED_MEDIA_TYPE);
}