Search in sources :

Example 91 with TestCase

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

the class Filtering method listReturned_01_lambda.

@Test
public void listReturned_01_lambda() {
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        private Values values() {
            Values values = createColumn(0, 1, 2).filter((Integer i) -> Arrays.asList(i, i + 1, i + 2));
            return createColumn("a", "b", "c").pseudoMultiply(values);
        }

        @TestCase
        @TestData("values")
        public void wrongTest(String s, Integer integer) throws Throwable {
            System.out.println("s = " + s);
            System.out.println("integers = " + integer);
        }
    }, TU.EMPTY_ARGV);
    assertTrue(status.isOK());
}
Also used : TestCase(com.sun.tck.test.TestCase) DataFactory.createValues(com.sun.tck.lib.tgf.DataFactory.createValues) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

Example 92 with TestCase

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

the class MyTest method testRun_DataFilteredOutCompletely2.

@Test
public void testRun_DataFilteredOutCompletely2() {
    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;
                }
            });
        }

        @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 : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 93 with TestCase

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

the class MyTest method testRun_Data_partlyFilteredInTheEnd_safetyFilter.

@Test
public void testRun_Data_partlyFilteredInTheEnd_safetyFilter() {
    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 null;
                }
            })).filter(new Object() {

                // if data construction failed, this prefents test failing
                // instead of it test is skipped
                @Transform
                Values safetyFilter(Object... args) {
                    if (args.length != 2) {
                        // just skipping
                        return null;
                    }
                    String s1 = (String) args[0], s2 = (String) args[1];
                    return createRow(s1, s2);
                }
            });
        }

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

Example 94 with TestCase

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

the class MyTest method testRun_DataOK_safetyFilterAtTheEnd.

@Test
public void testRun_DataOK_safetyFilterAtTheEnd() {
    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;
                }
            })).filter(new Object() {

                // if data construction failed, this prefents test failing
                // instead of it test is skipped
                @Transform
                Values safetyFilter(String s1, String s2) {
                    return createRow(s1, s2);
                }
            });
        }

        @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 : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 95 with TestCase

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

the class MyTest method testRun_DataFilteredOutCompletely3.

@Test
public void testRun_DataFilteredOutCompletely3() {
    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;
                }
            }).multiply(1, 2, 3);
        }

        @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)

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