### Question:
NumericValueSchema extends AbstractValueSchema { @Override public boolean validate(final String value) { if (!super.validate(value)) { return false; } if (value == null) { return true; } try { Double.valueOf(value); return true; } catch (final NumberFormatException e) { return false; } } NumericValueSchema(final boolean allowMissing); @Override boolean validate(final String value);  }### Answer:
@Test public void testAllowingMissingValues() { final NumericValueSchema valueSchema = new NumericValueSchema(true); assertTrue("Missing value should be valid if specified", valueSchema.validate(AbstractValueSchema.MISSING_VALUE)); assertTrue("Validation of a null value should return true", valueSchema.validate(null)); assertFalse("Non numeric value should not be valid", valueSchema.validate("not a number")); assertTrue("Numeric value should be valid", valueSchema.validate("42")); }
@Test public void testNotAllowingMissingValues() { final NumericValueSchema valueSchema = new NumericValueSchema(false); assertFalse("Missing value should not be valid if specified", valueSchema.validate(AbstractValueSchema.MISSING_VALUE)); assertFalse("Validation of a null value should not be allowed", valueSchema.validate(null)); assertFalse("Non numeric value should not be valid", valueSchema.validate("not a number")); assertTrue("Numeric value should be valid", valueSchema.validate("42")); }