1 29 package net.sourceforge.groboutils.autodoc.v1.testserver; 30 31 32 import junit.framework.Test; 33 import junit.framework.TestSuite; 34 import junit.framework.TestCase; 35 36 37 38 45 public class DefaultTestInfo implements TestInfo 46 { 47 private String suite; 48 private String method; 49 50 51 54 protected DefaultTestInfo() 55 { 56 } 58 59 60 63 public DefaultTestInfo( String suite, String method ) 64 { 65 this.suite = suite; 66 this.method = method; 67 } 68 69 70 73 public String getSuite() 74 { 75 return this.suite; 76 } 77 78 79 82 public String getMethod() 83 { 84 return this.method; 85 } 86 87 88 92 public boolean equals( Object obj ) 93 { 94 if (obj == null) 95 { 96 return false; 97 } 98 if (this == obj) 99 { 100 return true; 101 } 102 if (obj instanceof TestInfo) 103 { 104 TestInfo ti = (TestInfo)obj; 105 if (this.getSuite() == null) 106 { 107 if (ti.getSuite() != null) 108 { 109 return false; 110 } 111 } 112 else 113 if (!this.getSuite().equals( ti.getSuite() )) 114 { 115 return false; 116 } 117 118 119 if (this.getMethod() == null) 120 { 121 if (ti.getMethod() != null) 122 { 123 return false; 124 } 125 } 126 else 127 if (!this.getMethod().equals( ti.getMethod() )) 128 { 129 return false; 130 } 131 132 return true; 134 } 135 return false; 137 } 138 139 public int hashCode() 140 { 141 int hc = 0; 142 String s = getSuite(); 143 String m = getMethod(); 144 if (s != null) 145 { 146 hc += s.hashCode(); 147 } 148 if (m != null) 149 { 150 hc += m.hashCode(); 151 } 152 return hc; 153 } 154 155 156 157 158 protected void setSuite( String name ) 159 { 160 this.suite = name; 161 } 162 163 164 protected void setMethod( String name ) 165 { 166 this.method = name; 167 } 168 } 169 170 | Popular Tags |