-
-
Notifications
You must be signed in to change notification settings - Fork 710
Improve secret-handshake assertions with AssertJ #2061
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
Conversation
I see. The tests were checking for a collection type as well as the contents? |
public void setUp() { | ||
handshakeCalculator = new HandshakeCalculator(); | ||
} | ||
private final HandshakeCalculator handshakeCalculator = new HandshakeCalculator(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the object has no state, it doesn't matter if we remove the initialization from the @Before
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, and even if it did have state, each @Test
is actually run independently so you would only possibly get an issue if they were running in parallel. Frankly, if a student's solution has any mutable state, that is a bad implementation of this exercise. It may eventually be worth adding a test that does multiple calculations in a row and making sure it always has the correct results across multiple runs (eg. not re-using a mutable list for each calculation).
I believe that it considers equality based on the .collect(Collectors.toCollection(ArrayList::new)) |
Anything else @ericbalawejder? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertions are more clear but I still can't reproduce the error.
pull request
Fixes #2060
Basically, the current assertions are horribly broken, but this fixes that.
Reviewer Resources:
Track Policies