Permalink
Browse files

shouldBeInstance error message is now multiline for better readability.

  • Loading branch information...
1 parent 82e8af5 commit b70d8cdbf4a6afae4f2ef1431d2584fb4845a388 @joel-costigliola joel-costigliola committed Sep 22, 2012
@@ -46,7 +46,7 @@ public static ErrorMessageFactory shouldBeInstanceButWasNull(String objectDescri
}
private ShouldBeInstance(Object object, Class<?> type) {
- super("expected <%s> to be an instance of:<%s> but was instance of:<%s>", object, type, object.getClass());
+ super("expected <%s> to be an instance of:\n<%s>\nbut was instance of:\n<%s>", object, type, object.getClass());
}
private ShouldBeInstance(String objectDescription, Class<?> type) {
@@ -45,7 +45,8 @@ public void setUp() {
@Test
public void should_create_error_message() {
String message = factory.create(new TestDescription("Test"));
- assertEquals("[Test] expected <'Yoda'> to be an instance of:<java.io.File> but was instance of:<java.lang.String>",
+ assertEquals(
+ "[Test] expected <'Yoda'> to be an instance of:\n<java.io.File>\nbut was instance of:\n<java.lang.String>",
message);
}
@@ -14,6 +14,7 @@
*/
package org.fest.assertions.internal.objects;
+import static org.fest.assertions.error.ShouldBeInstance.shouldBeInstance;
import static org.fest.assertions.error.ShouldBeLenientEqualByIgnoring.shouldBeLenientEqualByIgnoring;
import static org.fest.assertions.test.TestData.someInfo;
import static org.fest.test.TestFailures.failBecauseExpectedAssertionErrorWasNotThrown;
@@ -27,7 +28,6 @@
import org.junit.Test;
import org.fest.assertions.core.AssertionInfo;
-import org.fest.assertions.error.ShouldBeInstance;
import org.fest.assertions.internal.ObjectsBaseTest;
import org.fest.test.Employee;
import org.fest.test.Jedi;
@@ -117,7 +117,7 @@ public void should_fail_when_objects_to_compare_are_of_different_types() {
try {
objects.assertIsLenientEqualsToByIgnoringFields(info, actual, other, "name");
} catch (AssertionError err) {
- verify(failures).failure(info, ShouldBeInstance.shouldBeInstance(other, actual.getClass()));
+ verify(failures).failure(info, shouldBeInstance(other, actual.getClass()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
@@ -14,6 +14,7 @@
*/
package org.fest.assertions.internal.objects;
+import static org.fest.assertions.error.ShouldBeInstance.shouldBeInstance;
import static org.fest.assertions.error.ShouldBeLenientEqualByIgnoring.shouldBeLenientEqualByIgnoring;
import static org.fest.assertions.test.TestData.someInfo;
import static org.fest.test.TestFailures.failBecauseExpectedAssertionErrorWasNotThrown;
@@ -27,7 +28,6 @@
import org.junit.Test;
import org.fest.assertions.core.AssertionInfo;
-import org.fest.assertions.error.ShouldBeInstance;
import org.fest.assertions.internal.ObjectsBaseTest;
import org.fest.test.Employee;
import org.fest.test.Jedi;
@@ -101,7 +101,7 @@ public void should_fail_when_objects_to_compare_are_of_different_types() {
try {
objects.assertIsLenientEqualsToByIgnoringNullFields(info, actual, other);
} catch (AssertionError err) {
- verify(failures).failure(info, ShouldBeInstance.shouldBeInstance(other, actual.getClass()));
+ verify(failures).failure(info, shouldBeInstance(other, actual.getClass()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();

0 comments on commit b70d8cd

Please sign in to comment.