Make @DoNotIntercept not trigger stage changes.#385
Merged
janschaefer merged 2 commits intoTNG:masterfrom Feb 6, 2019
Merged
Conversation
…thods of java.lang.Object. The InvocationMode.DO_NOT_INTERCEPT seems unnecessary, since IMHO the behavior is better if all irrelevant methods (be it @DoNotIntercept or methods of java.lang.Object) don't trigger any JGiven magic like @AfterStage of other stages executed. Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
Contributor
|
Ok. I agree, thanks for addressing this :-). However, it will be a breaking change if someone depends on the behavior. No big problem I guess, but it should be documented in the changelog. As I plan to have a major version upgrade anyway (0.x -> 1.x), this is fine. May I ask you to extend the PR with a short documention in the CHANGELOG under 'Backwards Incompatible Changes'? |
…JGiven's behavior (in case someone would actually have (ab)used a call of `toString()` or similar of another stage to trigger `@AfterStage` of the current stage). Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
Collaborator
Author
|
Done 😃 Finally the label 1.0 😉 (after having been super stable for such a long time, never had problems in our project!!) |
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Better late than never 😉
This PR changes JGiven's behavior with respect to methods that should not be intercepted (annotated with
@DoNotInterceptor methods ofjava.lang.Object). These methods will now not trigger a change of the active stage and hence not trigger any@AfterStagemethods.I have thought about adding a new annotation to solve my issue #266, but in fact I don't see the use of those methods triggering any JGiven behavior.
This is pretty much the behavior I had expected from
@DoNotInterceptanyway, to have absolutely no side effects within JGiven.If I have missed a point here (I don't know the code base very well), let me know. But since all tests seemed to pass, I figured that there was no specific reason for the old behavior.
Resolves: #266