Skip to content

Instantly share code, notes, and snippets.

@hamnis
Created January 16, 2014 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamnis/8462394 to your computer and use it in GitHub Desktop.
Save hamnis/8462394 to your computer and use it in GitHub Desktop.
public class QueriesTest {
@Test
public void findCreatedQuery() throws Exception {
Query query = Query.create(new URITemplateTarget("http://example.com{?q}"), "filter", Optional.<String>none(), Collections.singletonList(Property.template("q")));
Collection collection = Collection.builder().addQuery(query).build();
Query filter = collection.queryByRel("filter").get();
assertThat(URI.create("http://example.com"), equalTo(filter.expand()));
assertThat(URI.create("http://example.com?q=faff"), equalTo(filter.expand(Collections.singletonList(Property.value("q", "faff")))));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment