I think that #1731 was great for a certain class of custom assertions. However, i think it would also be a useful addition to AbstractAssert if it had a variant of the failWithMessage() method that you could call directly that would populate expected and actual in the generated AssertionError (where available).
failWithExpectedActual(expected, actual, "My message %d", myArg);
Would it help to use the following?
throw org.assertj.core.internal.Failures.instance().failure(info, shouldBeEqual(actual, expected, info.representation()));
As Failures belongs to internal APIs, using it in custom assertions is probably not so nice.
I'm ok with the idea, I would actual first and expected after it. failWithActualAndExpected.
I would prefer not to recommend using directly internal APIs.
Would it help to use the following?
throw org.assertj.core.internal.Failures.instance().failure(info, shouldBeEqual(actual, expected, info.representation()));As
Failuresbelongs to internal APIs, using it in custom assertions is probably not so nice.
Thanks @scordio, I tend to agree about it not being nice - but even more than that, if you're using an OSGi environment as I am, you don't account actually have access to the internal packages.
This was implemented by #1833.
Most helpful comment
I'm ok with the idea, I would actual first and expected after it.
failWithActualAndExpected.I would prefer not to recommend using directly internal APIs.