Пример #1
0
 @Test
 public void noParameter() {
   RequestMapping mapping = new RequestMapping(null, "/test");
   assertNull(mapping.matches("/girl"));
   assertNotNull(mapping.matches("/test"));
   assertNull(mapping.matches("/tester"));
 }
Пример #2
0
 @Test
 public void negativeNumbers() {
   RequestMapping mapping = new RequestMapping(null, "/rank/{account}/{league}/{week}");
   assertNull(mapping.matches("/rank"));
   assertNull(mapping.matches("/rank/CPA/Cool"));
   assertNotNull(mapping.matches("/rank/CPA/Cool/3"));
   assertNotNull(mapping.matches("/rank/CPA/Cool/-3"));
 }
Пример #3
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"));
 }
Пример #4
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"));
 }