Debian Codegraph @

src/test/java/com/github/markusbernhardt/proxy/search/browser/IeTest.java

raw symbols SCIP
1 package com.github.markusbernhardt.proxy.search.browser;
2
3 import static org.junit.Assert.assertFalse;
4 import static org.junit.Assert.assertTrue;
5
6 import java.net.MalformedURLException;
7 import java.net.URISyntaxException;
8 import java.net.URL;
9
10 import org.junit.Test;
11
12 import com.github.markusbernhardt.proxy.TestUtil;
13 import com.github.markusbernhardt.proxy.search.browser.ie.IELocalByPassFilter;
14 import com.github.markusbernhardt.proxy.search.browser.ie.IEProxySearchStrategy;
15 import com.github.markusbernhardt.proxy.util.PlatformUtil;
16 import com.github.markusbernhardt.proxy.util.ProxyException;
17 import com.github.markusbernhardt.proxy.util.UriFilter;
18 import com.github.markusbernhardt.proxy.util.PlatformUtil.Platform;
19
20 /*****************************************************************************
21 * Unit tests for the InternetExplorer search. Only limited testing as this only
22 * runs on windwos and needs a installed IE and IE proxy settings written to the
23 * registry.
24 *
25 * @author Markus Bernhardt, Copyright 2016
26 * @author Bernd Rosstauscher, Copyright 2009
27 ****************************************************************************/
28
29 public class IeTest {
30
31 /*************************************************************************
32 * Test method.
33 *
34 * @throws ProxyException
35 * on proxy detection error.
36 ************************************************************************/
37 @Test
38 public void testInvoke() throws ProxyException {
39 if (Platform.WIN.equals(PlatformUtil.getCurrentPlattform())) {
40 IEProxySearchStrategy st = new IEProxySearchStrategy();
41
42 // Try at least to invoke it and test if the dll does not crash
43 st.getProxySelector();
44 }
45 }
46
47 /*************************************************************************
48 * Test method.
49 *
50 * @throws ProxyException
51 * on proxy detection error.
52 * @throws URISyntaxException
53 * if url syntax is wrong.
54 * @throws MalformedURLException
55 * on wrong url format.
56 ************************************************************************/
57 @Test
58 public void testLocalByPassFilter() throws ProxyException, MalformedURLException, URISyntaxException {
59 UriFilter filter = new IELocalByPassFilter();
60 assertTrue(filter.accept(TestUtil.LOCAL_TEST_URI));
61 assertFalse(filter.accept(TestUtil.HTTP_TEST_URI));
62 assertFalse(filter.accept(new URL("http://123.45.55.6").toURI()));
63 }
64
65 }