core/src/test/java/org/apache/commons/vfs2/test/UrlTests.java
/**
     * Tests that unknown files have no content.
     */
Tests that unknown files have no content.
Tests that unknown files have no content .
public void testUnknownURL() throws Exception
    {
        final FileObject unknownFile = getReadFolder().resolveFile("unknown-file");
        assertFalse(unknownFile.exists());
        final URLConnection connection = unknownFile.getURL().openConnection();
        try
        {
            connection.getInputStream();
            fail();
        }
        catch (final IOException e)
        {
            assertSameMessage("vfs.provider/read-not-file.error", unknownFile, e);
        }
        assertEquals(-1, connection.getContentLength());
    }
public void testUnknownURL ( ) throws Exception { final FileObject unknownFile = getReadFolder ( ) . resolveFile ( "unknown-file" ) ; assertFalse ( unknownFile . exists ( ) ) ; final URLConnection connection = unknownFile . getURL ( ) . openConnection ( ) ; try { connection . getInputStream ( ) ; fail ( ) ; } catch ( final IOException e ) { assertSameMessage ( "vfs.provider/read-not-file.error" , unknownFile , e ) ; } assertEquals ( - 1 , connection . getContentLength ( ) ) ; }
Tests that unknown files have no content.
Tests that unknown files have no content .
// Try getting the content of an unknown file