Ejemplo n.º 1
0
 @Test
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void testGetActionsByClassIfHasValidSize() {
   Class clazz = UserController.class;
   List<ControllerMapping> mappings = classScanner.getActionsByClass(clazz, "user");
   assertEquals(7, mappings.size());
 }
Ejemplo n.º 2
0
 @Test
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void testGetActionsByClassIfIsNotNull() {
   Class clazz = UserController.class;
   List<ControllerMapping> mappings = classScanner.getActionsByClass(clazz, "user");
   assertNotNull(mappings);
 }
Ejemplo n.º 3
0
 @Test
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void testGetActionsByClassIfHasValidMethodForRunBeforeAllActions() {
   Class clazz = UserController.class;
   List<ControllerMapping> mappings = classScanner.getActionsByClass(clazz, "user");
   for (ControllerMapping mapping : mappings) {
     assertNotNull(mapping.getRunBeforeActions());
   }
 }
Ejemplo n.º 4
0
 @Test
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void testGetActionsByClassIfHasValidMethodForRunBeforeSomeActions() {
   Class clazz = PersonController.class;
   List<ControllerMapping> mappings = classScanner.getActionsByClass(clazz, "user");
   for (ControllerMapping mapping : mappings) {
     String action = mapping.getActionName();
     if ("save".equals(action) || "update".equals(action) || "delete".equals(action)) {
       assertNotNull(mapping.getRunBeforeActions());
     } else {
       assertNull(mapping.getRunBeforeActions());
     }
   }
 }