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