### Question:
PositiveNonZeroInteger implements IParameterValidator { @Override public void validate(String name, String value) throws ParameterException { int n = Integer.parseInt(value); if (n <= 0) { throw new ParameterException("Parameter " + name + " should be greater than zero (found " + value + ")"); } }  @Override void validate(String name, String value);  }### Answer:
@Test public void typical() { validator.validate("var", "123"); }
@Test(expected = ParameterException.class) 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"); }