Search in sources :

Example 36 with TestCase

use of com.sun.tck.test.TestCase in project jtharness by openjdk.

the class MyTest method test_dataFilteredOutCompletely_NotAppEx_messageChecking.

@Test
public void test_dataFilteredOutCompletely_NotAppEx_messageChecking() {
    final ArrayList<String> arrayList = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        Values setupOne() {
            return createColumn(1, 2).filter(new Object() {

                @Transform
                String filterOut(int i) {
                    return null;
                }
            }).filter(new Object() {

                @Transform
                String end(String s) {
                    return "abc";
                }
            });
        }

        @TestCase
        @TestData("setupOne")
        public void myTest(String s) {
            arrayList.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertEquals(0, arrayList.size());
    Assert.assertTrue(status.isOK());
    Assert.assertEquals("Passed. test cases: 1; all passed", status.toString());
}
Also used : BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 37 with TestCase

use of com.sun.tck.test.TestCase in project jtharness by openjdk.

the class MyTest method testRun_DataOK.

@Test
public void testRun_DataOK() {
    final ArrayList<String> arrayList = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        Values setupOne() {
            return createColumn(1, 2).filter(new Object() {

                @Transform
                String filterOut(int i) {
                    return "a";
                }
            }).multiply(createColumn("a", "b", "d").filter(new Object() {

                @Transform
                String end(String s) {
                    return s;
                }
            }));
        }

        @TestCase
        @TestData("setupOne")
        public void myTest(String s1, String s2) {
            arrayList.add(s1);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertEquals(6, arrayList.size());
    Assert.assertTrue(status.isOK());
    Assert.assertEquals("Passed. test cases: 1; all passed", status.toString());
}
Also used : BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 38 with TestCase

use of com.sun.tck.test.TestCase in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_shorts_special_case.

@org.junit.Test
public void arrayAsReturnType_shorts_special_case() {
    final List<Short> is = new ArrayList<Short>();
    final List<Short> js = new ArrayList<Short>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        short[][] shorts = { { 23234, 23400 } };

        @TestCase
        @TestData("shorts")
        public void test(short i, short j) throws Throwable {
            is.add(i);
            js.add(j);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(1, is.size());
    Assert.assertEquals(1, js.size());
    Assert.assertEquals(23234, (short) is.get(0));
    Assert.assertEquals(23400, (short) js.get(0));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 39 with TestCase

use of com.sun.tck.test.TestCase in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_long.

@org.junit.Test
public void arrayAsReturnType_long() {
    final Set<Long> set = new HashSet<Long>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        long[] longs = { Long.MIN_VALUE, Long.MAX_VALUE, 523400023467l, 23424234332424l };

        @TestCase
        public void test(@TestData("longs") long l) throws Throwable {
            set.add(l);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(Long.MIN_VALUE));
    Assert.assertTrue(set.contains(Long.MAX_VALUE));
    Assert.assertTrue(set.contains(523400023467l));
    Assert.assertTrue(set.contains(23424234332424l));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 40 with TestCase

use of com.sun.tck.test.TestCase in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_double.

@org.junit.Test
public void arrayAsReturnType_double() {
    final Set<Double> set = new HashSet<Double>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        double[] doubles = { 0., 3.4, 67.3456, Double.MAX_VALUE };

        @TestCase
        public void test(@TestData("doubles") double d) throws Throwable {
            set.add(d);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(0.));
    Assert.assertTrue(set.contains(3.4));
    Assert.assertTrue(set.contains(67.3456));
    Assert.assertTrue(set.contains(Double.MAX_VALUE));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Aggregations

TestCase (com.sun.tck.test.TestCase)147 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)126 Test (org.junit.Test)77 ArrayList (java.util.ArrayList)72 TestData (com.sun.tck.lib.tgf.TestData)57 TestResult (com.oracle.tck.lib.autd2.TestResult)28 Values (com.sun.tck.lib.tgf.Values)28 HashSet (java.util.HashSet)13 DataFactory.createValues (com.sun.tck.lib.tgf.DataFactory.createValues)12 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)10 Operation (com.sun.tck.lib.tgf.data.Operation)10 TestObject (com.oracle.tck.lib.autd2.unittests.TestObject)9 PrintWriter (java.io.PrintWriter)8 InOrder (org.mockito.InOrder)8 List (java.util.List)4 DataFactory.createColumn (com.sun.tck.lib.tgf.DataFactory.createColumn)3 DataFactory.createRow (com.sun.tck.lib.tgf.DataFactory.createRow)3 java.util (java.util)3 Assert (org.junit.Assert)3 Assert.assertEquals (com.sun.tck.lib.Assert.assertEquals)2