Natural icon indicating copy to clipboard operation
Natural copied to clipboard

NPE when using String constant in the cucumber annotation

Open mlasram opened this issue 7 years ago • 9 comments

NPE when using String constant in the cucumber annotation

Example:

public final String PROFILES = "'(admin|mobile)'";

@When(PROFILES + " do something")

naturallog.txt

mlasram avatar May 24 '17 13:05 mlasram

duplicate with #50

boy-m avatar Nov 17 '17 03:11 boy-m

Duplicate of #50

rlogiacco avatar May 28 '20 00:05 rlogiacco

Flagging for review in next.

drkstr101 avatar May 30 '20 04:05 drkstr101

This issue has not been updated for a while: marking it as stale.

github-actions[bot] avatar Jul 30 '20 00:07 github-actions[bot]

@rlogiacco I don't think this has anything to do with Natural.

drkstr101 avatar Sep 14 '20 17:09 drkstr101

I believe it does: as we are reading the annotations from the source files and without compiling the Natural plugin doesn't see the constant being expanded... This is my best guess ATM

rlogiacco avatar Sep 16 '20 17:09 rlogiacco

Oh I didn't realize this was how it worked. I assumed annotationValue would contain the string value. How would this work in the case of groovy step definitions, where you can pass an actual RegExp EG @Given(/^foo$/).

drkstr101 avatar Sep 16 '20 19:09 drkstr101

:-) I thought you had already a try on this... You contributed heavy modifications to the stepmatcher... Let's check this before we move further with the release ;)

rlogiacco avatar Sep 17 '20 07:09 rlogiacco

Ah, only the most basic hello-world test. I don't think I've tested this style of syntax specifically. I do know I've written step definitions this way before however, so it was surprising to hear there is a compile time and runtime difference, which makes sense when I think about it. I agree it could use further exploration.

Unfortunatly all my modifications to the step matcher thus far have been entirely superficial. It is still your original system and design. I just wrapped it in a public API that doesn't depend on JDT.

drkstr101 avatar Sep 18 '20 07:09 drkstr101