Clover coverage report - Maven Clover report
Coverage timestamp: Thu Aug 24 2006 01:18:17 PDT
file stats: LOC: 69   Methods: 7
NCLOC: 39   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DummyCart.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Copyright 2004 The Apache Software Foundation
 3    *
 4    * Licensed under the Apache License, Version 2.0 (the "License");
 5    * you may not use this file except in compliance with the License.
 6    * You may obtain a copy of the License at
 7    *
 8    * http://www.apache.org/licenses/LICENSE-2.0
 9    *
 10    * Unless required by applicable law or agreed to in writing, software
 11    * distributed under the License is distributed on an "AS IS" BASIS,
 12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13    * See the License for the specific language governing permissions and
 14    * limitations under the License.
 15    */
 16    package sessions;
 17   
 18    import javax.servlet.http.*;
 19    import java.util.Vector;
 20    import java.util.Enumeration;
 21   
 22    public class DummyCart {
 23    Vector v = new Vector();
 24    String submit = null;
 25    String item = null;
 26   
 27  0 private void addItem(String name) {
 28  0 v.addElement(name);
 29    }
 30   
 31  0 private void removeItem(String name) {
 32  0 v.removeElement(name);
 33    }
 34   
 35  0 public void setItem(String name) {
 36  0 item = name;
 37    }
 38   
 39  0 public void setSubmit(String s) {
 40  0 submit = s;
 41    }
 42   
 43  0 public String[] getItems() {
 44  0 String[] s = new String[v.size()];
 45  0 v.copyInto(s);
 46  0 return s;
 47    }
 48   
 49  0 public void processRequest(HttpServletRequest request) {
 50    // null value for submit - user hit enter instead of clicking on
 51    // "add" or "remove"
 52  0 if (submit == null)
 53  0 addItem(item);
 54   
 55  0 if (submit.equals("add"))
 56  0 addItem(item);
 57  0 else if (submit.equals("remove"))
 58  0 removeItem(item);
 59   
 60    // reset at the end of the request
 61  0 reset();
 62    }
 63   
 64    // reset
 65  0 private void reset() {
 66  0 submit = null;
 67  0 item = null;
 68    }
 69    }