eclipse / lsp4e

Language Server Protocol support in Eclipse IDE
Eclipse Public License 2.0
65 stars 54 forks source link

Use AssertJ or Google Truth for unit tests #1094

Closed sebthom closed 1 month ago

sebthom commented 2 months ago

I would like to introduce a test dependency to AssertJ or Google Truth to be able to write better test cases. Both libraries are Apache 2.0 licensed.

So far I only have experience with AssertJ which I like.

Here is a (probably somewhat biased) comparison between both frameworks https://truth.dev/comparison#vs-assertj

So truth seems to have more descriptive error messages but has less built-in assertions.

Both libs have their own quirks, see AssertJ puzzlers https://truth.dev/comparison#puzzlers and Truth puzzlers https://truth.dev/comparison#for-assertj

@rubenporras @mickaelistria Any preference?

rubenporras commented 2 months ago

I only have experience with Hamcrest. Regarding AssertJ vs Google Truth, since I have no experience, and also not time to make an informed decision, so I would be fine with both.

My only remark is that the fact that Google Truth works for Android is not an advantage to us ;)

mickaelistria commented 2 months ago

I personally don't have a preference as I use none of both; and it seems like they're technically as good one and other. In such case, I would use community "strategy" to make a choice: it seems that in the desktop and server-side Java world, assertj is pretty popular. As this is a better target audience for new potential contributors (more than android developers), I would then recommend assertj that would feel more familiar to them and not feel like "yet another specific tech to learn in order to be productive as a contributor".