diff --git a/src/main/java/spoon/testing/AbstractCtElementAssert.java b/src/main/java/spoon/testing/AbstractCtElementAssert.java index 6e521fc74b5..9e2c5931a19 100644 --- a/src/main/java/spoon/testing/AbstractCtElementAssert.java +++ b/src/main/java/spoon/testing/AbstractCtElementAssert.java @@ -18,6 +18,7 @@ import spoon.reflect.declaration.CtElement; +import static spoon.testing.utils.Check.assertCtElementEquals; import static spoon.testing.utils.Check.assertNotNull; import static spoon.testing.utils.Check.assertIsSame; import static spoon.testing.utils.ProcessorUtils.process; @@ -40,9 +41,9 @@ public T isEqualTo(CtElement expected) { process(actual.getFactory(), processors); - if (!actual.equals(expected)) { - throw new AssertionError(); - } + // using the new method to have a nice error message + assertCtElementEquals(expected, actual); + return this.myself; }