public void checkFileDirectoryDistinction(final Storage storage, final String directory1, final String directory2) throws Exception {
        assertTrue(storage.exists(directory1));
        assertTrue(storage.exists(directory2));
        assertTrue(storage.exists(directory1 + "/f*"));
        assertTrue(storage.exists(directory2 + "/f*"));
        assertEquals(10, storage.ls(directory1).size());
        assertEquals(10, storage.ls(directory1 + "/*").size());
        assertEquals(5, storage.ls(directory2).size());
        assertEquals(5, storage.ls(directory2 + "/*").size());
        for (int i = 0; i < 10; i++) {
            assertTrue(storage.exists(directory1 + "/file1-" + i + ".txt.bz"));
            assertTrue(storage.exists(directory1 + "/file1-" + i + "*"));
            assertTrue(storage.exists(directory1 + "/file1-" + i + ".txt*"));
            assertTrue(storage.exists(directory1 + "/file1-" + i + ".*.bz"));
            assertTrue(storage.exists(directory1 + "/file1-" + i + ".*.b*"));
        }
        assertFalse(storage.exists(directory1 + "/file1-10.txt.bz"));
        for (int i = 0; i < 5; i++) {
            assertTrue(storage.exists(directory2 + "/file2-" + i + ".txt.bz"));
            assertTrue(storage.exists(directory2 + "/file2-" + i + "*"));
            assertTrue(storage.exists(directory2 + "/file2-" + i + ".txt*"));
            assertTrue(storage.exists(directory2 + "/file2-" + i + ".*.bz"));
            assertTrue(storage.exists(directory2 + "/file2-" + i + ".*.b*"));
        }
        assertFalse(storage.exists(directory2 + "/file1-5.txt.bz"));
        assertTrue(storage.rm(directory1 + "/file1-0.txt.bz"));
        assertFalse(storage.rm(directory1 + "/file1-0.txt.bz"));
        assertEquals(9, storage.ls(directory1).size());
        assertEquals(9, storage.ls(directory1 + "/*").size());
        assertEquals(9, storage.ls(directory1 + "/file*").size());
        assertEquals(9, storage.ls(directory1 + "/file1*").size());
        assertEquals(0, storage.ls(directory1 + "/file2*").size());
        assertEquals(5, storage.ls(directory2).size());
        assertEquals(5, storage.ls(directory2 + "/*").size());
        assertEquals(5, storage.ls(directory2 + "/file*").size());
        assertEquals(5, storage.ls(directory2 + "/file2*").size());
        assertEquals(0, storage.ls(directory2 + "/file1*").size());
        assertTrue(storage.rm(directory1 + "/file1-*"));
        assertFalse(storage.rm(directory1 + "/file1-*"));
        assertEquals(0, storage.ls(directory1).size());
        assertEquals(0, storage.ls(directory1 + "/*").size());
        assertEquals(5, storage.ls(directory2).size());
        assertEquals(5, storage.ls(directory2 + "/*").size());
        assertTrue(storage.rm(directory2 + "/f*"));
        assertFalse(storage.rm(directory2 + "/file*"));
        assertEquals(0, storage.ls(directory2).size());
        assertEquals(0, storage.ls(directory2 + "/*").size());
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/AbstractStorageCheck.java