@Test public void testVariableNames() { List<String> names = RouteUtil.pathVariableNames("/persons/{id}"); Assert.assertEquals(1, names.size()); Assert.assertEquals("id", names.get(0)); List<String> names2 = RouteUtil.pathVariableNames("/persons/{id}/edit/{name}"); Assert.assertEquals(2, names2.size()); Assert.assertEquals("id", names2.get(0)); Assert.assertEquals("name", names2.get(1)); }
@Test(expected = IllegalArgumentException.class) public void testVariableNames2() { RouteUtil.pathVariableNames("/persons/{id}/id/{id}"); }