Coverage report

  %line %branch
org.demosys.web.user.action.NewUserAction
100% 
100% 

 1  
 /*
 2  
  * Demosys.
 3  
  *
 4  
  * Terms of license - http://opensource.org/licenses/apachepl.php
 5  
  */
 6  
 package org.demosys.web.user.action;
 7  
 import javax.servlet.http.HttpServletRequest;
 8  
 import javax.servlet.http.HttpServletResponse;
 9  
 import org.apache.struts.action.*;
 10  
 import org.demosys.web.ServiceLocator;
 11  
 import org.demosys.web.user.DuplicateUserException;
 12  
 import org.demosys.web.user.InvalidUserException;
 13  
 import org.demosys.web.user.UserService;
 14  
 /**
 15  
  */
 16  12
 public class NewUserAction extends Action {
 17  
     public ActionForward execute(ActionMapping mapping, ActionForm objForm,
 18  
         HttpServletRequest req, HttpServletResponse res) {
 19  12
         UserForm form = (UserForm)objForm;
 20  
         try {
 21  12
             UserService userService = ServiceLocator.getServiceLocator().getUserService();
 22  12
             userService.newUser(form.toUserView());
 23  4
         }
 24  
         catch (DuplicateUserException e) {
 25  4
             ActionErrors errors = new ActionErrors();
 26  4
             errors.add("id", new ActionError("user.control.user.already.exist"));
 27  4
             saveErrors(req, errors);
 28  4
             return mapping.findForward("failure");
 29  
         }
 30  
         catch (InvalidUserException e) {
 31  4
             saveErrors(req, e.getErrors());
 32  4
             return mapping.findForward("failure");
 33  
         }
 34  
 
 35  4
         return mapping.findForward("success");
 36  
     }
 37  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.