Clover coverage report - Diasparsoft Toolkit - 0.22
Coverage timestamp: Tue Jun 8 2004 12:41:26 EDT
file stats: LOC: 43   Methods: 2
NCLOC: 22   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ServletUtil.java - 100% 100% 100%
coverage
 1   
 package com.diasparsoftware.javax.servlet;
 2   
 
 3   
 import java.util.*;
 4   
 
 5   
 import javax.servlet.http.HttpServletRequest;
 6   
 
 7   
 import org.apache.commons.collections.*;
 8   
 
 9   
 public class ServletUtil {
 10   
 
 11   
     /**
 12   
      * Provides a nicer string representation of a
 13   
      * servlet request parameter map.
 14   
      * 
 15   
      * @param request  The request whose parameters you
 16   
      * want to display
 17   
      * @return   A nice string representation of the
 18   
      * parameters to the specified request
 19   
      */
 20  44
     public static String parameterMapToString(HttpServletRequest request) {
 21  44
         final Map parameters = new HashMap();
 22   
 
 23  44
         Closure convertArrayToListClosure = new Closure() {
 24  44
             public void execute(Object eachMapEntryAsObject) {
 25  44
                 Map.Entry eachMapEntry =
 26   
                     (Map.Entry) eachMapEntryAsObject;
 27   
 
 28  44
                 String name = (String) eachMapEntry.getKey();
 29  44
                 String[] values = (String[]) eachMapEntry.getValue();
 30   
 
 31  44
                 parameters.put(name, Arrays.asList(values));
 32   
             }
 33   
         };
 34   
 
 35  44
         CollectionUtils.forAllDo(
 36   
             request.getParameterMap().entrySet(),
 37   
             convertArrayToListClosure);
 38   
 
 39  44
         return parameters.toString();
 40   
     }
 41   
 
 42   
 }
 43