use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException 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());
}
}
use of com.sun.tck.lib.AssertionFailedException in project jtharness by openjdk.
the class TestPureAssert method testAssertEquals_Negative_Message_custom.
@Test
public void testAssertEquals_Negative_Message_custom() {
TestObject testObject_1 = new TestObject("1" + RANDOM_STRING);
TestObject testObject_2 = new TestObject("2" + RANDOM_STRING);
try {
com.sun.tck.lib.Assert.assertEquals(testObject_1, testObject_2, "MyMessage" + RANDOM_STRING);
fail("Exception not thrown");
} catch (AssertionFailedException e) {
assertEquals("MyMessage" + RANDOM_STRING + "\n" + "Expected equal to : \"" + testObject_1 + "\", was given: \"" + testObject_2 + "\"", e.getMessage());
}
}
Aggregations