Search in sources :

Example 21 with AssertionFailedException

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

the class TestPureAssert method testAssertSame_Negative_standardMessage.

@Test
public void testAssertSame_Negative_standardMessage() {
    try {
        com.sun.tck.lib.Assert.assertSame(new TestObject(RANDOM_STRING), 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)

Example 22 with AssertionFailedException

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

the class TestPureAssert method testAssertNotSame_Negative_CustomMessage.

@Test
public void testAssertNotSame_Negative_CustomMessage() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    try {
        com.sun.tck.lib.Assert.assertNotSame(testObject, testObject, RANDOM_STRING + "32423434");
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals(RANDOM_STRING + "32423434\nExpected not same : \"" + testObject + "\"", 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)22 AssertionFailedException (com.sun.tck.lib.AssertionFailedException)22 Test (org.junit.Test)22