Search in sources :

Example 1 with TestObject

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

the class TestPureAssert method testAssertSame_Positive_exception.

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

Example 2 with TestObject

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

the class TestPureAssert method testAssertEquals_Positive_sameObject_exception.

@Test
public void testAssertEquals_Positive_sameObject_exception() {
    TestObject testObject = new TestObject("object" + RANDOM_STRING);
    com.sun.tck.lib.Assert.assertEquals(testObject, testObject, new RuntimeException());
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 3 with TestObject

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

the class TestPureAssert method testAssertEquals_Negative_exception.

@Test
public void testAssertEquals_Negative_exception() {
    TestObject testObject_1 = new TestObject("first" + RANDOM_STRING);
    TestObject testObject_2 = new TestObject("second" + RANDOM_STRING);
    RuntimeException cause = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertEquals(testObject_1, testObject_2, cause);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected equal to : \"" + testObject_1 + "\", was given: \"" + testObject_2 + "\"", e.getMessage());
        assertSame(cause, e.getCause());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Example 4 with TestObject

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

the class TestPureAssert method testAssertSame_Positive_message.

@Test
public void testAssertSame_Positive_message() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    com.sun.tck.lib.Assert.assertSame(testObject, testObject, "3490275092375");
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) Test(org.junit.Test)

Example 5 with TestObject

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

the class TestPureAssert method testAssertNotEquals_Negative_message_exception.

@Test
public void testAssertNotEquals_Negative_message_exception() {
    RuntimeException exception = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertNotEquals(new TestObject(RANDOM_STRING), new TestObject(RANDOM_STRING), RANDOM_STRING, exception);
        fail("AssertionFailedException was not thrown");
    } catch (AssertionFailedException e) {
        assertEquals(RANDOM_STRING, e.getMessage());
        assertSame(exception, e.getCause());
    }
}
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