@SmallTest
  public void testFragments() throws Exception {
    UriTemplate template = new UriTemplate("/search#{fragment}");
    assertTrue(template.matches("/search#foo"));

    template = new UriTemplate("/search?query={query}#{fragment}");
    assertTrue(template.matches("/search?query=foo#bar"));
  }
 @SmallTest
 public void testMatches() throws Exception {
   UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
   assertTrue(
       "UriTemplate does not match", template.matches("http://example.com/hotels/1/bookings/42"));
   assertFalse("UriTemplate matches", template.matches("http://example.com/hotels/bookings"));
   assertFalse("UriTemplate matches", template.matches(""));
   assertFalse("UriTemplate matches", template.matches(null));
 }
 @SmallTest
 public void testQueryVariables() throws Exception {
   UriTemplate template = new UriTemplate("/search?q={query}");
   assertTrue(template.matches("/search?q=foo"));
 }
 @SmallTest
 public void testMatchesCustomRegex() throws Exception {
   UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel:\\d+}");
   assertTrue("UriTemplate does not match", template.matches("http://example.com/hotels/42"));
   assertFalse("UriTemplate matches", template.matches("http://example.com/hotels/foo"));
 }