private static void addValue(OutputWriter outputWriter, EnvironmentVariableConfig environmentVariableConfig) { if (environmentVariableConfig.isSecure()) { outputWriter.add("encrypted_value", environmentVariableConfig.getDisplayValue()); } else { outputWriter.add("value", environmentVariableConfig.getDisplayValue()); } } }
@Test public void shouldNotMaskValueIfNotSecure() { EnvironmentVariableConfig secureEnvironmentVariable = new EnvironmentVariableConfig(goCipher, "plain_key", "plain_value", false); Assert.assertThat(secureEnvironmentVariable.getDisplayValue(), is("plain_value")); }
@Test public void shouldMaskValueIfSecure() { EnvironmentVariableConfig secureEnvironmentVariable = new EnvironmentVariableConfig(goCipher, "plain_key", "plain_value", true); Assert.assertThat(secureEnvironmentVariable.getDisplayValue(), is("****")); }