| /******************************************************************************* |
| * Copyright (c) 2006 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * David Saff (saff@mit.edu) - initial API and implementation |
| * (bug 102632: [JUnit] Support for JUnit 4.) |
| *******************************************************************************/ |
| |
| package org.eclipse.jdt.internal.junit4.runner; |
| |
| import org.eclipse.jdt.internal.junit.runner.IStopListener; |
| import org.eclipse.jdt.internal.junit.runner.ITestReference; |
| import org.eclipse.jdt.internal.junit.runner.TestExecution; |
| import org.junit.runner.Request; |
| import org.junit.runner.Runner; |
| import org.junit.runner.notification.RunNotifier; |
| |
| public abstract class JUnit4TestReference implements ITestReference { |
| protected Runner fRunner; |
| |
| public JUnit4TestReference(Request request) { |
| fRunner= request.getRunner(); |
| } |
| |
| public void run(TestExecution execution) { |
| final RunNotifier notifier= new RunNotifier(); |
| notifier.addListener(new JUnit4TestListener(execution.getListener())); |
| execution.addStopListener(new IStopListener() { |
| public void stop() { |
| notifier.pleaseStop(); |
| } |
| }); |
| |
| fRunner.run(notifier); |
| } |
| } |