diff options
author | 2020-09-02 13:34:19 +0200 | |
---|---|---|
committer | 2020-09-03 11:02:14 +0200 | |
commit | 9518352d2bdc2db7b33c5ad305faeca77eba9656 (patch) | |
tree | a01f1cc58b6f669a4c66c2a20d4fcfcc01f61579 /trustStoreMerger | |
parent | d0e9d1fb9422effe0fe2408c8de2553e2ac20702 (diff) |
Move path logic to configuration (merger)
Issue-ID: DCAEGEN2-2253
Change-Id: I8ef6603335a837fbd2bcda9975d669f73f94db57
Signed-off-by: kjaniak <kornel.janiak@nokia.com>
Diffstat (limited to 'trustStoreMerger')
13 files changed, 135 insertions, 58 deletions
diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java index c8cc84df..e2e0c62a 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java @@ -27,11 +27,10 @@ import org.onap.oom.truststoremerger.certification.file.provider.FileManager; import org.onap.oom.truststoremerger.certification.file.provider.PasswordReader; import org.onap.oom.truststoremerger.certification.file.TruststoreFileFactory; import org.onap.oom.truststoremerger.certification.file.TruststoreFilesListProvider; -import org.onap.oom.truststoremerger.certification.path.EnvProvider; -import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; -import org.onap.oom.truststoremerger.configuration.MergerConfiguration; -import org.onap.oom.truststoremerger.configuration.MergerConfigurationFactory; -import org.onap.oom.truststoremerger.certification.path.PathValidator; +import org.onap.oom.truststoremerger.configuration.path.TruststoresPathsProviderFactory; +import org.onap.oom.truststoremerger.configuration.path.TruststoresPathsProvider; +import org.onap.oom.truststoremerger.configuration.model.MergerConfiguration; +import org.onap.oom.truststoremerger.configuration.MergerConfigurationProvider; import java.util.List; import org.slf4j.Logger; @@ -75,9 +74,8 @@ class TrustStoreMerger { } private MergerConfiguration loadConfiguration() throws ExitableException { - TruststoresPathsProvider truststoresPathsProvider = new TruststoresPathsProvider(new EnvProvider(), - new PathValidator()); - MergerConfigurationFactory factory = new MergerConfigurationFactory(truststoresPathsProvider); + TruststoresPathsProvider truststoresPathsProvider = TruststoresPathsProviderFactory.create(); + MergerConfigurationProvider factory = new MergerConfigurationProvider(truststoresPathsProvider); return factory.createConfiguration(); } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationProvider.java index acd9a840..5a40a64a 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationProvider.java @@ -19,19 +19,20 @@ package org.onap.oom.truststoremerger.configuration; -import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; -import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProviderException; - import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PATHS_ENV; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_PATHS_ENV; import java.util.List; +import org.onap.oom.truststoremerger.configuration.exception.MergerConfigurationException; +import org.onap.oom.truststoremerger.configuration.exception.TruststoresPathsProviderException; +import org.onap.oom.truststoremerger.configuration.model.MergerConfiguration; +import org.onap.oom.truststoremerger.configuration.path.TruststoresPathsProvider; -public class MergerConfigurationFactory { +public class MergerConfigurationProvider { private final TruststoresPathsProvider pathsProvider; - public MergerConfigurationFactory(TruststoresPathsProvider pathsProvider) { + public MergerConfigurationProvider(TruststoresPathsProvider pathsProvider) { this.pathsProvider = pathsProvider; } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationException.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/exception/MergerConfigurationException.java index 54982f5f..90a75d91 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationException.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/exception/MergerConfigurationException.java @@ -17,14 +17,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.configuration; +package org.onap.oom.truststoremerger.configuration.exception; import org.onap.oom.truststoremerger.api.ExitStatus; import org.onap.oom.truststoremerger.api.ExitableException; public class MergerConfigurationException extends ExitableException { - MergerConfigurationException(String message) { + public MergerConfigurationException(String message) { super(message, ExitStatus.MERGER_CONFIGURATION_EXCEPTION); } } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderException.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/exception/TruststoresPathsProviderException.java index 1f69fe20..dda53e32 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderException.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/exception/TruststoresPathsProviderException.java @@ -17,14 +17,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.exception; import org.onap.oom.truststoremerger.api.ExitStatus; import org.onap.oom.truststoremerger.api.ExitableException; public class TruststoresPathsProviderException extends ExitableException { - TruststoresPathsProviderException(String message) { + public TruststoresPathsProviderException(String message) { super(message, ExitStatus.TRUSTSTORES_PATHS_PROVIDER_EXCEPTION); } } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfiguration.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/model/MergerConfiguration.java index f3b7d935..3b807c39 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfiguration.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/model/MergerConfiguration.java @@ -17,12 +17,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.configuration; +package org.onap.oom.truststoremerger.configuration.model; import java.util.Collections; import java.util.List; -public class MergerConfiguration { +public final class MergerConfiguration { private final List<String> truststoreFilePaths; private final List<String> truststoreFilePasswordPaths; diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/EnvProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/EnvProvider.java index a1998b86..c6fbf515 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/EnvProvider.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/EnvProvider.java @@ -17,14 +17,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.path; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class EnvProvider { +class EnvProvider { private static final Logger LOGGER = LoggerFactory.getLogger(EnvProvider.class); diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/PathValidator.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/PathValidator.java index 256da490..4240228d 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/PathValidator.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/PathValidator.java @@ -17,18 +17,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.path; -public class PathValidator { +class PathValidator { private static final String TRUSTSTORE_PATH_REGEX = "^(/[a-zA-Z0-9_-]+)+\\.(pem|jks|p12)"; private static final String TRUSTSTORE_PASSWORD_PATH_REGEX = "^(/[a-zA-Z0-9_-]+)+\\.pass"; - public boolean isTruststorePathValid(String truststorePath) { + boolean isTruststorePathValid(String truststorePath) { return isPathValid(truststorePath, TRUSTSTORE_PATH_REGEX); } - public boolean isTruststorePasswordPathValid(String truststorePasswordPath) { + boolean isTruststorePasswordPathValid(String truststorePasswordPath) { return truststorePasswordPath.isEmpty() || isPathValid(truststorePasswordPath, TRUSTSTORE_PASSWORD_PATH_REGEX); } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProvider.java index 9d86a8b9..9d7e30a4 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProvider.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProvider.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.path; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PATHS_ENV; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_PATHS_ENV; @@ -25,6 +25,7 @@ import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PA import java.util.Arrays; import java.util.List; import java.util.function.Predicate; +import org.onap.oom.truststoremerger.configuration.exception.TruststoresPathsProviderException; public class TruststoresPathsProvider { @@ -34,7 +35,7 @@ public class TruststoresPathsProvider { private final EnvProvider envProvider; private final PathValidator pathValidator; - public TruststoresPathsProvider(EnvProvider envProvider, PathValidator pathValidator) { + TruststoresPathsProvider(EnvProvider envProvider, PathValidator pathValidator) { this.envProvider = envProvider; this.pathValidator = pathValidator; } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactory.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactory.java new file mode 100644 index 00000000..7a999108 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactory.java @@ -0,0 +1,30 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.configuration.path; + +public class TruststoresPathsProviderFactory { + + private TruststoresPathsProviderFactory() { + } + + public static TruststoresPathsProvider create() { + return new TruststoresPathsProvider(new EnvProvider(), new PathValidator()); + } +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationProviderTest.java index 43b7b9e1..854cde79 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationProviderTest.java @@ -24,18 +24,20 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; -import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProviderException; import java.util.ArrayList; import java.util.List; +import org.onap.oom.truststoremerger.configuration.exception.MergerConfigurationException; +import org.onap.oom.truststoremerger.configuration.exception.TruststoresPathsProviderException; +import org.onap.oom.truststoremerger.configuration.model.MergerConfiguration; +import org.onap.oom.truststoremerger.configuration.path.TruststoresPathsProvider; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class MergerConfigurationFactoryTest { +class MergerConfigurationProviderTest { private static final String BASE_TRUSTSTORE_PATH = "/opt/app/truststore_"; private static final String TRUSTSTORE_EXTENSION = ".jks"; @@ -43,11 +45,11 @@ class MergerConfigurationFactoryTest { @Mock private TruststoresPathsProvider pathsProvider; - private MergerConfigurationFactory factory; + private MergerConfigurationProvider factory; @BeforeEach void setUp() { - factory = new MergerConfigurationFactory(pathsProvider); + factory = new MergerConfigurationProvider(pathsProvider); } @Test diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/PathValidatorTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/PathValidatorTest.java index a11bb232..b0487478 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/PathValidatorTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/PathValidatorTest.java @@ -17,28 +17,28 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.path; + +import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import static org.assertj.core.api.Assertions.assertThat; - class PathValidatorTest { private final PathValidator validator = new PathValidator(); @ParameterizedTest() @ValueSource(strings = {"/opt/app/truststore.pem", "/opt/app/truststore.jks", - "/opt/app/truststore.p12", "/truststore.pem"}) + "/opt/app/truststore.p12", "/truststore.pem"}) void shouldAcceptValidTruststorePaths(String path) { assertThat(validator.isTruststorePathValid(path)).isTrue(); } @ParameterizedTest() @ValueSource(strings = {"/opt/app/truststore.pass", "/opt/app/truststore.invalid", "/", - "truststore", "opt/app/truststore.p12", "/?.pem", "/.pem"}) - void shouldRejectInValidTruststorePaths(String path) { + "truststore", "opt/app/truststore.p12", "/?.pem", "/.pem"}) + void shouldRejectInvalidTruststorePaths(String path) { assertThat(validator.isTruststorePathValid(path)).isFalse(); } @@ -50,8 +50,8 @@ class PathValidatorTest { @ParameterizedTest() @ValueSource(strings = {"/opt/app/truststore.pem", "/opt/app/truststore.jks", - "/opt/app/truststore.p12", "/", "truststore", "opt/app/truststore.p12", "/?.pass", "/.pass"}) - void shouldRejectInValidTruststorePasswordPaths(String path) { + "/opt/app/truststore.p12", "/", "truststore", "opt/app/truststore.p12", "/?.pass", "/.pass"}) + void shouldRejectInvalidTruststorePasswordPaths(String path) { assertThat(validator.isTruststorePasswordPathValid(path)).isFalse(); } diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactoryTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactoryTest.java new file mode 100644 index 00000000..efaef65f --- /dev/null +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderFactoryTest.java @@ -0,0 +1,34 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.configuration.path; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +class TruststoresPathsProviderFactoryTest { + + @Test + void shouldReturnCorrectObject() { + // given, when, then + assertThat(TruststoresPathsProviderFactory.create()).isInstanceOf(TruststoresPathsProvider.class); + } + +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderTest.java index 38422d5c..d2e9cdef 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/path/TruststoresPathsProviderTest.java @@ -17,21 +17,21 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.path; +package org.onap.oom.truststoremerger.configuration.path; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.Mockito.when; +import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_PATHS_ENV; +import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PATHS_ENV; + +import java.util.Optional; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; - -import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.when; -import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PATHS_ENV; -import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_PATHS_ENV; +import org.onap.oom.truststoremerger.configuration.exception.TruststoresPathsProviderException; @ExtendWith(MockitoExtension.class) @@ -39,6 +39,7 @@ class TruststoresPathsProviderTest { private static final String VALID_TRUSTSTORES = "/opt/app/certificates/truststore.jks:/opt/app/certificates/truststore.pem"; private static final String VALID_TRUSTSTORES_PASSWORDS = "/opt/app/certificates/truststore.pass:"; + private static final String VALID_TRUSTSTORES_PASSWORDS_WITH_EMPTY_IN_THE_MIDDLE = "/opt/app/certificates/truststore.pass::/etc/truststore.pass"; private static final String INVALID_TRUSTSTORES = "/opt/app/certificates/truststore.jks:/opt/app/certificates/truststore.invalid"; private static final String INVALID_TRUSTSTORES_PASSWORDS = "/opt/app/certificates/truststore.pass:/.pass"; @@ -56,8 +57,8 @@ class TruststoresPathsProviderTest { mockTruststoresEnv(VALID_TRUSTSTORES); assertThat(truststoresPathsProvider.getTruststores()) - .contains("/opt/app/certificates/truststore.jks", - "/opt/app/certificates/truststore.pem"); + .containsSequence("/opt/app/certificates/truststore.jks", + "/opt/app/certificates/truststore.pem"); } @Test @@ -65,8 +66,19 @@ class TruststoresPathsProviderTest { mockTruststoresPasswordsEnv(VALID_TRUSTSTORES_PASSWORDS); assertThat(truststoresPathsProvider.getTruststoresPasswords()) - .contains("/opt/app/certificates/truststore.pass", - ""); + .containsSequence("/opt/app/certificates/truststore.pass", ""); + } + + @Test + void shouldReturnCorrectListWhenTruststoresPasswordsContainsEmptyPathsInTheMiddle() + throws TruststoresPathsProviderException { + mockTruststoresPasswordsEnv(VALID_TRUSTSTORES_PASSWORDS_WITH_EMPTY_IN_THE_MIDDLE); + + assertThat(truststoresPathsProvider.getTruststoresPasswords()).containsSequence( + "/opt/app/certificates/truststore.pass", + "", + "/etc/truststore.pass" + ); } @Test @@ -74,7 +86,7 @@ class TruststoresPathsProviderTest { mockTruststoresEnv(""); assertThatExceptionOfType(TruststoresPathsProviderException.class) - .isThrownBy(truststoresPathsProvider::getTruststores); + .isThrownBy(truststoresPathsProvider::getTruststores); } @Test @@ -82,7 +94,7 @@ class TruststoresPathsProviderTest { mockTruststoresEnv(INVALID_TRUSTSTORES); assertThatExceptionOfType(TruststoresPathsProviderException.class) - .isThrownBy(truststoresPathsProvider::getTruststores); + .isThrownBy(truststoresPathsProvider::getTruststores); } @Test @@ -90,7 +102,7 @@ class TruststoresPathsProviderTest { mockTruststoresPasswordsEnv(INVALID_TRUSTSTORES_PASSWORDS); assertThatExceptionOfType(TruststoresPathsProviderException.class) - .isThrownBy(truststoresPathsProvider::getTruststoresPasswords); + .isThrownBy(truststoresPathsProvider::getTruststoresPasswords); } private void mockTruststoresEnv(String truststores) { @@ -102,7 +114,6 @@ class TruststoresPathsProviderTest { } private void mockEnv(String envValue, String envName) { - when(envProvider.getEnv(envName)) - .thenReturn(Optional.of(envValue)); + when(envProvider.getEnv(envName)).thenReturn(Optional.of(envValue)); } } |