KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit4 > runner > JUnit4TestReference


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  * David Saff (saff@mit.edu) - initial API and implementation
10  * (bug 102632: [JUnit] Support for JUnit 4.)
11  *******************************************************************************/

12
13 package org.eclipse.jdt.internal.junit4.runner;
14
15 import org.eclipse.jdt.internal.junit.runner.IStopListener;
16 import org.eclipse.jdt.internal.junit.runner.ITestReference;
17 import org.eclipse.jdt.internal.junit.runner.TestExecution;
18 import org.junit.runner.Request;
19 import org.junit.runner.Runner;
20 import org.junit.runner.notification.RunNotifier;
21
22 public abstract class JUnit4TestReference implements ITestReference {
23     protected Runner fRunner;
24
25     public JUnit4TestReference(Request request) {
26         fRunner= request.getRunner();
27     }
28
29     public void run(TestExecution execution) {
30         final RunNotifier notifier= new RunNotifier();
31         notifier.addListener(new JUnit4TestListener(execution.getListener()));
32         execution.addStopListener(new IStopListener() {
33             public void stop() {
34                 notifier.pleaseStop();
35             }
36         });
37
38         fRunner.run(notifier);
39     }
40 }
41
Popular Tags