### Question:
CliConfig { public static CliConfig fromFile(final File defaultsFile, final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final Config config; if (defaultsFile.exists() && defaultsFile.canRead()) { config = ConfigFactory.parseFile(defaultsFile); } else { config = ConfigFactory.empty(); } return fromEnvVar(config, environmentVariables); } CliConfig(List<String> domains, String srvName, List<URI> masterEndpoints); String getUsername(); List<String> getDomains(); String getDomainsString(); String getSrvName(); List<URI> getMasterEndpoints(); static String getConfigDirName(); static String getConfigFileName(); static CliConfig fromUserConfig(final Map<String, String> environmentVariables); static CliConfig fromFile(final File defaultsFile,
                                   final Map<String, String> environmentVariables); static CliConfig fromEnvVar(final Config config,
                                     final Map<String, String> environmentVariables); static CliConfig fromConfig(final Config config); static final List<String> EMPTY_STRING_LIST; }### Answer:
@Test public void testConfigFromFileWithInvalidJson() throws Exception { final Map<String, String> environment = ImmutableMap.of(); final File file = temporaryFolder.newFile(); expectedEx.expect(ConfigException.class); expectedEx.expectMessage(Matchers.containsString("Expecting close brace } or a comma")); try (final FileOutputStream outFile = new FileOutputStream(file)) { outFile.write(Charsets.UTF_8.encode( "{\"masterEndpoints\":[\"" + ENDPOINT1 + "\", \"" + ENDPOINT2 + "\", \"" + ENDPOINT3 + "\"], \"domains\":[\"" + SITE1 + "\", \"" + SITE2 + "\", \"" + SITE3 + "\"], \"srvName\":\"foo\"").array()); CliConfig.fromFile(file, environment); } }