### Question:
IntVar extends AbstractVarType<Integer> { public static IntVar intVar(String id) { return new IntVar(id); } private  IntVar(String id); private  IntVar(String id, String regex); static IntVar intVar(String id); static IntVar intVar(String id, String regex); @Override Integer convert(String value);  }### Answer:
@Test public void whenNegIntIsCorrectThenIntegerIsReturned() { RestParser parser = parser("/users/{}", intVar("userId")); RestUrl url = parser.parse("http: assertThat(url, isValid()); assertThat((Integer) url.variable("userId"), is(-2397)); }
@Test public void whenNegIntIsNotExpectedThenUrlIsInvalid() { RestParser parser = parser("/users/{}", intVar("userId", "[0-9]+")); RestUrl url = parser.parse("http: assertThat(url, isInvalid()); }
@Test public void whenValueIsTooBigThenUrlIsInvalid() { RestParser parser = parser("/users/{}", intVar("userId")); RestUrl url = parser.parse("http: assertThat(url, isInvalid()); }
@Test public void whenVariableIsEmptyThenUrlIsInvalid() { RestParser parser = parser("/users/{}", intVar("userId")); RestUrl url = parser.parse("http: assertThat(url, isInvalid()); }