Skip to content

Commit

Permalink
Change isSecret to secret based on PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner committed Apr 5, 2018
1 parent fd7ca16 commit 86bc8f7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Expand Up @@ -34,23 +34,23 @@ public class ConfigValue
private final Optional<?> value; private final Optional<?> value;
private final String valueDescription; private final String valueDescription;
private final boolean internal; private final boolean internal;
private final boolean isSecret; private final boolean secret;
private final boolean dynamic; private final boolean dynamic;
private final boolean deprecated; private final boolean deprecated;
private final Optional<String> replacement; private final Optional<String> replacement;


public ConfigValue( @Nonnull String name, @Nonnull Optional<String> description, public ConfigValue( @Nonnull String name, @Nonnull Optional<String> description,
@Nonnull Optional<String> documentedDefaultValue, @Nonnull Optional<?> value, @Nonnull Optional<String> documentedDefaultValue, @Nonnull Optional<?> value,
@Nonnull String valueDescription, boolean internal, boolean dynamic, boolean deprecated, @Nonnull String valueDescription, boolean internal, boolean dynamic, boolean deprecated,
@Nonnull Optional<String> replacement, boolean isSecret ) @Nonnull Optional<String> replacement, boolean secret )
{ {
this.name = name; this.name = name;
this.description = description; this.description = description;
this.documentedDefaultValue = documentedDefaultValue; this.documentedDefaultValue = documentedDefaultValue;
this.value = value; this.value = value;
this.valueDescription = valueDescription; this.valueDescription = valueDescription;
this.internal = internal; this.internal = internal;
this.isSecret = isSecret; this.secret = secret;
this.dynamic = dynamic; this.dynamic = dynamic;
this.deprecated = deprecated; this.deprecated = deprecated;
this.replacement = replacement; this.replacement = replacement;
Expand All @@ -77,7 +77,7 @@ public Optional<?> value()
@Nonnull @Nonnull
public Optional<String> valueAsString() public Optional<String> valueAsString()
{ {
return this.isSecret() ? Optional.of( Secret.OBSFUCATED ) : value.map( ConfigValue::valueToString ); return this.secret() ? Optional.of( Secret.OBSFUCATED ) : value.map( ConfigValue::valueToString );
} }


@Override @Override
Expand All @@ -102,9 +102,9 @@ public boolean internal()
return internal; return internal;
} }


public boolean isSecret() public boolean secret()
{ {
return isSecret; return secret;
} }


public boolean dynamic() public boolean dynamic()
Expand Down
Expand Up @@ -42,7 +42,7 @@ public void handlesEmptyValue() throws Exception
assertFalse( value.deprecated() ); assertFalse( value.deprecated() );
assertEquals( Optional.empty(), value.replacement() ); assertEquals( Optional.empty(), value.replacement() );
assertFalse( value.internal() ); assertFalse( value.internal() );
assertFalse( value.isSecret() ); assertFalse( value.secret() );
} }


@Test @Test
Expand All @@ -52,7 +52,7 @@ public void handlesInternal() throws Exception
"description", true, false, false, Optional.empty(), false ); "description", true, false, false, Optional.empty(), false );


assertTrue( value.internal() ); assertTrue( value.internal() );
assertFalse( value.isSecret() ); assertFalse( value.secret() );
} }


@Test @Test
Expand All @@ -66,7 +66,7 @@ public void handlesNonEmptyValue() throws Exception
assertFalse( value.deprecated() ); assertFalse( value.deprecated() );
assertEquals( Optional.empty(), value.replacement() ); assertEquals( Optional.empty(), value.replacement() );
assertFalse( value.internal() ); assertFalse( value.internal() );
assertFalse( value.isSecret() ); assertFalse( value.secret() );
} }


@Test @Test
Expand All @@ -80,7 +80,7 @@ public void handlesDeprecationAndReplacement() throws Exception
assertTrue( value.deprecated() ); assertTrue( value.deprecated() );
assertEquals( "new_name", value.replacement().get() ); assertEquals( "new_name", value.replacement().get() );
assertFalse( value.internal() ); assertFalse( value.internal() );
assertFalse( value.isSecret() ); assertFalse( value.secret() );
} }


@Test @Test
Expand All @@ -94,7 +94,7 @@ public void handlesValueDescription() throws Exception
assertTrue( value.deprecated() ); assertTrue( value.deprecated() );
assertEquals( "new_name", value.replacement().get() ); assertEquals( "new_name", value.replacement().get() );
assertFalse( value.internal() ); assertFalse( value.internal() );
assertFalse( value.isSecret() ); assertFalse( value.secret() );
assertEquals( "a simple integer", value.valueDescription() ); assertEquals( "a simple integer", value.valueDescription() );
} }


Expand All @@ -109,7 +109,7 @@ public void handlesSecretValue() throws Exception
assertFalse( value.deprecated() ); assertFalse( value.deprecated() );
assertEquals( Optional.empty(), value.replacement() ); assertEquals( Optional.empty(), value.replacement() );
assertFalse( value.internal() ); assertFalse( value.internal() );
assertTrue( value.isSecret() ); assertTrue( value.secret() );
} }


@Test @Test
Expand Down
Expand Up @@ -276,8 +276,8 @@ public void shouldSetSecretParameter()
.build(); .build();


// Then // Then
assertTrue( config.getConfigValues().get( MySettingsWithDefaults.password.name() ).isSecret() ); assertTrue( config.getConfigValues().get( MySettingsWithDefaults.password.name() ).secret() );
assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).isSecret() ); assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).secret() );
String configText = config.toString(); String configText = config.toString();
assertTrue( configText.contains( Secret.OBSFUCATED ) ); assertTrue( configText.contains( Secret.OBSFUCATED ) );
assertFalse( configText.contains( "this should not be visible" ) ); assertFalse( configText.contains( "this should not be visible" ) );
Expand Down

0 comments on commit 86bc8f7

Please sign in to comment.