use of com.oracle.tck.lib.autd2.unittests.TestObject in project jtharness by openjdk.
the class TestPureAssert method testAssertEquals_Negative_Arrays2dim_Object.
@Test
public void testAssertEquals_Negative_Arrays2dim_Object() {
TestObject[][] arr_1 = new TestObject[][] { { new TestObject("one") }, { new TestObject("three") } };
TestObject[][] arr_2 = new TestObject[][] { { new TestObject("two") }, { new TestObject("four") } };
try {
com.sun.tck.lib.Assert.assertEquals(arr_1, arr_2);
fail("Exception not thrown");
} catch (AssertionFailedException e) {
assertEquals("Expected equal to : \"[[TestObject:one], [TestObject:three]]\", was given: \"[[TestObject:two], [TestObject:four]]\"", e.getMessage());
}
}
use of com.oracle.tck.lib.autd2.unittests.TestObject in project jtharness by openjdk.
the class TestPureAssert method testAssertNotSame_Negative.
@Test(expected = AssertionFailedException.class)
public void testAssertNotSame_Negative() {
TestObject testObject = new TestObject(RANDOM_STRING);
com.sun.tck.lib.Assert.assertNotSame(testObject, testObject);
}
use of com.oracle.tck.lib.autd2.unittests.TestObject in project jtharness by openjdk.
the class TestPureAssert method testAssertNotSame_Negative_exception.
@Test(expected = AssertionFailedException.class)
public void testAssertNotSame_Negative_exception() {
TestObject testObject = new TestObject(RANDOM_STRING);
com.sun.tck.lib.Assert.assertNotSame(testObject, testObject, new RuntimeException());
}
use of com.oracle.tck.lib.autd2.unittests.TestObject in project jtharness by openjdk.
the class TestPureAssert method testAssertNotEquals_Negative_exception.
@Test
public void testAssertNotEquals_Negative_exception() {
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;
}
};
RuntimeException cause = new RuntimeException();
try {
com.sun.tck.lib.Assert.assertNotEquals(testObject_1, testObject_2, cause);
fail("Exception not thrown");
} catch (AssertionFailedException e) {
assertEquals("Expected unequal objects, were equal: \"TestObject:theFirst\", \"TestObject:theSecond\"", e.getMessage());
assertSame(cause, e.getCause());
}
}
use of com.oracle.tck.lib.autd2.unittests.TestObject in project jtharness by openjdk.
the class TestPureAssert method testAssertSame_Negative_Message_arrays.
@Test
public void testAssertSame_Negative_Message_arrays() {
try {
com.sun.tck.lib.Assert.assertSame(new TestObject[] { new TestObject(RANDOM_STRING) }, new TestObject[] { 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());
}
}
Aggregations