Query { public List<String> paramNames() { return new ArrayList<String>(parse().keySet()); } Query(String string); @Override String toString(); String valueFor(String name); List<String> paramNames(); String show(); boolean eq(Query that);  }
@Test public void listsParameterNames() { Query testSubject = new Query("?xyz=123&abc=456"); final List<String> names = testSubject.paramNames(); assertEquals(2, names.size()); assertEquals("xyz", names.get(0)); assertEquals("abc", names.get(1)); }
@Test public void returnsEmptyListOfParamNamesWhenTheQueryStringIsEmpty() { Query testSubject = new Query(""); final List<String> names = testSubject.paramNames(); assertEquals(0, names.size()); }