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

Is it too easy to write "ASSERT.that(boolean);"? #48

Closed
cpovirk opened this issue Oct 26, 2012 · 2 comments
Closed

Is it too easy to write "ASSERT.that(boolean);"? #48

cpovirk opened this issue Oct 26, 2012 · 2 comments

Comments

@cpovirk
Copy link
Member

cpovirk commented Oct 26, 2012

I just saw this in a code review:

ASSERT.that(collection.containsAll(values));

What was meant was:

ASSERT.that(collection).containsAll(values);

(The error was a little less obvious in the real code, where "collection" and "values" were longer expressions.)

I don't really have a solution here.

@amertum
Copy link

amertum commented Dec 7, 2012

Maybe ASSERT.that() method should fail if no methods were called on, like Mockito which detects if we correctly wrote mock and verify. You check that at the end of test method in case there's only one ASSERT.that() and for each ASSERT.that() invocation, to validate the previous one.

@cgruber
Copy link
Contributor

cgruber commented Jun 4, 2013

I think this is actually something we want to put into error-prone, and recommend people use it. I don't think this is solvable with a fluent API because of the "turn the crank" issue - JAva needs the last method to be the one that turns the crank. There's no signal that "it's over, and no one turned the crank". But error-prone does pattern analysis on code, so it might be the best way.

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