Search in sources :

Example 46 with TestObject

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

the class TestPureAssert method testAssertEquals_Negative_Message.

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

Example 47 with TestObject

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

the class TestPureAssert method testAssertSame_Negative_standardMessage_exception.

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

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

the class TestPureAssert method testAssertSame_Negative_Message_customMessage.

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

Example 49 with TestObject

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

the class TestPureAssert method testAssertEquals_Positive_sameObject_message_exception.

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

Example 50 with TestObject

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

the class TestPureAssert method testAssertEquals_Positive_sameObject.

@Test
public void testAssertEquals_Positive_sameObject() {
    TestObject testObject = new TestObject("object" + RANDOM_STRING);
    com.sun.tck.lib.Assert.assertEquals(testObject, testObject);
}
Also used : TestObject(com.oracle.tck.lib.autd2.unittests.TestObject) 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