URLHelper { public static InputStream connect(URLString loc) throws IOException { if (loc.getProtocol() == null || "file".equals(loc.getProtocol())) { return connectToFile(loc.getFile()); } URL url = new URL(loc.toString()); URLConnection conn = url.openConnection(); return conn.getInputStream(); }  static InputStream connect(URLString loc); static InputStream connect(String loc); static Map<String, String> queryStringToMap(String queryString, String charset);  }
@Test public void testConnectLocal_URLString() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_LOCAL); try (InputStream in = connect(new URLString(loc))) { assertNotNull(in); } }
@Test public void testConnectLocalResource_URLString() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_CLASSPATH); try (InputStream in = connect(new URLString(loc))) { assertNotNull(in); } }
@Test public void testConnectRemote_URLString() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_REMOTE); try (InputStream in = connect(new URLString(loc))) { assertNotNull(in); } }
@Test(expected = IOException.class) public void testConnectLocal_String_DoesNotExist() throws Exception { GuidGenerator g = new GuidGenerator(); connect("file: }
@Test public void testConnectLocal_String() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_LOCAL); try (InputStream in = connect(loc)) { assertNotNull(in); } }
@Test public void testConnectLocalResource_String() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_CLASSPATH); try (InputStream in = connect(loc)) { assertNotNull(in); } }
@Test public void testConnectRemote_String() throws Exception { String loc = BaseCase.PROPERTIES.getProperty(KEY_REMOTE); try (InputStream in = connect(loc)) { assertNotNull(in); } }