[ 
https://jira.codehaus.org/browse/JBEHAVE-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=294996#comment-294996
 ] 

Arjan van Bentem commented on JBEHAVE-646:
------------------------------------------

Hi Mauro,

when using

{code}
"I live on the $ith, but some call it the $nth";
{code}

along with 

{code}
"When I live on the first, but some call it the ground"
{code}

then things fail in 3.5.4.

So:

{code}
@Test
public void 
shouldMatchMethodParametersByAnnotatedNamesInverseOrderWithLessWhitespace() 
throws Exception {
    AnnotationNamedParameterSteps steps = new AnnotationNamedParameterSteps();
    String patternAsString = "I live on the $ith, but some call it the $nth";
    Method method = stepMethodFor("methodWithNamedParametersInInverseOrder", 
AnnotationNamedParameterSteps.class);
    StepCandidate candidate = candidateWith(patternAsString, WHEN, method, 
steps);
    candidate.createMatchedStep("When I live on the first, but some call it the 
ground", namedParameters)
            .perform(null);
    // Will fail:
    // java.lang.AssertionError: Expected: "first" got: "ground"
    assertThat(steps.ith, equalTo("first"));
    assertThat(steps.nth, equalTo("ground"));
}
{code}

As an aside: I'm seeing a related problem in 
https://jira.codehaus.org/browse/JBEHAVE-748 where {{@Named}} parameters in 
their natural order in some situations get a value from an {{Examples}} table 
(if used in the same scenario), but only if not fully surrounded with 
whitespace.
                
> @Named not respecting parameter order
> -------------------------------------
>
>                 Key: JBEHAVE-646
>                 URL: https://jira.codehaus.org/browse/JBEHAVE-646
>             Project: JBehave
>          Issue Type: Bug
>            Reporter: Diego Rivera
>
> @Named doesn't seem to do its job, and parameter ordering in the method 
> declaration seems to confuse the assignment code.  For instance:
> "Given a $var1 with $var2 and $var3"
> void testVars(@Named("var3") String var3, @Named("var1") String var1, 
> @Named("var2") String var2)
> When executing testVars, it assigns var3=$var3, var1=$var1, but var2=$var3
> Clearly, the correct assignment is var2=$var2

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to