Search in sources :

Example 61 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class InvalidTestCases method overLoaded_3.

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

        private String[] setup_1() {
            return new String[] { "2", "dd", "df", "fg", "sfsd", "dfg" };
        }

        private Integer[] setup_2() {
            return new Integer[] { 334, 0, -2, 34 };
        }

        @TestCase
        @TestData("setup_1")
        public void test_1(String s) {
        }

        @TestCase
        @TestData("setup_2")
        public void test_1(int i) {
        }
    }, TU.EMPTY_ARGV);
    assertTrue(!status.isOK());
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) NonTestCase(com.oracle.tck.lib.autd2.NonTestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Test(org.junit.Test)

Example 62 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class InvalidTestCases method noTestCaseAnn_onlyTestData_03.

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

            protected void myTest00() {
            }

            @TestCase
            public void myTest01() {
            }

            @TestCase
            @TestData("something")
            public void myTest02(String s) {
            }

            @TestData("werlwerlkdjfgljdsfg")
            protected void myTest04(String s) {
            }

            @TestData("somethingsomething")
            protected void myTest05(String s) {
            }
        }, TU.EMPTY_ARGV);
        Assert.fail("IAE was not thrown");
    } catch (IllegalArgumentException e) {
        final String s1 = MARKING_METHOD_ONLY_WITH_TEST_DATA_IS_NOT_ALLOWED_PLEASE_ADD_TEST_CASE_ANNOTATION_TO_METHOD + "myTest04\".";
        final String s2 = MARKING_METHOD_ONLY_WITH_TEST_DATA_IS_NOT_ALLOWED_PLEASE_ADD_TEST_CASE_ANNOTATION_TO_METHOD + "myTest05\".";
        assertTrue(s1.equals(e.getMessage()) || s2.equals(e.getMessage()));
    }
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) NonTestCase(com.oracle.tck.lib.autd2.NonTestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Test(org.junit.Test)

Example 63 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class InvalidTestCases method noTestCaseAnn_onlyTestData_04.

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

            @TestData("blabla")
            void myTest04() {
            }

            @TestCase
            public void myTest02() {
            }
        }, TU.EMPTY_ARGV);
        Assert.fail("IAE was not thrown");
    } catch (IllegalArgumentException e) {
        assertEquals(MARKING_METHOD_ONLY_WITH_TEST_DATA_IS_NOT_ALLOWED_PLEASE_ADD_TEST_CASE_ANNOTATION_TO_METHOD + "myTest04\".", e.getMessage());
    }
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) TestCase(com.sun.tck.test.TestCase) NonTestCase(com.oracle.tck.lib.autd2.NonTestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Test(org.junit.Test)

Example 64 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class InvalidTestCases method noTestCaseAnn_onlyTestData_01.

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

            @TestData("something")
            protected void myTest01(int i) {
            }
        }, TU.EMPTY_ARGV);
        Assert.fail("IAE was not thrown");
    } catch (IllegalArgumentException e) {
        assertEquals(MARKING_METHOD_ONLY_WITH_TEST_DATA_IS_NOT_ALLOWED_PLEASE_ADD_TEST_CASE_ANNOTATION_TO_METHOD + "myTest01\".", e.getMessage());
    }
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Test(org.junit.Test)

Aggregations

TestData (com.sun.tck.lib.tgf.TestData)64 TestCase (com.sun.tck.test.TestCase)57 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)50 Test (org.junit.Test)37 ArrayList (java.util.ArrayList)30 Values (com.sun.tck.lib.tgf.Values)22 TestResult (com.oracle.tck.lib.autd2.TestResult)14 TestGroup (com.sun.tck.test.TestGroup)7 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)5 HashSet (java.util.HashSet)5 Color (java.awt.Color)4 List (java.util.List)4 ColorSpace (java.awt.color.ColorSpace)3 Collectors.toList (java.util.stream.Collectors.toList)3 Assert.assertEquals (com.sun.tck.lib.Assert.assertEquals)2 Assert.assertTrue (com.sun.tck.lib.Assert.assertTrue)2 ExpectedExceptions (com.sun.tck.lib.ExpectedExceptions)2 DataFactory (com.sun.tck.lib.tgf.DataFactory)2 DataFactory.createColumn (com.sun.tck.lib.tgf.DataFactory.createColumn)2 DataFactory.createRow (com.sun.tck.lib.tgf.DataFactory.createRow)2