use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method testedAPI_noTestedAPI.
@Test
public void testedAPI_noTestedAPI() {
@TestGroup
class MyTest {
@TestCase
@TestedStatement("a statement")
public void testCase() {
Assert.fail();
}
}
TestResult s = TU.runTestGroup(new MyTest(), TU.EMPTY_ARGV);
Assert.assertTrue(!s.isOK());
Assert.assertEquals("test cases: 1; all failed", s.getMessage());
}
use of com.sun.tck.test.TestGroup 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.test.TestGroup in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method test_04_IteratorOfObjectArrays_01.
@Test
public void test_04_IteratorOfObjectArrays_01() {
@TestGroup
class Test {
Iterator<Object[]> component = Arrays.asList(new Object[] { 1, "1" }, new Object[] { 2, "3" }, new Object[] { 6, "4" }, new Object[] { 5, "5" }).iterator();
int counter = 0;
@TestCase
@TestData("component")
public void test(int x, String s) {
counter++;
}
}
Test tg = new Test();
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
Assert.assertTrue(s.isOK());
Assert.assertEquals(4, tg.counter);
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method test_04_IteratorOfIntegers_01.
@Test
public void test_04_IteratorOfIntegers_01() {
@TestGroup
class Test {
Iterator<Integer> component = Arrays.asList(1, 2, 3, 4, 5).iterator();
int counter = 0;
@TestCase
public void test(@TestData("component") int x) {
counter++;
}
}
Test tg = new Test();
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
Assert.assertTrue(s.isOK());
Assert.assertEquals(5, tg.counter);
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class BigDecimalTestSample method test.
@org.junit.Test
public void test() {
@TestGroup
class MyBigDecimalTest {
Values setup_1() {
return DataFactory.createColumn(valueOf(0), valueOf(3)).multiply(valueOf(63), valueOf(17));
}
Values setup_2() {
return DataFactory.createColumn(valueOf(1), valueOf(4)).multiply(valueOf(33), valueOf(7));
}
Values setup_3() {
return setup_1().unite(setup_2());
}
@TestCase
@TestData("setup_3")
public void testMultiply(BigDecimal instance, BigDecimal anotherInstance) {
long expectedResult = instance.longValue() * anotherInstance.longValue();
BigDecimal result = instance.multiply(anotherInstance);
Assert.assertEquals(expectedResult, result.longValue());
}
@TestCase
@TestData("setup_2")
public void testAdd(BigDecimal instance, BigDecimal anotherInstance) {
long expectedResult = instance.longValue() + anotherInstance.longValue();
BigDecimal result = instance.add(anotherInstance);
Assert.assertEquals(expectedResult, result.longValue());
}
}
final MyBigDecimalTest test = new MyBigDecimalTest();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(test, TU.EMPTY_ARGV);
assertTrue(status.isOK());
System.out.println(status);
}
Aggregations