KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit > runner > RerunExecutionListener


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * David Saff (saff@mit.edu) - initial API and implementation
11  * (bug 102632: [JUnit] Support for JUnit 4.)
12  *******************************************************************************/

13
14 package org.eclipse.jdt.internal.junit.runner;
15
16 public class RerunExecutionListener extends FirstRunExecutionListener {
17     // Don't send ids here, since they don't match the ids of the original run:
18
// RemoteTestRunner#rerunTest(..) reloads Test, so ITestReferences are not equals(..).
19

20     public RerunExecutionListener(MessageSender sender, TestIdMap ids) {
21         super(sender, ids);
22     }
23
24     private String JavaDoc fStatus = RemoteTestRunner.RERAN_OK;
25
26     public void notifyTestFailed(TestReferenceFailure failure) {
27         sendFailure(failure, MessageIds.RTRACE_START, MessageIds.RTRACE_END);
28
29         String JavaDoc status = failure.getStatus();
30         if (status.equals(MessageIds.TEST_FAILED))
31             fStatus = RemoteTestRunner.RERAN_FAILURE;
32         else if (status.equals(MessageIds.TEST_ERROR))
33             fStatus = RemoteTestRunner.RERAN_ERROR;
34         else
35             throw new IllegalArgumentException JavaDoc(status);
36     }
37
38     public void notifyTestStarted(ITestIdentifier test) {
39         // do nothing
40
}
41
42     public void notifyTestEnded(ITestIdentifier test) {
43         // do nothing
44
}
45
46     public String JavaDoc getStatus() {
47         return fStatus;
48     }
49
50 }
51
Popular Tags