@Test
public void testValidateDownloadedS3FilesFileCountMismatch() throws IOException
{

    File targetLocalDirectory = Paths.get(LOCAL_TEMP_PATH.toString(), TEST_S3_KEY_PREFIX).toFile();
    createLocalFiles(targetLocalDirectory.getPath(), FILE_SIZE_1_KB);
    createLocalFile(targetLocalDirectory.getPath(), "EXTRA_FILE", FILE_SIZE_1_KB);
    StorageUnit storageUnit = createStorageUnit(TEST_S3_KEY_PREFIX, LOCAL_FILES, FILE_SIZE_1_KB);
    // Try to validate the local files, when number of files does not match to the storage unit information.
    try
    {
        storageFileHelper.validateDownloadedS3Files(LOCAL_TEMP_PATH.toString(), TEST_S3_KEY_PREFIX, storageUnit);
        fail("Should throw a RuntimeException when number of local files does not match to the storage unit information.");
    }
    catch (RuntimeException e)
    {
        String expectedErrMsg = String
            .format("Number of downloaded files does not match the storage unit information (expected %d files, actual %d files).",
                storageUnit.getStorageFiles().size(), LOCAL_FILES.size() + 1);
        assertEquals(expectedErrMsg, e.getMessage());
    }
}