Yes, that’s the inherent potential “ambiguity” of regex-based matching with 
parameters. 

There is the concept of priority in step matching you could leverage, so that 
you could make the one with more parameters take precedence:   
http://jbehave.org/reference/stable/prioritising-steps.html 
<http://jbehave.org/reference/stable/prioritising-steps.html>

Else you could re-word your steps, e.g.  by adding “with default redundancy” in 
the first steps  or by moving the parameter $type:  “region $name of type $type 
is created (with redundancy $redundancy)”.  


> On 8 Oct 2016, at 17:32, [email protected] wrote:
> 
> Thanks for the reply.
> 
> So I tried creating two methods as follows:
> 
>   @Given("region $name is created as $type")
>   public void createRegion(String name, String type) throws Exception {
>     ...
>   }
> 
>   @Given("region $name is created as $type with redundancy $redundancy")
>   public void createRegionWithRedundancy(String name, String type, Integer 
> redundancy) throws Exception {
>     ...
>   }
> 
> However, both of my story steps are executed by the first method. Thus, for 
> the second step type is passed in as "PARTITION with redundancy 1" which is 
> wrong.
> 
> --Jens
> 
> On Thursday, October 6, 2016 at 8:17:21 AM UTC-7, [email protected] 
> <http://pivotal.io/> wrote:
> Hi,
> 
> I've just started looking at JBehave and have run into the following problem.
> 
> I'd like to have steps that would look something like this:
> 
> Given region FOO is created as REPLICATE
> Given region BAR is created as PARTITION with redundancy 1
> 
> And a single Given step definition of:
> 
> @Given("region $name is created as $type{ with redundancy $redundancy|}")
> public void createRegionWithRedundancy(String name, String type, Integer 
> redundancy) throws Exception {
>     ...
> }
> 
> I'm getting a NullPointerException for the first Given. Presumably because 
> there is no 'redundancy' value. Is it possible to make this optional? I would 
> have hoped to at least just get a null value into my test method and handle 
> that myself.
> 
> Thanks
> --Jens
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JBehave Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web, visit 
> https://groups.google.com/d/msgid/jbehave-dev/047ef18e-0032-47a8-afb4-b9a8b03f3f5d%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jbehave-dev/047ef18e-0032-47a8-afb4-b9a8b03f3f5d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/03BEA512-231E-4A2B-9291-7D232D2DC948%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to