Open hexwit opened 7 years ago
This idea was considered early. But there are a couple of reasons why this design was not implemented
assertThat
and allows the type to dictate the assertion strategy. The goal here is to preserve the assertThat(something).customCheck()
template. One idea would be to implement a AbstractCharSequenceAssert
with a .asJsonDocumentContext()
to enable JSON path checks. The downside is you will have to extend org.assertj.core.api.Assertions
to replace the default string assertion with the custom assertion.I think the best solution here is to create your own wrapper like I described in item 1
. With that you can write your own abstraction, and make the assertions a lot simpler for your application. There is a balance between integrating multiple libraries together for an app where you can lock down every version, and for a general use utility where you want to keep it simple so more people can use it. I would like to not put effort in glue code because that would introduce integration issues with a lot other libraries and that defeats the purpose of this simple codebase.
it would be very convenient to accept string along with DocumentContext, and do the parsing under the hood. In most cases that saves some space that is pretty important in tests, as there a lot of assertions.