Search in sources :

Example 56 with TestObject

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

the class TestPureAssert method testAssertNotEquals_Negative_message.

@Test
public void testAssertNotEquals_Negative_message() {
    TestObject to = new TestObject(RANDOM_STRING);
    try {
        com.sun.tck.lib.Assert.assertNotEquals(to, to, "234241234dfasfsaf234234");
        fail("AssertionFailedException was not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("234241234dfasfsaf234234\nExpected unequal objects, were equal: \"" + to + "\", \"" + to + "\"", e.getMessage());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Example 57 with TestObject

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

the class TestPureAssert method testAssertNotSame_Negative_CustomMessage_throwable.

@Test
public void testAssertNotSame_Negative_CustomMessage_throwable() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    RuntimeException runtimeException = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertNotSame(testObject, testObject, RANDOM_STRING + "32423434", runtimeException);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals(RANDOM_STRING + "32423434", e.getMessage());
        assertSame(runtimeException, e.getCause());
    }
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) AssertionFailedException(com.sun.tck.lib.AssertionFailedException) Test(org.junit.Test)

Example 58 with TestObject

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

the class TestPureAssert method testAssertEquals_Negative_message_exception.

@Test
public void testAssertEquals_Negative_message_exception() {
    TestObject testObject_1 = new TestObject("first" + RANDOM_STRING);
    TestObject testObject_2 = new TestObject("second" + RANDOM_STRING);
    RuntimeException exception = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertEquals(testObject_1, testObject_2, RANDOM_STRING + "message", exception);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals(RANDOM_STRING + "message", 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)

Example 59 with TestObject

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

the class TestPureAssert method testAssertNotSame_Negative_exception_1.

@Test
public void testAssertNotSame_Negative_exception_1() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    RuntimeException cause = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertNotSame(testObject, testObject, cause);
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertSame(cause, e.getCause());
        assertEquals("Expected 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)

Example 60 with TestObject

use of com.oracle.tck.lib.autd2.unittests.TestObject 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)

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