aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/AjcTest.java13
-rw-r--r--testing/src/test/java/org/aspectj/testing/OutputSpec.java9
-rw-r--r--testing/src/test/java/org/aspectj/testing/RunSpec.java32
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java28
4 files changed, 55 insertions, 27 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java
index 14eda67b5..df460aea1 100644
--- a/testing/src/test/java/org/aspectj/testing/AjcTest.java
+++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java
@@ -20,8 +20,8 @@ import org.aspectj.util.LangUtil;
*/
public class AjcTest {
-// private static boolean is13VMOrGreater = true;
- private static boolean is14VMOrGreater = true;
+ // private static boolean is13VMOrGreater = true;
+ private static boolean is1dot4VMOrGreater = true;
private static boolean is15VMOrGreater = false;
private static boolean is16VMOrGreater = false;
private static boolean is17VMOrGreater = false;
@@ -31,9 +31,10 @@ public class AjcTest {
private static boolean is11VMOrGreater = false;
private static boolean is12VMOrGreater = false;
private static boolean is13VMOrGreater = false;
+ private static boolean is14VMOrGreater = false;
static { // matching logic is also in org.aspectj.util.LangUtil
- is14VMOrGreater = LangUtil.is14VMOrGreater();
+ is1dot4VMOrGreater = LangUtil.is1dot4VMOrGreater();
is15VMOrGreater = LangUtil.is15VMOrGreater();
is16VMOrGreater = LangUtil.is16VMOrGreater();
is17VMOrGreater = LangUtil.is17VMOrGreater();
@@ -43,6 +44,7 @@ public class AjcTest {
is11VMOrGreater = LangUtil.is11VMOrGreater();
is12VMOrGreater = LangUtil.is12VMOrGreater();
is13VMOrGreater = LangUtil.is13VMOrGreater();
+ is14VMOrGreater = LangUtil.is14VMOrGreater();
}
private List<ITestStep> testSteps = new ArrayList<ITestStep>();
@@ -80,7 +82,7 @@ public class AjcTest {
public boolean canRunOnThisVM() {
if (vmLevel.equals("1.3")) return true;
boolean canRun = true;
- if (vmLevel.equals("1.4")) canRun = is14VMOrGreater;
+ if (vmLevel.equals("1.4")) canRun = is1dot4VMOrGreater;
if (vmLevel.equals("1.5")) canRun = is15VMOrGreater;
if (vmLevel.equals("1.6")) canRun = is16VMOrGreater;
if (vmLevel.equals("1.7")) canRun = is17VMOrGreater;
@@ -90,9 +92,10 @@ public class AjcTest {
if (vmLevel.equals("11")) canRun = is11VMOrGreater;
if (vmLevel.equals("12")) canRun = is12VMOrGreater;
if (vmLevel.equals("13")) canRun = is13VMOrGreater;
+ if (vmLevel.equals("14")) canRun = is14VMOrGreater;
if (!canRun) {
System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel()
- + ", currently running on " + System.getProperty("java.vm.version"));
+ + ", currently running on " + System.getProperty("java.vm.version"));
}
return canRun;
}
diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java
index 9a6fd5fef..80e928bc9 100644
--- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java
@@ -11,7 +11,6 @@
* ******************************************************************/
package org.aspectj.testing;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
@@ -87,10 +86,8 @@ public class OutputSpec {
expected.addAll(expectedOutputLines);
List<String> found = new ArrayList<String>();
found.addAll(outputFound);
- for (Iterator<String> iterator = outputFound.iterator(); iterator.hasNext();) {
- String lineFound = iterator.next();
- for (Iterator<String> iterator2 = expectedOutputLines.iterator(); iterator2.hasNext();) {
- String lineExpected = iterator2.next();
+ for (String lineFound : outputFound) {
+ for (String lineExpected : expectedOutputLines) {
if (lineFound.indexOf(lineExpected)!= -1) {
found.remove(lineFound);
expected.remove(lineExpected);
@@ -107,7 +104,7 @@ public class OutputSpec {
StringBuffer failMessage = new StringBuffer();
failMessage.append("\n expecting output:\n");
for (String line: expectedOutputLines) {
- failMessage.append("\n");
+ failMessage.append(line+"\n");
}
failMessage.append(" but found output:\n");
failMessage.append(output);
diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java
index 62b93bcb0..22aa0f7bc 100644
--- a/testing/src/test/java/org/aspectj/testing/RunSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- * 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:
+ * 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:
* Adrian Colyer, Abraham Nevado (lucierna)
* ******************************************************************/
package org.aspectj.testing;
@@ -56,16 +56,16 @@ public class RunSpec implements ITestStep {
System.err.println("Warning, message spec for run command is currently ignored (org.aspectj.testing.RunSpec)");
}
String[] args = buildArgs();
-// System.err.println("? execute() inTestCase='" + inTestCase + "', ltwFile=" + ltwFile);
+ // System.err.println("? execute() inTestCase='" + inTestCase + "', ltwFile=" + ltwFile);
boolean useLtw = copyLtwFile(inTestCase.getSandboxDirectory());
-
+
copyXlintFile(inTestCase.getSandboxDirectory());
try {
setSystemProperty("test.base.dir", inTestCase.getSandboxDirectory().getAbsolutePath());
AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw));
- if (stdErrSpec != null) {
+ if (stdErrSpec != null) {
stdErrSpec.matchAgainst(rr.getStdErr(), orderedStderr);
}
if (stdOutSpec != null) {
@@ -121,7 +121,7 @@ public class RunSpec implements ITestStep {
public void setTest(AjcTest test) {
this.myTest = test;
}
-
+
public AjcTest getTest() {
return this.myTest;
}
@@ -149,7 +149,7 @@ public class RunSpec implements ITestStep {
public void setModulepath(String mpath) {
this.mpath = mpath;
}
-
+
public void setClasspath(String cpath) {
this.cpath = cpath;
}
@@ -165,19 +165,19 @@ public class RunSpec implements ITestStep {
public void setOrderedStderr(String orderedStderr) {
this.orderedStderr = orderedStderr;
}
-
+
public String getClassToRun() {
return classToRun;
}
-
+
public void setClassToRun(String classToRun) {
this.classToRun = classToRun;
}
-
+
public void setModuleToRun(String moduleToRun) {
this.moduleToRun = moduleToRun;
}
-
+
public String getModuleToRun() {
return this.moduleToRun;
}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java
new file mode 100644
index 000000000..15c1ac568
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java
@@ -0,0 +1,28 @@
+/* *******************************************************************
+ * Copyright (c) 2020 Contributors
+ * 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 org.aspectj.testing;
+
+import org.aspectj.util.LangUtil;
+
+/**
+ * Makes sure tests are running on the right level of JDK.
+ *
+ * @author Andy Clement
+ */
+public abstract class XMLBasedAjcTestCaseForJava14OrLater extends XMLBasedAjcTestCase {
+
+ @Override
+ public void runTest(String title) {
+ if (!LangUtil.is14VMOrGreater()) {
+ throw new IllegalStateException("These tests should be run on Java 14 or later");
+ }
+ super.runTest(title);
+ }
+
+}