Search in sources :

Example 6 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 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(testObject_1, 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 7 with TestObject

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

the class TestPureAssert method testAssertSame_Positive.

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

Example 8 with TestObject

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

the class TestPureAssert method testAssertNotEquals_Negative_equal_message_exception.

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

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

the class TestPureAssert method testAssertNotEquals_Negative_arrays_exception.

@Test
public void testAssertNotEquals_Negative_arrays_exception() {
    RuntimeException exception = new RuntimeException();
    try {
        com.sun.tck.lib.Assert.assertNotEquals(new TestObject[] { new TestObject(RANDOM_STRING) }, new TestObject[] { new TestObject(RANDOM_STRING) }, exception);
        fail("AssertionFailedException was not thrown");
    } catch (AssertionFailedException e) {
        assertEquals("Expected unequal objects, were equal: \"[TestObject:" + RANDOM_STRING + "]\", \"[TestObject:" + 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)

Example 10 with TestObject

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

the class TestPureAssert method testAssertNotEquals_Negative_same.

@Test(expected = AssertionFailedException.class)
public void testAssertNotEquals_Negative_same() {
    TestObject testObject = new TestObject(RANDOM_STRING);
    com.sun.tck.lib.Assert.assertNotEquals(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