Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include more comparison between Truth and AssertJ in the FAQ #306

Closed
maximumpeaches opened this issue Apr 20, 2017 · 6 comments
Closed

Include more comparison between Truth and AssertJ in the FAQ #306

maximumpeaches opened this issue Apr 20, 2017 · 6 comments
Assignees

Comments

@maximumpeaches
Copy link

On the comparison page Truth is said to be similar to AssertJ, and the GitHub README says Truth was inspired by FEST, from which AssertJ was forked. For people trying to decide between using Truth and AssertJ, there is not much to go on. The comparison page does highlight the syntax differences of AssertJ, Truth, Hamcrest and JUnit, but AssertJ and Truth are so similar in syntax that it's difficult to make a decision.

The Github README hints at the Truth project being started because of "some extensibility needs" but it'd be nice to know why effort is put into the development of Truth when AssertJ and FEST exist. In issue 43 cgruber wrote,

I wrote a G+ comment about FEST/AssertJ that I should turn into a FAQ answer, but have to dig it out.

The core difference is that the design of Truth includes two specific areas of extensibility - that of a strategy for proposition failure - such that a "subject" for Integers, or a subject for Strings can be re-used in the context of completely different results for failure. A notable example is the distinction between JUnit's use of AssertionError and it's AssumptionViolationException. Truth lets you use the same proposition classes for both.

The other area of flexibility is the ability to create new assertion/proposition types and hook them in without declaring possibly conflicting static methods to import. This can be for new types (say, adding protobufs) or for new uses of existing types (say, Strings that are treated as Uris). This is the assertAbout() feature.

Other than that, Truth is very similar to AssertJ, since it was inspired by FEST, of which AssertJ is a fork of the 2.0 development line.

Leaving this here for reference until I update the docs.

Even including that quote in the FAQ would be an improvement.

cpovirk added a commit that referenced this issue Aug 31, 2017
Fixes(?) #306

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167187935
@cpovirk
Copy link
Member

cpovirk commented Aug 31, 2017

Sorry that this has taken so long. I'd be interested in your thoughts on http://google.github.io/truth/comparison

@maximumpeaches
Copy link
Author

maximumpeaches commented Aug 31, 2017 via email

@maximumpeaches
Copy link
Author

maximumpeaches commented Aug 31, 2017 via email

@cpovirk
Copy link
Member

cpovirk commented Sep 1, 2017

Thanks. I'll add the link to our Subject instructions.

I'm also glad to appear that Truth and its docs are simple. We'll try to preserve that even as we expand them.

cpovirk added a commit that referenced this issue Sep 6, 2017
@cpovirk
Copy link
Member

cpovirk commented Sep 27, 2017

Going to call this one closed. As noted in http://google.github.io/truth/comparison, I'm happy for any suggestions on other aspects that are important enough to cover or anything I've said that's misleading.

@cpovirk cpovirk closed this as completed Sep 27, 2017
@kaspernielsen
Copy link

I have one addition to the comparison table, which actually made me select AspectJ over Truth.

AssertJ brings in one dependency
assertj-core-3.11.1

Truth brings in 12 dependencies. Now some of these might be optional, but something like 'mvn eclipse:eclipse' brings in 12 dependencies to your project.

For projects that already have too many dependencies, you do not want to add 12 more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants