GZipPredicate implements Predicate { @Override public boolean resolve(HttpServerExchange exchange) { HeaderMap headers = exchange.getResponseHeaders(); return resolve(headers); }  @Override boolean resolve(HttpServerExchange exchange);  }
@Test void resolve() { var headers = new HeaderMap(); headers.put(Headers.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); headers.put(Headers.CONTENT_LENGTH, 210); assertThat(predicate.resolve(headers)).isTrue(); }
@Test void resolveWithChunk() { var headers = new HeaderMap(); headers.put(Headers.CONTENT_TYPE, ContentType.TEXT_CSS.toString()); assertThat(predicate.resolve(headers)).isTrue(); }
@Test void skipIfContentTypeNotMatch() { var headers = new HeaderMap(); headers.put(Headers.CONTENT_TYPE, "image/png"); assertThat(predicate.resolve(headers)).isFalse(); }
@Test void skipIfContentLengthIsTooSmall() { var headers = new HeaderMap(); headers.put(Headers.CONTENT_TYPE, ContentType.TEXT_PLAIN.toString()); headers.put(Headers.CONTENT_LENGTH, 10); assertThat(predicate.resolve(headers)).isFalse(); }
@Test void skipWithoutContentType() { var headers = new HeaderMap(); assertThat(predicate.resolve(headers)).isFalse(); }