killed obsolete class
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3798 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
41a5a9657f
commit
5d1673011a
|
@ -1 +0,0 @@
|
|||
/******************************************************************************
* 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
*****************************************************************************/
package com.ibm.wala.cast.java.test;
import org.junit.internal.runners.JUnit38ClassRunner;
import org.junit.runner.Description;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
/**
* This horrible kludge is used to get the old getName() Junit 3 functionality when running under JUnit 4.
*/
@SuppressWarnings("restriction")
public class NameAwareTestClassRunner extends JUnit38ClassRunner {
public NameAwareTestClassRunner(Class<?> klass) {
super(klass);
}
private static String testName;
protected static String getName() {
return testName;
}
protected static void setName(final String name) {
testName = name;
}
/**
* get the name of the currently running test when using this runner. Similar to TestCase.getName() from JUnit 3.
*/
protected static String getTestName() {
if (testName == null)
return null;
int last = testName.indexOf('(');
if (last < 0)
last = testName.length() + 1;
return testName.substring(0, last);
}
private static class NameListener extends RunListener {
public void testStarted(Description description) throws Exception {
setName(description.isTest() ? description.getDisplayName() : null);
}
public void testFinished(Description description) throws Exception {
if (getName() != null)
if (getName().equals(description.getDisplayName()))
setName(null);
else
throw new Exception("Test name mismatch");
}
}
public void run(final RunNotifier notifier) {
notifier.addListener(new NameListener());
super.run(notifier);
}
}
|
Loading…
Reference in New Issue