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

Reviewed-by: mduigou, alanb
This commit is contained in:
Mani Sarkar 2013-08-12 12:11:04 -07:00 committed by Henry Jen
parent d0479145f3
commit 4f76f09719
7 changed files with 33 additions and 46 deletions

View File

@ -28,7 +28,7 @@
* @library ../../../..
* @build test.java.lang.invoke.AccessControlTest
* @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;
@ -36,12 +36,14 @@ package test.java.lang.invoke;
import java.lang.invoke.*;
import java.lang.reflect.*;
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.Lookup.*;
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;

View File

@ -26,20 +26,14 @@
/* @test
* @summary tests for class-specific values
* @compile ClassValueTest.java
* @run junit/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
* @run testng/othervm test.java.lang.invoke.ClassValueTest
*/
package test.java.lang.invoke;
import org.junit.*;
import static org.junit.Assert.*;
import org.testng.*;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/**
* @author jrose

View File

@ -26,7 +26,7 @@
/* @test
* @summary unit tests for java.lang.invoke.MethodHandle.invoke
* @compile InvokeGenericTest.java
* @run junit/othervm test.java.lang.invoke.InvokeGenericTest
* @run testng/othervm test.java.lang.invoke.InvokeGenericTest
*/
package test.java.lang.invoke;
@ -36,10 +36,9 @@ import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
import java.lang.reflect.*;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
import org.testng.*;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/**
*
@ -71,7 +70,7 @@ public class InvokeGenericTest {
String testName;
static int allPosTests, allNegTests;
int posTests, negTests;
@After
@AfterMethod
public void printCounts() {
if (verbosity >= 2 && (posTests | negTests) != 0) {
System.out.println();

View File

@ -26,19 +26,9 @@
/* @test
* @summary example code used in javadoc for java.lang.invoke API
* @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;
import java.lang.invoke.*;
@ -47,22 +37,21 @@ import static java.lang.invoke.MethodType.*;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
import org.testng.*;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/**
* @author jrose
*/
public class JavaDocExamplesTest {
/** Wrapper for running the JUnit tests in this module.
* Put JUnit on the classpath!
/** Wrapper for running the TestNG tests in this module.
* Put TestNG on the classpath!
*/
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();
}
public void run() throws Throwable {
testFindVirtual();
testPermuteArguments();

View File

@ -24,7 +24,7 @@
/* @test
* @summary unit tests for java.lang.invoke.MethodType
* @compile MethodTypeTest.java
* @run junit/othervm test.java.lang.invoke.MethodTypeTest
* @run testng/othervm test.java.lang.invoke.MethodTypeTest
*/
package test.java.lang.invoke;
@ -34,8 +34,9 @@ import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
import org.testng.*;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/**
*
@ -53,7 +54,7 @@ public class MethodTypeTest {
private MethodType[] GALLERY;
private Method compareTo;
@Before
@BeforeMethod
public void setUp() throws Exception {
rtype = void.class;
ptypes = new Class<?>[] { int.class, String.class };
@ -94,7 +95,7 @@ public class MethodTypeTest {
};
}
@After
@AfterMethod
public void tearDown() throws Exception {
}

View File

@ -25,7 +25,7 @@
/* @test
* @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:
* java -DPermuteArgsTest.{DRY_RUN=true,MAX_ARITY=253} test.java.lang.invoke.PermuteArgsTest
@ -35,7 +35,8 @@
package test.java.lang.invoke;
import org.junit.*;
import org.testng.*;
import org.testng.annotations.*;
import java.util.*;
import java.lang.reflect.*;

View File

@ -25,12 +25,13 @@
/* @test
* @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;
import org.junit.*;
import org.testng.*;
import org.testng.annotations.*;
import java.util.*;
import java.lang.reflect.*;