cucumber-jvm: hooks should not require public visibility -- at least should log an error/warning
Is your feature request related to a problem? Please describe. I was frustrated when i tried to figure out why my tests would fail. Until i notices that my setup was not public. From the old days in junit i know that they used to require that too, but no more and nowadays it’s so common to have all that test stuff with package visibility (to avoid cluttering autocompletion in IDEs i guess) I just did it here too w/o even giving it a 2nd though.
So now my code looks like so to make my team mates (we are all new CC) aware of the fact.
@Before //method must be public!! otherwise it's silently ignored!
public void setUp() {
msUniteTestHarness.reset();
}
Describe the solution you’d like Also allow package visibility but by all means don’t just silently drop the execution
Describe alternatives you’ve considered Throwing an error would be OK too but behavior is not anymore in alignment with junit.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Allow non-private classes to contain hooks and allow hook annotations in non-public methods. Fixes issue #2370 — committed to rozenshteyn/cucumber-jvm_2370 by rozenshteyn 3 years ago
- [Java] Allow non-private classes to contain hooks and allow hook annotations in non-public methods (#2370) — committed to rozenshteyn/cucumber-jvm_2370 by rozenshteyn 3 years ago
Step definitions and hooks that would previously be ignored would now be discovered. Even though this may not have been intentional, it would change an existing setup.