### Question:
PositiveLong implements IParameterValidator { @Override public void validate(String name, String value) throws ParameterException { long n = Long.parseLong(value); if (n < 0) { throw new ParameterException("Parameter " + name + " should be positive (found " + value + ")"); } }  @Override void validate(String name, String value);  }### Answer:
@Test public void typical() { validator.validate("var", "123"); }
@Test public void zero() { validator.validate("var", "0"); }
@Test(expected = ParameterException.class) public void negative() { validator.validate("var", "-1"); }
@Test(expected = NumberFormatException.class) public void invalidFormat() { validator.validate("var", "abc"); }