### Question:
ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wrong format"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); return false; } if (minValue != null && value < minValue){ param.setErrCode(3); param.setErrText("too small"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); } else if (maxValue != null && value > maxValue){ param.setErrCode(3); param.setErrText("too large"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); } else { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); } param.setLastModified(new Date()); return param.getMessageFormParamStatus().equals(IncMessageFormParameterStatus.VALID); }  boolean validate(IncomingMessageFormParameter param); void setMinValue(Float minValue); void setMaxValue(Float maxValue);  }### Answer:
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param = new IncomingMessageFormParameterImpl(); param.setValue("10"); ParamRangeValidator instance = new ParamRangeValidator(); instance.setMaxValue(5f); instance.setMinValue(0f); boolean expResult = false; boolean result = instance.validate(param); assertEquals(expResult, result); assertEquals(param.getMessageFormParamStatus(), IncMessageFormParameterStatus.INVALID); assertEquals(param.getErrCode(), 3); assertEquals(param.getErrText(), "too large"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.NEW); instance.setMaxValue(20f); expResult = true; result = instance.validate(param); assertEquals(expResult, result); assertEquals(param.getMessageFormParamStatus(), IncMessageFormParameterStatus.VALID); }