Coverage Report - org.webmacro.engine.TestObject
 
Classes in this File Line Coverage Branch Coverage Complexity
TestObject
0%
0/28
0%
0/4
1.182
 
 1  
 /*
 2  
  * Copyright (C) 1998-2000 Semiotek Inc.  All Rights Reserved.
 3  
  *
 4  
  * Redistribution and use in source and binary forms, with or without
 5  
  * modification, are permitted under the terms of either of the following
 6  
  * Open Source licenses:
 7  
  *
 8  
  * The GNU General Public License, version 2, or any later version, as
 9  
  * published by the Free Software Foundation
 10  
  * (http://www.fsf.org/copyleft/gpl.html);
 11  
  *
 12  
  *  or
 13  
  *
 14  
  * The Semiotek Public License (http://webmacro.org/LICENSE.)
 15  
  *
 16  
  * This software is provided "as is", with NO WARRANTY, not even the
 17  
  * implied warranties of fitness to purpose, or merchantability. You
 18  
  * assume all risks and liabilities associated with its use.
 19  
  *
 20  
  * See www.webmacro.org for more information on the WebMacro project.
 21  
  */
 22  
 
 23  
 
 24  
 package org.webmacro.engine;
 25  
 
 26  
 import java.util.Date;
 27  
 
 28  
 /**
 29  
  * This class exists for testing purposes only
 30  
  */
 31  
 public class TestObject
 32  
 {
 33  
 
 34  0
     public String fname = "default fName";
 35  
     public Date date;
 36  
     private String pname;
 37  
     private boolean valid;
 38  
 
 39  
     public TestObject (String n)
 40  0
     {
 41  0
         pname = n;
 42  0
         date = new Date();
 43  0
     }
 44  
 
 45  
     public TestObject (String n, boolean b)
 46  
     {
 47  0
         this(n);
 48  0
         valid = b;
 49  0
     }
 50  
 
 51  
     public String show (String arg)
 52  
     {
 53  0
         return "test(" + pname + ") showing string: " + arg;
 54  
     }
 55  
 
 56  
     public String show (Object arg)
 57  
     {
 58  0
         return "test(" + pname + ") showing object: " + arg;
 59  
     }
 60  
 
 61  
     public String show (long arg)
 62  
     {
 63  0
         return "test(" + pname + ") showing long: " + arg;
 64  
     }
 65  
 
 66  
     public String show (int arg)
 67  
     {
 68  0
         return "test(" + pname + ") showing int: " + arg;
 69  
     }
 70  
 
 71  
     public String getName ()
 72  
     {
 73  0
         return pname;
 74  
     }
 75  
 
 76  
     public void setName (String newName)
 77  
     {
 78  0
         pname = newName;
 79  0
     }
 80  
 
 81  
     public String getIsValid ()
 82  
     {
 83  0
         return valid ? "yes" : null;
 84  
     }
 85  
 
 86  
     public boolean isEven ()
 87  
     {
 88  0
         boolean answer = false;
 89  0
         if ((count % 2) == 0)
 90  
         {
 91  0
             answer = true;
 92  
         }
 93  0
         count++;
 94  0
         return answer;
 95  
     }
 96  
 
 97  0
     int count = 0;
 98  
 
 99  
     static public void main (String arg[])
 100  
     {
 101  
 
 102  0
         String a = "hi there";
 103  0
         Object b = a;
 104  
 
 105  0
         TestObject t = new TestObject("myTest");
 106  
 
 107  0
         System.out.println(t.show(a));
 108  0
         System.out.println(t.show(b));
 109  
 
 110  0
     }
 111  
 
 112  
 }
 113