You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServletUtilsTest.java 962B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (C) 2011, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.http.server;
  11. import static org.junit.Assert.assertFalse;
  12. import static org.junit.Assert.assertTrue;
  13. import org.junit.Test;
  14. public class ServletUtilsTest {
  15. @Test
  16. public void testAcceptGzip() {
  17. assertFalse(ServletUtils.acceptsGzipEncoding((String) null));
  18. assertFalse(ServletUtils.acceptsGzipEncoding(""));
  19. assertTrue(ServletUtils.acceptsGzipEncoding("gzip"));
  20. assertTrue(ServletUtils.acceptsGzipEncoding("deflate,gzip"));
  21. assertTrue(ServletUtils.acceptsGzipEncoding("gzip,deflate"));
  22. assertFalse(ServletUtils.acceptsGzipEncoding("gzip(proxy)"));
  23. assertFalse(ServletUtils.acceptsGzipEncoding("proxy-gzip"));
  24. }
  25. }