audittool/test-lib/src/main/java/io/bdrc/audit/audittests/NoFoldersInImageGroups.java
private void testNoFolders(Path testFolder) throws IOException {

            String testFolderString = testFolder.toString();
            // Creating the filter. Bring in only directories
            DirectoryStream.Filter<Path> filter = entry -> (entry.toFile().isDirectory());

            try (DirectoryStream<Path> pathDirectoryStream = Files.newDirectoryStream(testFolder, filter)) {

                // iterate over directories in path
                boolean hasDirs = false;

                // This will only iterate if there are directories. Even hidden ones.
                for (Path entry : pathDirectoryStream) {

                    // Fail the test
                    if (!hasDirs) {
                        FailTest(LibOutcome.DIR_FAILS_DIR_IN_IMAGES_FOLDER, testFolderString);
                        hasDirs = true;
                    }
                    FailTest(LibOutcome.DIR_IN_IMAGES_FOLDER, testFolderString, entry.getFileName().toString());
                }
            }
            catch (NoSuchFileException nsfe)
            {
                String badPath = nsfe.getFile();
                sysLogger.error("No such file {}", badPath);
                FailTest(LibOutcome.ROOT_NOT_FOUND, badPath);
            }
            catch (DirectoryIteratorException die) {
                sysLogger.error("Directory iteration error", die);
                FailTest(Outcome.SYS_EXC, die.getCause().getLocalizedMessage());
            }

        }
/**
         * Tests if a folder contains any folders
         *
         * @param testFolder Folder which should not contain any folders
         */
Tests if a folder contains any folders
@param testFolder Folder which should not contain any folders
Tests if a folder contains any folders @param testFolder Folder which should not contain any folders
private void testNoFolders(Path testFolder) throws IOException {
            String testFolderString = testFolder.toString();
            DirectoryStream.Filter<Path> filter = entry -> (entry.toFile().isDirectory());
            try (DirectoryStream<Path> pathDirectoryStream = Files.newDirectoryStream(testFolder, filter)) {
                boolean hasDirs = false;
                for (Path entry : pathDirectoryStream) {
                    if (!hasDirs) {
                        FailTest(LibOutcome.DIR_FAILS_DIR_IN_IMAGES_FOLDER, testFolderString);
                        hasDirs = true;
                    }
                    FailTest(LibOutcome.DIR_IN_IMAGES_FOLDER, testFolderString, entry.getFileName().toString());
                }
            }
            catch (NoSuchFileException nsfe)
            {
                String badPath = nsfe.getFile();
                sysLogger.error("No such file {}", badPath);
                FailTest(LibOutcome.ROOT_NOT_FOUND, badPath);
            }
            catch (DirectoryIteratorException die) {
                sysLogger.error("Directory iteration error", die);
                FailTest(Outcome.SYS_EXC, die.getCause().getLocalizedMessage());
            }
        }
private void testNoFolders ( Path testFolder ) throws IOException { String testFolderString = testFolder . toString ( ) ; DirectoryStream . Filter < Path > filter = entry -> ( entry . toFile ( ) . isDirectory ( ) ) ; try ( DirectoryStream < Path > pathDirectoryStream = Files . newDirectoryStream ( testFolder , filter ) ) { boolean hasDirs = false ; for ( Path entry : pathDirectoryStream ) { if ( ! hasDirs ) { FailTest ( LibOutcome . DIR_FAILS_DIR_IN_IMAGES_FOLDER , testFolderString ) ; hasDirs = true ; } FailTest ( LibOutcome . DIR_IN_IMAGES_FOLDER , testFolderString , entry . getFileName ( ) . toString ( ) ) ; } } catch ( NoSuchFileException nsfe ) { String badPath = nsfe . getFile ( ) ; sysLogger . error ( "No such file {}" , badPath ) ; FailTest ( LibOutcome . ROOT_NOT_FOUND , badPath ) ; } catch ( DirectoryIteratorException die ) { sysLogger . error ( "Directory iteration error" , die ) ; FailTest ( Outcome . SYS_EXC , die . getCause ( ) . getLocalizedMessage ( ) ) ; } }
Tests if a folder contains any folders
 @param testFolder Folder which should not contain any folders
Tests if a folder contains any folders @param testFolder Folder which should not contain any folders
// Creating the filter. Bring in only directories // iterate over directories in path // This will only iterate if there are directories. Even hidden ones. // Fail the test