use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class DataQueriesFromFields method test_1.
@org.junit.Test
public void test_1() {
final Set<Integer> set = new HashSet<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
private ValuesHolder holder = new ValuesHolder();
@TestCase
@TestData("holder.setup")
public void test(int i) throws Throwable {
set.add(i);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(4, set.size());
Assert.assertTrue(set.contains(1));
Assert.assertTrue(set.contains(3));
Assert.assertTrue(set.contains(7));
Assert.assertTrue(set.contains(9));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class DataQueriesFromFields method test_3.
@org.junit.Test
public void test_3() {
final Set<Integer> set = new HashSet<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
private ValuesHolder3 holder3 = new ValuesHolder3();
@TestCase
@TestData("holder3.holder2.holder.setup")
public void test(int i) throws Throwable {
set.add(i);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(4, set.size());
Assert.assertTrue(set.contains(1));
Assert.assertTrue(set.contains(3));
Assert.assertTrue(set.contains(7));
Assert.assertTrue(set.contains(9));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class InlinedArgData_ManyArgs method intString_1_old.
@org.junit.Test
public void intString_1_old() {
final List<Integer> ints = new ArrayList<Integer>();
final List<String> strings = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Values data = DataFactory.createColumn(1, 2, 3).pseudoMultiply("a", "b");
@TestCase
@TestData("data")
public void test(int i, String s) {
ints.add(i);
strings.add(s);
System.out.println(MessageFormat.format("i = {0}, s = {1}", i, s));
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(3, ints.size());
Assert.assertEquals(1, ints.get(0), 0.0);
Assert.assertEquals(2, ints.get(1), 0.0);
Assert.assertEquals(3, ints.get(2), 0.0);
Assert.assertEquals(3, strings.size());
Assert.assertEquals("a", strings.get(0));
Assert.assertEquals("b", strings.get(1));
Assert.assertEquals("a", strings.get(2));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method test_04_IteratorOfIntegers_2.
@Test
public void test_04_IteratorOfIntegers_2() {
@TestGroup
class Test {
Iterator<Integer> component = IntStream.range(55, 98).iterator();
int counter;
@TestCase
public void test(@TestData("component") int r) {
counter++;
}
}
Test tg = new Test();
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
Assert.assertTrue(s.isOK());
Assert.assertEquals(43, tg.counter);
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_mix.
@org.junit.Test
public void iteratorAsReturnType_mix() {
final List<Integer> is = new ArrayList<Integer>();
final List<Integer> js = new ArrayList<Integer>();
final List<String> strings = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<Object[]> mixIterator = Arrays.<Object[]>asList(new Object[] { 89898, 176253, "123" }, new Object[] { 34324, 343424, "345" }).iterator();
@TestCase
@TestData("mixIterator")
public void test(int i, int j, String s) throws Throwable {
is.add(i);
js.add(j);
strings.add(s);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(2, is.size());
Assert.assertEquals(2, js.size());
Assert.assertEquals(2, strings.size());
Assert.assertEquals(89898, (int) is.get(0));
Assert.assertEquals(176253, (int) js.get(0));
Assert.assertEquals("123", strings.get(0));
Assert.assertEquals(34324, (int) is.get(1));
Assert.assertEquals(343424, (int) js.get(1));
Assert.assertEquals("345", strings.get(1));
}
Aggregations