### Question:
StrArrayVar extends AbstractVarType<String[]> { public static StrArrayVar strArrayVar(String id) { return new StrArrayVar(id); } private  StrArrayVar(String id); private  StrArrayVar(String id, String regex); static StrArrayVar strArrayVar(String id); static StrArrayVar strArrayVar(String id, String regex); @Override String[] convert(String value);  }### Answer:
@Test public void whenValueIsCorrectThenStringArrayIsReturned() { RestParser parser = parser("/users/{}?fields={}", intVar("userId"), strArrayVar("fields")); RestUrl url = parser.parse("http: assertThat(url, isValid()); assertThat((String[]) url.variable("fields"), is(new String[] {"name", "age"})); }
@Test public void whenValuesAreNullIsNotWellFormattedThenUrlIsInvalid() { RestParser parser = parser("/users/{}?fields={}", intVar("userId"), strArrayVar("fields")); RestUrl url = parser.parse("http: assertThat(url, isValid()); assertThat((String[]) url.variable("fields"), is(new String[]{"", "age"})); }
@Test public void whenVariableIsEmptyThenUrlIsInvalid() { RestParser parser = parser("/users/{}?fields={}", intVar("userId"), strArrayVar("fields")); RestUrl url = parser.parse("http: assertThat(url, isInvalid()); }