@Test public void testNotAllowingMissingValues() { final CategoricalValueSchema valueSchema = new CategoricalValueSchema(false, NOMINAL_VALUES); assertFalse("Missing value should not be valid if specified", valueSchema.validate(AbstractValueSchema.MISSING_VALUE)); assertTrue("Validation of a existing nominal value should return true", valueSchema.validate(NOMINAL_VALUES.iterator().next())); assertFalse("Non nominal value should not be valid", valueSchema.validate(NON_NOMINAL_VALUE)); assertThat(valueSchema.isAllowMissing()) .as("whether it allows missing values") .isFalse(); }
@Override public boolean validate(final String value) { return super.validate(value) && (value == null || this.nominalValues.contains(value)); }
CategoricalValueSchema extends AbstractValueSchema { @Override public boolean validate(final String value) { return super.validate(value) && (value == null || this.nominalValues.contains(value)); } }
CategoricalValueSchema extends AbstractValueSchema { @Override public boolean validate(final String value) { return super.validate(value) && (value == null || this.nominalValues.contains(value)); } CategoricalValueSchema(final boolean allowMissing,
                                  final Set<String> nominalValues); }
CategoricalValueSchema extends AbstractValueSchema { @Override public boolean validate(final String value) { return super.validate(value) && (value == null || this.nominalValues.contains(value)); } CategoricalValueSchema(final boolean allowMissing,
                                  final Set<String> nominalValues); SortedSet<String> getNominalValues(); @Override boolean validate(final String value); @Override int hashCode(); @Override boolean equals(final Object obj); }
CategoricalValueSchema extends AbstractValueSchema { @Override public boolean validate(final String value) { return super.validate(value) && (value == null || this.nominalValues.contains(value)); } CategoricalValueSchema(final boolean allowMissing,
                                  final Set<String> nominalValues); SortedSet<String> getNominalValues(); @Override boolean validate(final String value); @Override int hashCode(); @Override boolean equals(final Object obj);  }