### Question:
DriverConfig { static InputStream openConfigFile() { String location = System.getProperty(PerfLoggerConstants.CONFIG_FILE_LOCATION_PROP_KEY); if (location == null) { LOGGER.debug("No System property " + PerfLoggerConstants.CONFIG_FILE_LOCATION_PROP_KEY + " defined, looking for config at " + PerfLoggerConstants.CONFIG_FILE_DEFAULT_LOCATION); location = PerfLoggerConstants.CONFIG_FILE_DEFAULT_LOCATION; } InputStream configFileStream = openConfigFile(location); if (configFileStream == null) { location = PerfLoggerConstants.CONFIG_FILE_FALLBACK_LOCATION; configFileStream = openConfigFile(location); if (configFileStream == null) { throw new RuntimeException( "Unexpected: cannot find " + PerfLoggerConstants.CONFIG_FILE_FALLBACK_LOCATION); } } LOGGER.info("Using config file " + location); return configFileStream; }  @Nullable Integer getServerPort(); List<InetSocketAddress> getClientAddresses(); @Nullable String getClassNameForJdbcUrl(final String jdbcUrl); final static DriverConfig INSTANCE; }### Answer:
@Test public void testOpenFallbackConfigFile() throws Exception { final InputStream is = DriverConfig.openConfigFile(PerfLoggerConstants.CONFIG_FILE_FALLBACK_LOCATION); assertNotNull(is); is.close(); }
@Test public void testOpenFileNotInClasspath() throws Exception { InputStream is = DriverConfig.openConfigFile(TEST_TXT); assertNotNull(is); is.close(); is = DriverConfig.openConfigFile("src/test/resourcesNonClasspath/notfound.txt"); assertNull(is); }
@Test public void testOpenDefaultConfigFile() throws Exception { final InputStream is = DriverConfig.openConfigFile(); assertNotNull(is); is.close(); }
@Test public void testOpenSystemSpecifiedInexistentConfigFile() throws Exception { System.setProperty(PerfLoggerConstants.CONFIG_FILE_LOCATION_PROP_KEY, "dummy"); final InputStream is = DriverConfig.openConfigFile(); assertNotNull(is); final String line = readFirstLine(is); assertTrue(line.contains("fallback")); is.close(); }
@Test public void testOpenSystemSpecifiedConfigFileMalformed() throws Exception { System.setProperty(PerfLoggerConstants.CONFIG_FILE_LOCATION_PROP_KEY, TEST_TXT); final InputStream is = DriverConfig.openConfigFile(); assertNotNull(is); final String line = readFirstLine(is); assertTrue(line.contains("HELLO")); is.close(); }