Search in sources :

Example 11 with TestObject

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

the class TestPureAssert method testAssertNotEquals_arrays_equal_message.

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

Example 12 with TestObject

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

the class TestPureAssert method testAssertNotSame_Positive_Equal_Arrays_1.

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

Example 13 with TestObject

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

the class TestPureAssert method testAssertSame_Negative_Message_exception_message.

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

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

the class TestPureAssert method testAssertNotEquals_Negative_Message_arrays.

@Test
public void testAssertNotEquals_Negative_Message_arrays() {
    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;
        }
    };
    try {
        com.sun.tck.lib.Assert.assertNotEquals(new TestObject[] { testObject_1 }, new TestObject[] { testObject_2 });
        fail("Exception not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected unequal objects, were equal: \"[TestObject:theFirst]\", \"[TestObject:theSecond]\"", e.getMessage());
    }
}
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 15 with TestObject

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

the class TestPureAssert method testAssertNotSame_Negative_Message.

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

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