### Question:
LocalFileUtils { public static int countFilesInDirectory(final File directory) { if (directory == null) { throw new IllegalArgumentException("null directory"); } int count = 0; if (directory.isFile()) { count = 1; } else { final File[] files = directory.listFiles(); if (files != null) { for (final File file : files) { if (file.isFile()) { count++; } if (file.isDirectory()) { count += countFilesInDirectory(file); } } } } return count; } private  LocalFileUtils(); static void stringToFile(final File file, final String string); static String fileContentsAsString(final File file); static String getFileExtension(final String fileName); static String normalizePath(final String inPath); static String getFileNameUpToExtension(final String fileName); static String getFileNameWithTimeStampInterposed(final String fileName); static int countFilesInDirectory(final File directory); static void createLocalFileIfNotExists(final File localFileToHoldData); static long computeCRC32FileCheckSumViaAbsolutePath(final String absolutePathToLocalFile); static byte[] computeSHA256FileCheckSumViaAbsolutePath(final String absolutePathToLocalFile); static byte[] computeMD5FileCheckSumViaAbsolutePath(final String absolutePathToLocalFile); static byte[] hexStringToByteArray(final String s); static String digestByteArrayToString(final byte[] digestAsByteArray); static File getClasspathResourceAsFile(final String resourcePath); static String getClasspathResourceFileAsString(final String resourcePath); static byte[] getBytesFromFile(final File file); static final Logger log; }### Answer:
@Test public void testCountFilesInDirectory() throws Exception { String rootCollection = "testCountFilesInDirectory"; String localCollectionAbsolutePath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection); FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, "testPutCollectionWithTwoFiles", 1, 1, 1, "testFile", ".txt", 2, 2, 1, 2); File rootCollectionFile = new File(localCollectionAbsolutePath); int fileCtr = LocalFileUtils.countFilesInDirectory(rootCollectionFile); Assert.assertEquals("did not count the two files", 2, fileCtr); }