title: What is best way to test smartServer servlets?
body: <p>I have the following Servlet method which I want to create test for it using junit or Cactus.I've tried Junit but in testing implementation classes but I'm a newbie in testing WebServices so I will really appreciate any help.</p>
  
  <pre><code>public DSResponse executeFetch(DSRequest req) throws Exception { 
  DSResponse resp = new DSResponse(); 
  
  String maID = (String) req.getCriteria().get("memberActivityID"); 
  MemberActivityImpl memberImpl = new MemberActivityImpl(); 
  
  MemberActivity memberAct = new MemberActivity(); 
  
  if (req.getDataSourceName().equals("memberActivity")) { 
  if (maID != null) { 
  // Fetch the MemberActivity based on the memberActivityID criteria 
  memberAct = memberImpl.getMemberActivity(maID); 
  
  List&lt;Map&gt; resultList = new LinkedList&lt;Map&gt;(); 
  
  if( memberAct != null &amp;&amp; memberAct.getMemberID() != null ) 
      // Pass the memberAct to the client 
      Map&lt;String, Object&gt; result = new HashMap&lt;String, Object&gt;(); 
      result.put("name", memberAct.getName()); 
      result.put("type", memberAct.getType()); 
      result.put("memberID", memberAct.getMemberID()); 
      if (memberAct.getGoal() != null) { 
          result.put("goal", memberAct.getGoal());} 
          resultList.add(result); 
      } 
      resp.setData(resultList); 
  } else { 
      resp.setFailure(); 
  } 
  </code></pre>
  
  <p>`</p>