Merge pull request #69 from chrylis/stub-file-exists
stub fileExists for testing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user