core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java
/**
     * Tests that children cannot be listed for non-folders.
     */
Tests that children cannot be listed for non-folders.
Tests that children cannot be listed for non - folders .
public void testChildren() throws FileSystemException
    {
        FileObject file = getReadFolder().resolveFile("file1.txt");
        assertSame(FileType.FILE, file.getType());
        try
        {
            file.getChildren();
            fail();
        }
        catch (FileSystemException e)
        {
            assertSameMessage("vfs.provider/list-children-not-folder.error", file, e);
        }
        file = file.resolveFile("some-child");
        assertNotNull(file);
        file = getReadFolder().resolveFile("unknown-file");
        assertTrue(!file.exists());
        try
        {
            file.getChildren();
            fail();
        }
        catch (final FileSystemException e)
        {
            assertSameMessage("vfs.provider/list-children-not-folder.error", file, e);
        }
        FileObject child = file.resolveFile("some-child");
        assertNotNull(child);
    }
public void testChildren ( ) throws FileSystemException { FileObject file = getReadFolder ( ) . resolveFile ( "file1.txt" ) ; assertSame ( FileType . FILE , file . getType ( ) ) ; try { file . getChildren ( ) ; fail ( ) ; } catch ( FileSystemException e ) { assertSameMessage ( "vfs.provider/list-children-not-folder.error" , file , e ) ; } file = file . resolveFile ( "some-child" ) ; assertNotNull ( file ) ; file = getReadFolder ( ) . resolveFile ( "unknown-file" ) ; assertTrue ( ! file . exists ( ) ) ; try { file . getChildren ( ) ; fail ( ) ; } catch ( final FileSystemException e ) { assertSameMessage ( "vfs.provider/list-children-not-folder.error" , file , e ) ; } FileObject child = file . resolveFile ( "some-child" ) ; assertNotNull ( child ) ; }
Tests that children cannot be listed for non-folders.
Tests that children cannot be listed for non - folders .
// Check for file // Should be able to get child by name // Check for unknown file // Should be able to get child by name