Conditions { public static <T extends HttpMessage> Predicate<T> contentType(final String contentType, final String... contentTypes) { final Predicate<String> query = MediaTypeQuery.compile(contentType, contentTypes); return message -> query.test(message.getContentType()); } private  Conditions(); @SafeVarargs static Predicate<T> exclude(final Predicate<T>... predicates); static Predicate<T> exclude(final Collection<Predicate<T>> predicates); static Predicate<T> requestTo(final String pattern); static Predicate<T> contentType(final String contentType,
            final String... contentTypes); static Predicate<T> withoutContentType(); static Predicate<T> header(final String key, final String value); static Predicate<T> header(final String key, final Predicate<String> predicate); static Predicate<T> header(final BiPredicate<String, String> predicate);  }
@Test void contentTypeShouldMatch() { final Predicate<HttpMessage> unit = contentType("text/plain"); assertThat(unit.test(request), is(true)); }
@Test void contentTypeShouldNotMatch() { final Predicate<HttpMessage> unit = contentType("application/json"); assertThat(unit.test(request), is(false)); }