use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_strings.
@org.junit.Test
public void iteratorAsReturnType_strings() {
final List<String> is = new ArrayList<String>();
final List<String> js = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<Object[]> stringITerator = Arrays.<Object[]>asList(new String[] { "a", "b" }, new String[] { "v", "n" }).iterator();
@TestCase
@TestData("stringITerator")
public void test(String i, String j) throws Throwable {
is.add(i);
js.add(j);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(2, is.size());
Assert.assertEquals(2, js.size());
Assert.assertEquals("a", is.get(0));
Assert.assertEquals("b", js.get(0));
Assert.assertEquals("v", is.get(1));
Assert.assertEquals("n", js.get(1));
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_String_2.
@org.junit.Test
public void iteratorAsReturnType_String_2() {
final List<String> passed = new ArrayList<>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<String> strings = Arrays.asList("a", "bb", "cc").iterator();
@TestCase
public void test(@TestData("strings") String s) throws Throwable {
passed.add(s);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(3, passed.size());
Assert.assertEquals(passed.get(0), "a");
Assert.assertEquals(passed.get(1), "bb");
Assert.assertEquals(passed.get(2), "cc");
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class ReferenceAttachedToParam method mixed_mult_3.
@org.junit.Test
public void mixed_mult_3() {
final List<Class<?>> list_1 = new ArrayList<Class<?>>();
final List<String> list_2 = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
private Values classes_ = DataFactory.createColumn(String.class, Throwable.class);
@TestCase
@Operation(Operation.TYPE.MULTIPLY)
public void test(@TestData("classes_") Class<?> c, @Strings({ "x", "y", "z" }) String s) throws Throwable {
list_1.add(c);
list_2.add(s);
}
});
Assert.assertTrue(status.isOK());
Assert.assertEquals(6, list_1.size());
Assert.assertEquals(6, list_2.size());
Assert.assertEquals(String.class, list_1.get(0));
Assert.assertEquals(String.class, list_1.get(1));
Assert.assertEquals(String.class, list_1.get(2));
Assert.assertEquals(Throwable.class, list_1.get(3));
Assert.assertEquals(Throwable.class, list_1.get(4));
Assert.assertEquals(Throwable.class, list_1.get(5));
Assert.assertEquals("x", list_2.get(0));
Assert.assertEquals("y", list_2.get(1));
Assert.assertEquals("z", list_2.get(2));
Assert.assertEquals("x", list_2.get(3));
Assert.assertEquals("y", list_2.get(4));
Assert.assertEquals("z", list_2.get(5));
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class ReferenceAttachedToParam method class_1.
@org.junit.Test
public void class_1() {
final List<Class<?>> list = new ArrayList<Class<?>>();
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
Class<?>[] classes = { String.class, Throwable.class };
@TestCase
public void test(@TestData("classes") Class<?> c) throws Throwable {
list.add(c);
}
});
Assert.assertTrue(status.isOK());
Assert.assertEquals(2, list.size());
Assert.assertEquals(String.class, list.get(0));
Assert.assertEquals(Throwable.class, list.get(1));
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class ReferenceAttachedToParam method mixed_default.
@org.junit.Test
public void mixed_default() {
final List<Class<?>> list_1 = new ArrayList<Class<?>>();
final List<String> list_2 = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
Values strings_ = DataFactory.createColumn("a", "b", "c");
Class<?>[] classes = { String.class, Throwable.class };
@TestCase
public void test(@TestData("classes") Class<?> c, @TestData("strings_") String s) throws Throwable {
list_1.add(c);
list_2.add(s);
}
});
Assert.assertTrue(status.isOK());
Assert.assertEquals(3, list_1.size());
Assert.assertEquals(3, list_2.size());
Assert.assertEquals(String.class, list_1.get(0));
Assert.assertEquals(Throwable.class, list_1.get(1));
Assert.assertEquals(String.class, list_1.get(2));
Assert.assertEquals("a", list_2.get(0));
Assert.assertEquals("b", list_2.get(1));
Assert.assertEquals("c", list_2.get(2));
}
Aggregations