Search in sources :

Example 56 with TestCase

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

the class DataQueriesFromFields method test_5.

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

        private ValuesHolder4 holder4 = new ValuesHolder4();

        @TestCase
        @TestData("holder4.ints")
        public void test(int i) throws Throwable {
            set.add(i);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(344));
    Assert.assertTrue(set.contains(556));
    Assert.assertTrue(set.contains(655));
    Assert.assertTrue(set.contains(33));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) HashSet(java.util.HashSet)

Example 57 with TestCase

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

the class DataQueriesFromFields method test_2.

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

        private ValuesHolder2 holder2 = new ValuesHolder2();

        @TestCase
        @TestData("holder2.holder.setup")
        public void test(int i) throws Throwable {
            set.add(i);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(1));
    Assert.assertTrue(set.contains(3));
    Assert.assertTrue(set.contains(7));
    Assert.assertTrue(set.contains(9));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) HashSet(java.util.HashSet)

Example 58 with TestCase

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

the class InlinedArgData_ManyArgs method intString_mult_3.

@org.junit.Test
public void intString_mult_3() {
    final List<Integer> ints = new ArrayList<Integer>();
    final List<String> strings = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        List<Integer> intsData = Arrays.asList(1, 2, 3);

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("intsData") int i, @Strings({ "a", "b" }) String s) {
            ints.add(i);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(1, ints.get(1), 0.0);
    Assert.assertEquals(2, ints.get(2), 0.0);
    Assert.assertEquals(2, ints.get(3), 0.0);
    Assert.assertEquals(3, ints.get(4), 0.0);
    Assert.assertEquals(3, ints.get(5), 0.0);
    Assert.assertEquals(6, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
    Assert.assertEquals("b", strings.get(3));
    Assert.assertEquals("a", strings.get(4));
    Assert.assertEquals("b", strings.get(5));
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Example 59 with TestCase

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

the class InlinedArgData_ManyArgs method intString_mult_1.

@org.junit.Test
public void intString_mult_1() {
    final List<Integer> ints = new ArrayList<Integer>();
    final List<String> strings = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@Ints({ 1, 2, 3 }) int i, @Strings({ "a", "b" }) String s) {
            ints.add(i);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(1, ints.get(1), 0.0);
    Assert.assertEquals(2, ints.get(2), 0.0);
    Assert.assertEquals(2, ints.get(3), 0.0);
    Assert.assertEquals(3, ints.get(4), 0.0);
    Assert.assertEquals(3, ints.get(5), 0.0);
    Assert.assertEquals(6, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
    Assert.assertEquals("b", strings.get(3));
    Assert.assertEquals("a", strings.get(4));
    Assert.assertEquals("b", strings.get(5));
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Example 60 with TestCase

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

the class InlinedArgData_ManyArgs method intString_1.

@org.junit.Test
public void intString_1() {
    final List<Integer> ints = new ArrayList<Integer>();
    final List<String> strings = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        @TestCase
        public void test(@Ints({ 1, 2, 3 }) int i, @Strings({ "a", "b" }) String s) {
            ints.add(i);
            strings.add(s);
            System.out.println(MessageFormat.format("i = {0}, s = {1}", i, s));
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(3, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(2, ints.get(1), 0.0);
    Assert.assertEquals(3, ints.get(2), 0.0);
    Assert.assertEquals(3, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
}
Also used : TestCase(com.sun.tck.test.TestCase) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) 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