new class to manage icons. Showing failures,etc on a test suite.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestCase.java
1 /*
2  * Created on Jul 31, 2004
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */
7 package net.sourceforge.phpeclipse.phpunit.testpool;
8
9
10 /**
11  * @author Ali Echihabi
12  *
13  * To change the template for this generated type comment go to
14  * Window>Preferences>Java>Code Generation>Code and Comments
15  */
16 public class TestCase {
17
18         public static final String PASS = "PASS";
19         public static final String FAIL = "FAIL";
20         public static final String ERROR = "ERROR";
21
22
23         private TestSuite parentSuite;
24         private String testName;
25         private String testID;
26         private String verdict;
27         private String parentTestSuiteName;
28         
29         
30         
31
32         /**
33          * @param testName
34          * @param testID
35          */
36         public TestCase(String testID, String testName, String parentTestSuiteName) {
37                 
38                 this.testName = testName;
39                 this.testID = testID;
40                 this.parentTestSuiteName = parentTestSuiteName;
41         }
42
43
44
45         /**
46          * @return
47          */
48         public String getTestID() {
49                 return testID;
50         }
51
52         /**
53          * @return
54          */
55         public String getTestName() {
56                 return testName;
57         }
58
59         /**
60          * @return
61          */
62         public String getVerdict() {
63                 return verdict;
64         }
65
66         /**
67          * @param string
68          */
69         public void setTestID(String string) {
70                 testID = string;
71                 
72         }
73
74
75
76         /**
77          * @param string
78          */
79         public void setTestName(String string) {
80                 testName = string;
81         }
82
83         /**
84          * @param string
85          */
86         public void setVerdict(String string) {
87                 verdict = string;
88                 
89                 if(isFailure())
90                         parentSuite.setHasFailure();
91                 if(isError())
92                         parentSuite.setHasError();
93                 
94         }
95
96         /**
97          * @param suite
98          */
99         public void setParentSuite(TestSuite suite) {
100                 this.parentSuite = suite;
101                 suite.setName(parentTestSuiteName);
102                 
103         }
104
105         /**
106          * @return
107          */
108         public Object getParentSuite() {
109                 
110                 return parentSuite;
111         }
112
113         /**
114          * @return
115          */
116         public boolean isError() {
117                 
118                 return getVerdict().equals(TestCase.ERROR);
119         }
120
121         /**
122          * @return
123          */
124         public boolean isFailure() {
125                 
126                 return getVerdict().equals(TestCase.FAIL);
127                 
128         }
129
130         /**
131          * @return
132          */
133         public boolean isPass() {
134                 
135                 return getVerdict().equals(TestCase.PASS);
136
137         }
138
139 }