### Question:
ConfigFileValidator { public static void validate(String configFileLocation) { List<String> errors = new ArrayList<>(); if (StringUtils.isEmpty(configFileLocation)) { errors.add("No config file was specified."); } else { for (String configFileString : Splitter.on(',').split(configFileLocation)) { File configFile = new File(configFileString); if (!configFile.exists()) { errors.add("Config file " + configFileString + " does not exist."); } else if (!configFile.isFile()) { errors.add("Config file " + configFileString + " is a directory."); } else if (!configFile.canRead()) { errors.add("Config file " + configFileString + " cannot be read."); } } } if (!errors.isEmpty()) { throw new ConfigFileValidationException(errors); } }  static void validate(String configFileLocation);  }### Answer:
@Test(expected = ConfigFileValidationException.class) public void configFileLocationIsNotSet() throws Exception { ConfigFileValidator.validate(null); }
@Test(expected = ConfigFileValidationException.class) public void configFileLocationIsBlank() throws Exception { ConfigFileValidator.validate(" "); }
@Test public void singleFileExists() throws Exception { File location = tmp.newFile(); ConfigFileValidator.validate(location.getAbsolutePath()); }
@Test(expected = ConfigFileValidationException.class) public void singleFileDoesNotExist() throws Exception { File location = new File(tmp.getRoot(), "trick"); ConfigFileValidator.validate(location.getAbsolutePath()); }
@Test(expected = ConfigFileValidationException.class) public void singleFileIsADirectory() throws Exception { ConfigFileValidator.validate(tmp.getRoot().getAbsolutePath()); }
@Test public void multipleFilesExist() throws Exception { File location1 = tmp.newFile(); File location2 = tmp.newFile(); ConfigFileValidator.validate(COMMA_JOINER.join(location1.getAbsolutePath(), location2.getAbsolutePath())); }
@Test(expected = ConfigFileValidationException.class) public void multipleFilesAndOneDoesNotExist() throws Exception { File location1 = tmp.newFile(); File location2 = new File(tmp.getRoot(), "trick"); ConfigFileValidator.validate(COMMA_JOINER.join(location1.getAbsolutePath(), location2.getAbsolutePath())); }
@Test(expected = ConfigFileValidationException.class) public void multipleFilesAndOneIsADirectory() throws Exception { File location1 = tmp.newFile(); File location2 = tmp.getRoot(); ConfigFileValidator.validate(COMMA_JOINER.join(location1.getAbsolutePath(), location2.getAbsolutePath())); }