示例#1
0
 @Test
 public void oneParameter() {
   RequestMapping mapping = new RequestMapping(null, "/test/{name}");
   assertNull(mapping.matches("/test"));
   assertNull(mapping.matches("/test/john/doe"));
   PathParameters parameters = mapping.matches("/test/frank");
   assertNotNull(parameters);
   assertEquals("frank", parameters.getString("name"));
 }
示例#2
0
 @Test
 public void twoParameters() {
   RequestMapping mapping = new RequestMapping(null, "/test/{name}/{id}");
   assertNull(mapping.matches("/test"));
   assertNull(mapping.matches("/test/john"));
   PathParameters parameters = mapping.matches("/test/john/doe");
   assertNotNull(parameters);
   assertEquals("john", parameters.getString("name"));
   assertEquals("doe", parameters.getString("id"));
 }