提交 af15bd7e 编写于 作者: H henryjen

8022749: Convert junit tests to testng in test/java/lang/invoke

Reviewed-by: mduigou, alanb
Contributed-by: NMani Sarkar <sadhak001@gmail.com>
上级 4a989689
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @library ../../../.. * @library ../../../..
* @build test.java.lang.invoke.AccessControlTest * @build test.java.lang.invoke.AccessControlTest
* @build test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote * @build test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote
* @run junit/othervm test.java.lang.invoke.AccessControlTest * @run testng/othervm test.java.lang.invoke.AccessControlTest
*/ */
package test.java.lang.invoke; package test.java.lang.invoke;
...@@ -36,12 +36,14 @@ package test.java.lang.invoke; ...@@ -36,12 +36,14 @@ package test.java.lang.invoke;
import java.lang.invoke.*; import java.lang.invoke.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.*; import java.util.*;
import org.junit.*; import org.testng.*;
import org.testng.annotations.*;
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodHandles.Lookup.*; import static java.lang.invoke.MethodHandles.Lookup.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
import static org.junit.Assert.*; import static org.testng.Assert.*;
import test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote; import test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote;
......
...@@ -26,20 +26,14 @@ ...@@ -26,20 +26,14 @@
/* @test /* @test
* @summary tests for class-specific values * @summary tests for class-specific values
* @compile ClassValueTest.java * @compile ClassValueTest.java
* @run junit/othervm test.java.lang.invoke.ClassValueTest * @run testng/othervm test.java.lang.invoke.ClassValueTest
*/
/*
Manually:
$ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/lang/invoke/ClassValueTest.java
$ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.lang.invoke.ClassValueTest
Output: .testAdd => 1000 : Integer
*/ */
package test.java.lang.invoke; package test.java.lang.invoke;
import org.junit.*; import org.testng.*;
import static org.junit.Assert.*; import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/** /**
* @author jrose * @author jrose
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandle.invoke * @summary unit tests for java.lang.invoke.MethodHandle.invoke
* @compile InvokeGenericTest.java * @compile InvokeGenericTest.java
* @run junit/othervm test.java.lang.invoke.InvokeGenericTest * @run testng/othervm test.java.lang.invoke.InvokeGenericTest
*/ */
package test.java.lang.invoke; package test.java.lang.invoke;
...@@ -36,10 +36,9 @@ import static java.lang.invoke.MethodHandles.*; ...@@ -36,10 +36,9 @@ import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.*; import java.util.*;
import org.junit.*; import org.testng.*;
import static org.junit.Assert.*; import static org.testng.AssertJUnit.*;
import static org.junit.Assume.*; import org.testng.annotations.*;
/** /**
* *
...@@ -71,7 +70,7 @@ public class InvokeGenericTest { ...@@ -71,7 +70,7 @@ public class InvokeGenericTest {
String testName; String testName;
static int allPosTests, allNegTests; static int allPosTests, allNegTests;
int posTests, negTests; int posTests, negTests;
@After @AfterMethod
public void printCounts() { public void printCounts() {
if (verbosity >= 2 && (posTests | negTests) != 0) { if (verbosity >= 2 && (posTests | negTests) != 0) {
System.out.println(); System.out.println();
......
...@@ -26,19 +26,9 @@ ...@@ -26,19 +26,9 @@
/* @test /* @test
* @summary example code used in javadoc for java.lang.invoke API * @summary example code used in javadoc for java.lang.invoke API
* @compile JavaDocExamplesTest.java * @compile JavaDocExamplesTest.java
* @run junit/othervm test.java.lang.invoke.JavaDocExamplesTest * @run testng/othervm test.java.lang.invoke.JavaDocExamplesTest
*/ */
/*
---- To run outside jtreg:
$ $JAVA7X_HOME/bin/javac -cp $JUNIT4_JAR -d /tmp/Classes \
$DAVINCI/sources/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
$ $JAVA7X_HOME/bin/java -cp $JUNIT4_JAR:/tmp/Classes \
-DJavaDocExamplesTest.verbosity=1 \
test.java.lang.invoke.JavaDocExamplesTest
----
*/
package test.java.lang.invoke; package test.java.lang.invoke;
import java.lang.invoke.*; import java.lang.invoke.*;
...@@ -47,22 +37,21 @@ import static java.lang.invoke.MethodType.*; ...@@ -47,22 +37,21 @@ import static java.lang.invoke.MethodType.*;
import java.util.*; import java.util.*;
import org.junit.*; import org.testng.*;
import static org.junit.Assert.*; import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/** /**
* @author jrose * @author jrose
*/ */
public class JavaDocExamplesTest { public class JavaDocExamplesTest {
/** Wrapper for running the JUnit tests in this module. /** Wrapper for running the TestNG tests in this module.
* Put JUnit on the classpath! * Put TestNG on the classpath!
*/ */
public static void main(String... ignore) throws Throwable { public static void main(String... ignore) throws Throwable {
System.out.println("can run this as:");
System.out.println("$ java org.junit.runner.JUnitCore "+JavaDocExamplesTest.class.getName());
new JavaDocExamplesTest().run(); new JavaDocExamplesTest().run();
} }
public void run() throws Throwable { public void run() throws Throwable {
testFindVirtual(); testFindVirtual();
testPermuteArguments(); testPermuteArguments();
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodType * @summary unit tests for java.lang.invoke.MethodType
* @compile MethodTypeTest.java * @compile MethodTypeTest.java
* @run junit/othervm test.java.lang.invoke.MethodTypeTest * @run testng/othervm test.java.lang.invoke.MethodTypeTest
*/ */
package test.java.lang.invoke; package test.java.lang.invoke;
...@@ -34,8 +34,9 @@ import java.lang.invoke.MethodType; ...@@ -34,8 +34,9 @@ import java.lang.invoke.MethodType;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import org.junit.*; import org.testng.*;
import static org.junit.Assert.*; import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/** /**
* *
...@@ -53,7 +54,7 @@ public class MethodTypeTest { ...@@ -53,7 +54,7 @@ public class MethodTypeTest {
private MethodType[] GALLERY; private MethodType[] GALLERY;
private Method compareTo; private Method compareTo;
@Before @BeforeMethod
public void setUp() throws Exception { public void setUp() throws Exception {
rtype = void.class; rtype = void.class;
ptypes = new Class<?>[] { int.class, String.class }; ptypes = new Class<?>[] { int.class, String.class };
...@@ -94,7 +95,7 @@ public class MethodTypeTest { ...@@ -94,7 +95,7 @@ public class MethodTypeTest {
}; };
} }
@After @AfterMethod
public void tearDown() throws Exception { public void tearDown() throws Exception {
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/* @test /* @test
* @summary unit tests for method handles which permute their arguments * @summary unit tests for method handles which permute their arguments
* @run junit/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
*/ */
/* Examples of manual runs: /* Examples of manual runs:
* java -DPermuteArgsTest.{DRY_RUN=true,MAX_ARITY=253} test.java.lang.invoke.PermuteArgsTest * java -DPermuteArgsTest.{DRY_RUN=true,MAX_ARITY=253} test.java.lang.invoke.PermuteArgsTest
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
package test.java.lang.invoke; package test.java.lang.invoke;
import org.junit.*; import org.testng.*;
import org.testng.annotations.*;
import java.util.*; import java.util.*;
import java.lang.reflect.*; import java.lang.reflect.*;
......
...@@ -25,12 +25,13 @@ ...@@ -25,12 +25,13 @@
/* @test /* @test
* @summary unit tests for method handles which permute their arguments * @summary unit tests for method handles which permute their arguments
* @run junit test.java.lang.invoke.ThrowExceptionsTest * @run testng test.java.lang.invoke.ThrowExceptionsTest
*/ */
package test.java.lang.invoke; package test.java.lang.invoke;
import org.junit.*; import org.testng.*;
import org.testng.annotations.*;
import java.util.*; import java.util.*;
import java.lang.reflect.*; import java.lang.reflect.*;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册