Search in sources :

Example 11 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.

the class Exclusion method checkNothingFound.

private void checkNothingFound(String[] args) {
    final int[] methodCounter = new int[] { 0 };
    final ArrayList<Integer> expectedArgValues = new ArrayList<Integer>() {

        {
            add(1);
            add(2);
            add(3);
        }
    };
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        protected Values mySetup() {
            return DataFactory.createColumn(1, 2, 3);
        }

        @TestCase
        @TestData("mySetup")
        public void myTest(int i) {
            Assert.assertTrue(i + " is not among expected", expectedArgValues.contains(i));
            methodCounter[0]++;
        }
    }, args);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(3, methodCounter[0]);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 12 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.

the class Exclusion method check_ExcludeWholeTest.

private void check_ExcludeWholeTest(String... args) {
    final int[] methodCounter = new int[] { 0 };
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        protected Values mySetup() {
            return DataFactory.createColumn(1, 2, 3);
        }

        @TestCase
        @TestData("mySetup")
        public void myTest(int i) {
            methodCounter[0]++;
        }
    }, args);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(0, methodCounter[0]);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup)

Example 13 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.

the class Exclusion method check_2.

private void check_2(String... args) {
    final int[] methodCounter = new int[] { 0 };
    final int[] blablaCounter = new int[] { 0 };
    final int[] fooCounter = new int[] { 0 };
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        protected Values mySetup() {
            return DataFactory.createColumn(11, 22, 33, 44, 55);
        }

        @TestCase
        @TestData("mySetup")
        public void myTest(int i) {
            methodCounter[0]++;
        }

        @TestCase
        @TestData("mySetup")
        public void blabla(int i) {
            blablaCounter[0]++;
        }

        @TestCase
        @TestData("mySetup")
        public void foo(int i) {
            fooCounter[0]++;
        }
    }, args);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(5, methodCounter[0]);
    Assert.assertEquals(0, blablaCounter[0]);
    Assert.assertEquals(0, fooCounter[0]);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup)

Example 14 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.

the class Exclusion method check_Mixed_4.

private void check_Mixed_4(List<Integer> allData, List<Integer> expectedPassedToTestCase, String expectedStatusMessage, final int expectedMyTestCounter, final int expectedBlablaCounter, String... args) {
    final int[] myTestCounter = new int[] { 0 };
    final int[] blablaCounter = new int[] { 0 };
    final int[] fooCounter = new int[] { 0 };
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        private List mySetup() {
            return allData;
        }

        @TestCase
        public void myTest() {
            myTestCounter[0]++;
        }

        @TestCase
        public void blabla() {
            blablaCounter[0]++;
        }

        @TestCase
        @TestData("mySetup")
        public void foo(int i) {
            Assert.assertEquals((int) expectedPassedToTestCase.get(fooCounter[0]), i);
            fooCounter[0]++;
        }
    }, args);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(expectedStatusMessage, status.toString());
    Assert.assertEquals(expectedMyTestCounter, myTestCounter[0]);
    Assert.assertEquals(expectedBlablaCounter, blablaCounter[0]);
    Assert.assertEquals(expectedPassedToTestCase.size(), fooCounter[0]);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) List(java.util.List) ArrayList(java.util.ArrayList)

Example 15 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.

the class Exclusion method test_excludedArg.

@Test
public void test_excludedArg() {
    final int[] methodCounter = new int[] { 0 };
    final ArrayList<Integer> expectedArgValues = new ArrayList<Integer>() {

        {
            add(2);
            add(3);
        }
    };
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        protected Values mySetup() {
            return DataFactory.createColumn(1, 2, 3);
        }

        @TestCase
        @TestData("mySetup")
        public void myTest(int i) {
            Assert.assertTrue(i + " is not among expected", expectedArgValues.contains(i));
            methodCounter[0]++;
        }
    }, new String[] { EXCLUDE_WORD, "myTest" });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(0, methodCounter[0]);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Aggregations

BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)132 TestCase (com.sun.tck.test.TestCase)126 ArrayList (java.util.ArrayList)73 Test (org.junit.Test)62 TestData (com.sun.tck.lib.tgf.TestData)47 Values (com.sun.tck.lib.tgf.Values)21 HashSet (java.util.HashSet)13 DataFactory.createValues (com.sun.tck.lib.tgf.DataFactory.createValues)12 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)11 TestResult (com.oracle.tck.lib.autd2.TestResult)11 TestObject (com.oracle.tck.lib.autd2.unittests.TestObject)9 Operation (com.sun.tck.lib.tgf.data.Operation)8 java.util (java.util)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2 com.oracle.tck.lib.autd2 (com.oracle.tck.lib.autd2)1 CustomException (com.oracle.tck.lib.autd2.unittests.CustomException)1 TU (com.oracle.tck.lib.autd2.unittests.TU)1 ValuesComparison (com.oracle.tck.lib.autd2.unittests.ValuesComparison)1 com.sun.tck.lib.tgf (com.sun.tck.lib.tgf)1