Просмотр исходного кода

Update to JUnit 4.13

Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
tags/V1_9_7M1
Lars Grefer 3 лет назад
Родитель
Сommit
48522f987f

+ 0
- 4
ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java Просмотреть файл

private BuildConfigManager buildConfigManager = new LstBuildConfigManager(); private BuildConfigManager buildConfigManager = new LstBuildConfigManager();


public static void main(String[] args) {
junit.swingui.TestRunner.run(LstBuildConfigManagerTest.class);
}

public static TestSuite suite() { public static TestSuite suite() {
TestSuite result = new TestSuite(); TestSuite result = new TestSuite();
result.addTestSuite(LstBuildConfigManagerTest.class); result.addTestSuite(LstBuildConfigManagerTest.class);

+ 0
- 4
ajde/src/test/java/org/aspectj/ajde/ui/StructureSearchManagerTest.java Просмотреть файл

* @author Mik Kersten * @author Mik Kersten
*/ */
public class StructureSearchManagerTest extends AjdeTestCase { public class StructureSearchManagerTest extends AjdeTestCase {
public static void main(String[] args) {
junit.swingui.TestRunner.run(StructureSearchManagerTest.class);
}


public static TestSuite suite() { public static TestSuite suite() {
TestSuite result = new TestSuite(); TestSuite result = new TestSuite();

+ 0
- 4
ajde/src/test/java/org/aspectj/ajde/ui/StructureViewManagerTest.java Просмотреть файл

private File testFile; private File testFile;
private StructureViewProperties properties; private StructureViewProperties properties;


public static void main(String[] args) {
junit.swingui.TestRunner.run(StructureViewManagerTest.class);
}

public static TestSuite suite() { public static TestSuite suite() {
TestSuite result = new TestSuite(); TestSuite result = new TestSuite();
result.addTestSuite(StructureViewManagerTest.class); result.addTestSuite(StructureViewManagerTest.class);

+ 1
- 1
pom.xml Просмотреть файл

<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

+ 1
- 1
testing-util/pom.xml Просмотреть файл

<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jdiff</groupId> <groupId>jdiff</groupId>

+ 31
- 14
testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java Просмотреть файл

import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.net.URLClassLoader;
import java.util.*;


import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.MessageUtil;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestResult; import junit.framework.TestResult;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import junit.runner.TestCaseClassLoader;
import sun.net.www.ParseUtil;


/** /**
* Things that junit should perhaps have, but doesn't. Note the file-comparison methods require JDiff to run, but JDiff types are * Things that junit should perhaps have, but doesn't. Note the file-comparison methods require JDiff to run, but JDiff types are
public static Object runMethod(String classPath, String className, String methodName, Object[] args) { public static Object runMethod(String classPath, String className, String methodName, Object[] args) {
classPath += File.pathSeparator + System.getProperty("java.class.path"); classPath += File.pathSeparator + System.getProperty("java.class.path");


ClassLoader loader = new TestCaseClassLoader(classPath);
ClassLoader loader = new URLClassLoader(pathToURLs(classPath), null);


Class c = null; Class c = null;
try { try {
return Reflection.invokestaticN(c, methodName, args); return Reflection.invokestaticN(c, methodName, args);
} }


/**
* @see sun.misc.URLClassPath#pathToURLs(String)
*/
public static URL[] pathToURLs(String path) {
StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
URL[] urls = new URL[st.countTokens()];
int count = 0;
while (st.hasMoreTokens()) {
File f = new File(st.nextToken());
try {
f = new File(f.getCanonicalPath());
} catch (IOException x) {
// use the non-canonicalized filename
}
try {
urls[count++] = ParseUtil.fileToEncodedURL(f);
} catch (IOException x) { }
}

if (urls.length != count) {
URL[] tmp = new URL[count];
System.arraycopy(urls, 0, tmp, 0, count);
urls = tmp;
}
return urls;
}

/** /**
* Checks that two multi-line strings have the same value. Each line is trimmed before comparision Produces an error on the * Checks that two multi-line strings have the same value. Each line is trimmed before comparision Produces an error on the
* particular line of conflict * particular line of conflict

+ 1
- 1
testing/pom.xml Просмотреть файл

<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons</groupId> <groupId>commons</groupId>

+ 1
- 1
testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java Просмотреть файл

return testMap; return testMap;
} }


public static Test loadSuite(Class<?> testCaseClass) {
public static Test loadSuite(Class<? extends TestCase> testCaseClass) {
TestSuite suite = new TestSuite(testCaseClass.getName()); TestSuite suite = new TestSuite(testCaseClass.getName());
//suite.addTestSuite(testCaseClass); //suite.addTestSuite(testCaseClass);



+ 2
- 1
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java Просмотреть файл

import java.util.Map; import java.util.Map;
import java.util.Stack; import java.util.Stack;


import junit.framework.TestCase;
import org.apache.commons.digester.Digester; import org.apache.commons.digester.Digester;
import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.JavaClass;
* @param testCaseClass * @param testCaseClass
* @return * @return
*/ */
public static Test loadSuite(Class<?> testCaseClass) {
public static Test loadSuite(Class<? extends TestCase> testCaseClass) {
TestSuite suite = new TestSuite(testCaseClass.getName()); TestSuite suite = new TestSuite(testCaseClass.getName());
suite.addTestSuite(testCaseClass); suite.addTestSuite(testCaseClass);
TestSetup wrapper = new TestSetup(suite) { TestSetup wrapper = new TestSetup(suite) {

+ 0
- 4
testing/src/test/java/org/aspectj/testing/util/StructureModelUtilTest.java Просмотреть файл

"figures" + File.separator + "primitives" + File.separator + "planar" + File.separator + "Point.java", "figures" + File.separator + "primitives" + File.separator + "planar" + File.separator + "Point.java",
"figures" + File.separator + "primitives" + File.separator + "solid" + File.separator + "SolidPoint.java" }; "figures" + File.separator + "primitives" + File.separator + "solid" + File.separator + "SolidPoint.java" };


public static void main(String[] args) {
junit.swingui.TestRunner.run(StructureModelUtilTest.class);
}

public static TestSuite suite() { public static TestSuite suite() {
TestSuite result = new TestSuite(); TestSuite result = new TestSuite();
result.addTestSuite(StructureModelUtilTest.class); result.addTestSuite(StructureModelUtilTest.class);

Загрузка…
Отмена
Сохранить