Search in sources :

Example 51 with TestObject

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

the class TestPureAssert method testAssertEquals_Negative_Arrays2dim_Object.

@Test
public void testAssertEquals_Negative_Arrays2dim_Object() {
    TestObject[][] arr_1 = new TestObject[][] { { new TestObject("one") }, { new TestObject("three") } };
    TestObject[][] arr_2 = new TestObject[][] { { new TestObject("two") }, { new TestObject("four") } };
    try {
        com.sun.tck.lib.Assert.assertEquals(arr_1, arr_2);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected equal to : \"[[TestObject:one], [TestObject:three]]\", was given: \"[[TestObject:two], [TestObject:four]]\"", e.getMessage());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Example 52 with TestObject

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

the class TestPureAssert method testAssertNotSame_Negative.

@Test(expected = AssertionFailedException.class)
public void testAssertNotSame_Negative() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    com.sun.tck.lib.Assert.assertNotSame(testObject, testObject);
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 53 with TestObject

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

the class TestPureAssert method testAssertNotSame_Negative_exception.

@Test(expected = AssertionFailedException.class)
public void testAssertNotSame_Negative_exception() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    com.sun.tck.lib.Assert.assertNotSame(testObject, testObject, new RuntimeException());
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 54 with TestObject

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

the class TestPureAssert method testAssertNotEquals_Negative_exception.

@Test
public void testAssertNotEquals_Negative_exception() {
    TestObject testObject_1 = new TestObject("theFirst") {

        public boolean equals(Object o) {
            return true;
        }
    };
    TestObject testObject_2 = new TestObject("theSecond") {

        public boolean equals(Object o) {
            return true;
        }
    };
    RuntimeException cause = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertNotEquals(testObject_1, testObject_2, cause);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected unequal objects, were equal: \"TestObject:theFirst\", \"TestObject:theSecond\"", e.getMessage());
        assertSame(cause, e.getCause());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Example 55 with TestObject

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

the class TestPureAssert method testAssertSame_Negative_Message_arrays.

@Test
public void testAssertSame_Negative_Message_arrays() {
    try {
        com.sun.tck.lib.Assert.assertSame(new TestObject[] { new TestObject(RANDOM_STRING) }, new TestObject[] { new TestObject(RANDOM_STRING) });
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected same as : \"[" + new TestObject(RANDOM_STRING) + "]\", was given: \"[" + new TestObject(RANDOM_STRING) + "]\"", e.getMessage());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Aggregations

TestObject (com.oracle.tck.lib.autd2.unittests.TestObject)61 Test (org.junit.Test)60 AssertionFailedException (com.sun.tck.lib.AssertionFailedException)22 ArrayList (java.util.ArrayList)20 Values (com.sun.tck.lib.tgf.Values)18 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)1 TestCase (com.sun.tck.test.TestCase)1 List (java.util.List)1