@GET @Path("/?flag&Action=GetUser&Version=2010-05-08") Response empty();
}
@Test public void queryParamsInPathExtract() throws Exception {
{
MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("none"));
assertEquals(md.template().url(), "/");
assertTrue(md.template().queries().isEmpty());
assertEquals(md.template().toString(), "GET / HTTP/1.1\n");
}
{
MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("one"));
assertEquals(md.template().url(), "/");
assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
assertEquals(md.template().toString(), "GET /?Action=GetUser HTTP/1.1\n");
}
{
MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("two"));
assertEquals(md.template().url(), "/");
assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
}
{
MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("three"));
assertEquals(md.template().url(), "/");
assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
assertEquals(md.template().queries().get("limit"), ImmutableSet.of("1"));
assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08&limit=1 HTTP/1.1\n");
}
{
MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
assertEquals(md.template().url(), "/");
assertTrue(md.template().queries().containsKey("flag"));
assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
}
}