stub fileExists for testing

This commit is contained in:
Christopher Smith
2014-07-23 17:57:09 -05:00
parent 5dbb086d37
commit 21e6955498
2 changed files with 18 additions and 2 deletions

View File

@@ -131,7 +131,7 @@ public class LocalConfigConnector extends AbstractCloudConnector<UriBasedService
return;
}
if (!propertiesFile.exists()) {
if (!fileExists(propertiesFile)) {
logger.info("properties file " + propertiesFile + " does not exist; probably running in a real cloud");
return;
}
@@ -153,7 +153,18 @@ public class LocalConfigConnector extends AbstractCloudConnector<UriBasedService
/**
* Broken out into a separate method for mocking the filesystem.
*
* @param filename
* @param file
* the file to check
* @return whether the file exists
*/
boolean fileExists(File file) {
return file.exists();
}
/**
* Broken out into a separate method for mocking the filesystem.
*
* @param file
* the file to open
* @return a {@code FileInputStream} to the file
* @throws IOException

View File

@@ -25,6 +25,11 @@ class StubbedOpenFileLocalConfigConnector extends LocalConfigConnector {
return fileProvider.openFile(file);
}
@Override
boolean fileExists(File file) {
return true;
}
public void setFileProvider(InputStreamProvider provider) {
this.fileProvider = provider;
}