diff options
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/EnvVariables.java')
-rw-r--r-- | appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/EnvVariables.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/EnvVariables.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/EnvVariables.java new file mode 100644 index 000000000..6cc3b7550 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/EnvVariables.java @@ -0,0 +1,26 @@ +package org.onap.appc.flow.controller.node; + +import java.util.function.Function; + +/** + * Wrapper for accessing environment variables + */ +class EnvVariables { + + private Function<String, String> envSupplier; + + EnvVariables() { + envSupplier = System::getenv; + } + + /** + * Allows to override environment variables in tests, prefer to use default constructor + */ + EnvVariables(Function<String, String> envSupplier) { + this.envSupplier = envSupplier; + } + + String getenv(String variable) { + return envSupplier.apply(variable); + } +} |