Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 129929 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java (-2 / +9 lines)
Lines 18-38 Link Here
18
public class TestSuiteElement extends TestElement {
18
public class TestSuiteElement extends TestElement {
19
	
19
	
20
	private List/*<TestElement>*/ fChildren;
20
	private List/*<TestElement>*/ fChildren;
21
	private Status fSuiteStatus;
21
	
22
	
22
	public TestSuiteElement(TestSuiteElement parent, String id, String testName, int childrenCount) {
23
	public TestSuiteElement(TestSuiteElement parent, String id, String testName, int childrenCount) {
23
		super(parent, id, testName);
24
		super(parent, id, testName);
25
		fSuiteStatus= getStatus();
24
		fChildren= new ArrayList(childrenCount);
26
		fChildren= new ArrayList(childrenCount);
25
	}
27
	}
26
28
27
	public void addChild(TestElement child) {
29
	public void addChild(TestElement child) {
28
		fChildren.add(child);
30
		fChildren.add(child);
31
		setStatus(internalGetStatus());
29
	}
32
	}
30
	
33
	
31
	public TestElement[] getChildren() {
34
	public TestElement[] getChildren() {
32
		return (TestElement[]) fChildren.toArray(new TestElement[fChildren.size()]);
35
		return (TestElement[]) fChildren.toArray(new TestElement[fChildren.size()]);
33
	}
36
	}
34
	
37
	
35
	public Status getStatus() {
38
	private Status internalGetStatus() {
36
		//TODO: Cache failure count in hierarchy? Recheck behavior when introducing filters
39
		//TODO: Cache failure count in hierarchy? Recheck behavior when introducing filters
37
		Status suiteStatus= getSuiteStatus();
40
		Status suiteStatus= getSuiteStatus();
38
//		Assert.isTrue(suiteStatus.isNotRun()
41
//		Assert.isTrue(suiteStatus.isNotRun()
Lines 55-65 Link Here
55
	}
58
	}
56
59
57
	public Status getSuiteStatus() {
60
	public Status getSuiteStatus() {
58
		return super.getStatus();
61
		return fSuiteStatus;
59
	}
62
	}
60
	
63
	
61
	public String toString() {
64
	public String toString() {
62
		return super.toString() + " (" + fChildren.size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
65
		return super.toString() + " (" + fChildren.size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
63
	}
66
	}
64
67
68
	public void childChangedStatus(TestElement child, Status newStatus) {
69
		setStatus(internalGetStatus());
70
	}
71
65
}
72
}
(-)src/org/eclipse/jdt/internal/junit/model/TestElement.java (-1 / +7 lines)
Lines 155-163 Link Here
155
		fParent= parent;
155
		fParent= parent;
156
		fId= id;
156
		fId= id;
157
		fTestName= testName;
157
		fTestName= testName;
158
		fStatus= Status.NOT_RUN;
158
		if (parent != null)
159
		if (parent != null)
159
			parent.addChild(this);
160
			parent.addChild(this);
160
		fStatus= Status.NOT_RUN;
161
	}
161
	}
162
	
162
	
163
	/**
163
	/**
Lines 183-188 Link Here
183
		//TODO: notify about change?
183
		//TODO: notify about change?
184
		//TODO: multiple errors/failures per test https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296
184
		//TODO: multiple errors/failures per test https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296
185
		fStatus= status;
185
		fStatus= status;
186
		TestSuiteElement parent= getParent();
187
		if (parent != null)
188
			parent.childChangedStatus(this, status);
186
	}
189
	}
187
	
190
	
188
	public void setStatus(Status status, String trace, String expected, String actual) {
191
	public void setStatus(Status status, String trace, String expected, String actual) {
Lines 192-197 Link Here
192
		fTrace= trace;
195
		fTrace= trace;
193
		fExpected= expected;
196
		fExpected= expected;
194
		fActual= actual;
197
		fActual= actual;
198
		TestSuiteElement parent= getParent();
199
		if (parent != null)
200
			parent.childChangedStatus(this, status);
195
	}
201
	}
196
202
197
	public Status getStatus() {
203
	public Status getStatus() {

Return to bug 129929