Details
Description
Better starting with an example :
Given a series - Name : Series 0110 - NAV : $200 Given an investor Peter When Peter invests 7500 shares in series Series 0110 Then ...
It would be interesting to have the Steps definition class also able to provide some converters. This is what the code could look like :
@AsParameterConverter public Person findByFirstName( String firstName ) { return personDao.findByFirstName( firstName ); } @When("$person invests $nbShares shares in series $series" ) public void invest(Person person, int nbShares, Series series ) { }
I've attached the ParameterConverterStepsFactory as it's getting bigger.
Activity
Bruno Bieth
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | ParameterConverterStepsFactory.java [ 48335 ] | |
Attachment | ParameterConverters.java [ 48336 ] |
Bruno Bieth
made changes -
Attachment | ParameterConverterStepsFactory.java [ 48329 ] |
Mauro Talevi
made changes -
Fix Version/s | 3.0 [ 16302 ] | |
Component/s | Core [ 11086 ] |
Mauro Talevi
made changes -
Summary | Steps could act as parameter converters : add the @ParameterConverter annotation | Steps methods as parameter converters when annotated by @AsParameterConverter |
Description |
Better starting with an example :
{code} Given a series - Name : Series 0110 - NAV : $200 Given an investor Peter When Peter invests 7500 shares in series Series 0110 Then ... {code} It would be interesting to have the Steps definition class also able to provide some converters. This is what the code could look like : {code} @ParameterConverter public Person findByFirstName( String firstName ) { return personDao.findByFirstName( firstName ); } @When("$person invests $nbShares shares in series $series" ) public void invest(Person person, int nbShares, Series series ) { } {code} I've attached the ParameterConverterStepsFactory as it's getting bigger. |
Better starting with an example :
{code} Given a series - Name : Series 0110 - NAV : $200 Given an investor Peter When Peter invests 7500 shares in series Series 0110 Then ... {code} It would be interesting to have the Steps definition class also able to provide some converters. This is what the code could look like : {code} @AsParameterConverter public Person findByFirstName( String firstName ) { return personDao.findByFirstName( firstName ); } @When("$person invests $nbShares shares in series $series" ) public void invest(Person person, int nbShares, Series series ) { } {code} I've attached the ParameterConverterStepsFactory as it's getting bigger. |
Mauro Talevi
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Forgot to mention that this will only work with
JBEHAVE-263fixed.