@Test public void isEnabledShouldReturnCorrectBoolean() throws Exception { final ProjectFeatureFlags flags = new ProjectFeatureFlags(asList( new ProjectFeatureFlag("enabledFlag", true), new ProjectFeatureFlag("disabledFlag", false) )); assertThat(flags.isEnabled("enabledFlag"), is(true)); assertThat(flags.isEnabled("disabledFlag"), is(false)); assertThat(flags.isEnabled("nonexistentFlag"), is(false)); }
public boolean isEnabled(final String flagName) { notEmpty(flagName, "flagName"); for (final ProjectFeatureFlag flag : items) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag.isEnabled(); } } return false; }
ProjectFeatureFlags implements Iterable<ProjectFeatureFlag> { public boolean isEnabled(final String flagName) { notEmpty(flagName, "flagName"); for (final ProjectFeatureFlag flag : items) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag.isEnabled(); } } return false; } }
ProjectFeatureFlags implements Iterable<ProjectFeatureFlag> { public boolean isEnabled(final String flagName) { notEmpty(flagName, "flagName"); for (final ProjectFeatureFlag flag : items) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag.isEnabled(); } } return false; } @JsonCreator  ProjectFeatureFlags(@JsonProperty("items") List<ProjectFeatureFlag> items); }
ProjectFeatureFlags implements Iterable<ProjectFeatureFlag> { public boolean isEnabled(final String flagName) { notEmpty(flagName, "flagName"); for (final ProjectFeatureFlag flag : items) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag.isEnabled(); } } return false; } @JsonCreator  ProjectFeatureFlags(@JsonProperty("items") List<ProjectFeatureFlag> items); @Override Iterator<ProjectFeatureFlag> iterator(); boolean isEnabled(final String flagName); @Override String toString(); }
ProjectFeatureFlags implements Iterable<ProjectFeatureFlag> { public boolean isEnabled(final String flagName) { notEmpty(flagName, "flagName"); for (final ProjectFeatureFlag flag : items) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag.isEnabled(); } } return false; } @JsonCreator  ProjectFeatureFlags(@JsonProperty("items") List<ProjectFeatureFlag> items); @Override Iterator<ProjectFeatureFlag> iterator(); boolean isEnabled(final String flagName); @Override String toString(); static final String PROJECT_FEATURE_FLAGS_URI; }