@SmallTest public void testExpandMapDuplicateVariables() throws Exception { UriTemplate template = new UriTemplate("/order/{c}/{c}/{c}"); assertEquals( "Invalid variable names", Arrays.asList("c", "c", "c"), template.getVariableNames()); URI result = template.expand(Collections.singletonMap("c", "cheeseburger")); assertEquals( "Invalid expanded template", new URI("/order/cheeseburger/cheeseburger/cheeseburger"), result); }
@SmallTest public void testGetVariableNames() throws Exception { UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}"); List<String> variableNames = template.getVariableNames(); assertEquals("Invalid variable names", Arrays.asList("hotel", "booking"), variableNames); }