Makes Core and DB assertions coexist with only one import#330
Makes Core and DB assertions coexist with only one import#330VanRoy merged 3 commits intoassertj:mainfrom
Conversation
I had the same line of thinking – let's see if it's feasible. |
|
Thanks @jmaniquet , I'll review it soon. @jmaniquet @scordio I agree with you regarding the depreciation. We will consider it for the next major version. |
|
@jmaniquet Seems pretty good 👍 . Can you just add few tests for methods "assertThat" added to Table, Request and Changes ? |
Hi ! |
|
@jmaniquet Thanks perfect. Let me know in case you don't have enough time to do it, I can try to work on it next week. |
31761c6 to
271ac90
Compare
|
Hi again I came up with something for the tests. I was calling I'm ashamed to say that I had only tested the compile aspect of the solution, and not the runtime part. So aside from the new unit tests I added, I was more thorough : I made a dummy project to test a real insert (using Spring Boot / HSQLDB / flyway with a simple table) and covered the three items with it (changes / request / table) The tests are in a new commit. As a side note, I noticed that the tests are still using JUnit4 and have a mix of AssertJ and JUnit4-based assertions. |
|
Hi @jmaniquet , perfect , no worries for push force 👍 . |
Proposal for : #329
The suggested implementation works nicely in my eyes : I am able to use both core and db assertions while using only one single
org.assertj.core.api.Assertions.assertThatstatic import.Now I did encounter a problem : class
Changes_Constructor_Teststopped compiling with that implementation.The reason is statements like this :
assertThat(changes.getRequestAtStartPoint()).isNull();assertThat(changes.getTablesAtStartPointList()).hasSize(5);The first
assertThatused to return anObjectAssert- which providesisNullassertionThe second used to return a
ListAssert- which provideshasSizeassertionAfter the fix they respectively provide
ChangesAssertandTableAssert, since inputs are now treated as AssertProvider instances.I identified two possible workarounds :
assertThatstatic import with something like this :assertThat((Object) changes.getRequestAtStartPoint()).isNull();assertThatmethods with signatures that suit meI went with second one; but neither maybe acceptable; let me know.
If we go forward with a fix (whatever it may be), I see also this :
BDDAssertions.thenwhich has the same characteristics (I did not notice at first since i do not use it) - AssertJ Core provides itsthenvariants and one has anAssertProvideroverloadassertThatandthenmethods from AssertJ DB seems to become obsolete, and maybe can be deprected; even removed in the future. I could be wrong though.I also added a commit that changes the pom version to a new Snapshot.
I am not sure if I was supposed to do it or not; but I can remove this commit if need be.
Let me know what you think