View Javadoc
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  
11  package org.eclipse.jgit.http.server;
12  
13  import static org.junit.Assert.assertFalse;
14  import static org.junit.Assert.assertTrue;
15  
16  import org.junit.Test;
17  
18  public class ServletUtilsTest {
19  	@Test
20  	public void testAcceptGzip() {
21  		assertFalse(ServletUtils.acceptsGzipEncoding((String) null));
22  		assertFalse(ServletUtils.acceptsGzipEncoding(""));
23  
24  		assertTrue(ServletUtils.acceptsGzipEncoding("gzip"));
25  		assertTrue(ServletUtils.acceptsGzipEncoding("deflate,gzip"));
26  		assertTrue(ServletUtils.acceptsGzipEncoding("gzip,deflate"));
27  
28  		assertFalse(ServletUtils.acceptsGzipEncoding("gzip(proxy)"));
29  		assertFalse(ServletUtils.acceptsGzipEncoding("proxy-gzip"));
30  	}
31  }