use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
Aggregations