|
|
|
@ -40,6 +40,12 @@ public class EnvironmentVariableDefaultProviderTest { |
|
|
|
|
assertThat(provider.defaultValue(OptionSpec.builder("--env-var-set").build())).isEqualTo("abc"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldReturnValueWhenEnvironmentVariableIsSetWithLegacyPrefix() { |
|
|
|
|
environment.put("PANTHEON_ENV_VAR_SET", "abc"); |
|
|
|
|
assertThat(provider.defaultValue(OptionSpec.builder("--env-var-set").build())).isEqualTo("abc"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldReturnValueWhenEnvironmentVariableIsSetForAlternateName() { |
|
|
|
|
environment.put("BESU_ENV_VAR_SET", "abc"); |
|
|
|
@ -47,9 +53,25 @@ public class EnvironmentVariableDefaultProviderTest { |
|
|
|
|
.isEqualTo("abc"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldReturnValueWhenEnvironmentVariableIsSetForAlternateNameAndLegacyPrefix() { |
|
|
|
|
environment.put("PANTHEON_ENV_VAR_SET", "abc"); |
|
|
|
|
assertThat(provider.defaultValue(OptionSpec.builder("--env-var", "--env-var-set").build())) |
|
|
|
|
.isEqualTo("abc"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldNotReturnValueForShortOptions() { |
|
|
|
|
environment.put("BESU_H", "abc"); |
|
|
|
|
environment.put("PANTHEON_H", "abc"); |
|
|
|
|
assertThat(provider.defaultValue(OptionSpec.builder("-h").build())).isNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldPreferBesuPrefixOverLegacyPrefix() { |
|
|
|
|
environment.put("BESU_ENV_VAR_SET", "abc"); |
|
|
|
|
environment.put("PANTHEON_ENV_VAR_SET", "def"); |
|
|
|
|
assertThat(provider.defaultValue(OptionSpec.builder("--env-var", "--env-var-set").build())) |
|
|
|
|
.isEqualTo("abc"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|