Committing patch from grEvenX to fix bug #1839622 RSE Path error
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestCase.java
1 /*************************************************************************
2  * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
3  *
4  * Plugin for PHP unit Testing.
5  * www.phpeclipse.de
6  * 
7  *************************************************************************/
8
9 package net.sourceforge.phpeclipse.phpunit.testpool;
10
11 public class TestCase {
12
13         public static final String PASS = "PASS";
14
15         public static final String FAIL = "FAIL";
16
17         public static final String ERROR = "ERROR";
18
19         private TestSuite parentSuite;
20
21         private String testName;
22
23         private String testID;
24
25         private String verdict;
26
27         private String parentTestSuiteName;
28
29         /**
30          * @param testName
31          * @param testID
32          */
33         public TestCase(String testID, String testName, String parentTestSuiteName) {
34
35                 this.testName = testName;
36                 this.testID = testID;
37                 this.parentTestSuiteName = parentTestSuiteName;
38         }
39
40         /**
41          * @return
42          */
43         public String getTestID() {
44                 return testID;
45         }
46
47         /**
48          * @return
49          */
50         public String getTestName() {
51                 return testName;
52         }
53
54         /**
55          * @return
56          */
57         public String getVerdict() {
58                 return verdict;
59         }
60
61         /**
62          * @param string
63          */
64         public void setTestID(String string) {
65                 testID = string;
66
67         }
68
69         /**
70          * @param string
71          */
72         public void setTestName(String string) {
73                 testName = string;
74         }
75
76         /**
77          * @param string
78          */
79         public void setVerdict(String string) {
80                 verdict = string;
81
82                 if (isFailure())
83                         parentSuite.setHasFailure();
84                 if (isError())
85                         parentSuite.setHasError();
86
87         }
88
89         /**
90          * @param suite
91          */
92         public void setParentSuite(TestSuite suite) {
93                 this.parentSuite = suite;
94                 suite.setName(parentTestSuiteName);
95
96         }
97
98         /**
99          * @return
100          */
101         public Object getParentSuite() {
102
103                 return parentSuite;
104         }
105
106         /**
107          * @return
108          */
109         public boolean isError() {
110
111                 return getVerdict().equals(TestCase.ERROR);
112         }
113
114         /**
115          * @return
116          */
117         public boolean isFailure() {
118
119                 return getVerdict().equals(TestCase.FAIL);
120
121         }
122
123         /**
124          * @return
125          */
126         public boolean isPass() {
127
128                 return getVerdict().equals(TestCase.PASS);
129
130         }
131
132 }