Skip to content

Make @DoNotIntercept not trigger stage changes.#385

Merged
janschaefer merged 2 commits intoTNG:masterfrom
codecholeric:make-DoNotIntercept-not_trigger_stage_changes
Feb 6, 2019
Merged

Make @DoNotIntercept not trigger stage changes.#385
janschaefer merged 2 commits intoTNG:masterfrom
codecholeric:make-DoNotIntercept-not_trigger_stage_changes

Conversation

@codecholeric
Copy link
Copy Markdown
Collaborator

Better late than never 😉
This PR changes JGiven's behavior with respect to methods that should not be intercepted (annotated with @DoNotIntercept or methods of java.lang.Object). These methods will now not trigger a change of the active stage and hence not trigger any @AfterStage methods.
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 @DoNotIntercept anyway, 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

…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>
@janschaefer
Copy link
Copy Markdown
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>
@codecholeric
Copy link
Copy Markdown
Collaborator Author

Done 😃 Finally the label 1.0 😉 (after having been super stable for such a long time, never had problems in our project!!)

@janschaefer
Copy link
Copy Markdown
Contributor

Thanks!

@janschaefer janschaefer merged commit c461fd2 into TNG:master Feb 6, 2019
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

Successfully merging this pull request may close these issues.

2 participants