IntegerRangeParameter extends AbstractParameter<Integer[]> { @Override public Integer[] valueIn(String text, Type type) { if (text == null || text.length() == 0) return null; String[] parts = text.split(regexSplitter); if (parts.length != 2) return null; return new Integer[] { Integer.parseInt(parts[0]), Integer.parseInt(parts[1]) }; } IntegerRangeParameter(String theId, String theDescription, String theRegexSplitter); @Override Integer[] valueIn(String text, Type type);  }
@Test public void valueInTest() { IntegerRangeParameter ipr = new IntegerRangeParameter("a", "Aye", " "); Integer[] range = ipr.valueIn("5 19", null); assertNotNull(range); assertEquals(2, range.length); assertEquals(5, range[0].intValue()); assertEquals(19, range[1].intValue()); range = ipr.valueIn("", null); assertNull(range); range = ipr.valueIn(" 19", null); assertNull(range); range = ipr.valueIn("4 6 9", null); assertNull(range); }