commit ac10a91dc0cfd2a98684357f11ab6b8528d4881e Author: Mauro Talevi <mauro.tal...@aquilonia.org> AuthorDate: Tue Apr 17 20:19:39 2012 +0200 Commit: Mauro Talevi <mauro.tal...@aquilonia.org> CommitDate: Tue Apr 17 20:19:39 2012 +0200
JBEHAVE-765: Clarified variants docs. diff --git a/distribution/src/site/content/pattern-variants.html b/distribution/src/site/content/pattern-variants.html index 2ddad2a..2e9adfc 100755 --- a/distribution/src/site/content/pattern-variants.html +++ b/distribution/src/site/content/pattern-variants.html @@ -23,7 +23,7 @@ When the price is 10.0 When the cost is 10.0 </pre> -<p>then we could define two aliases, but it's simpler and more compact to write a pattern with variants:</p> +<p>then we could define two aliases, but it's simpler and more compact to write a pattern with variants. E.g.:</p> <pre class="brush: java"> @When("the {item|} {price|cost} is $price") public void theItemPriceIs(double price) { @@ -31,6 +31,9 @@ When the cost is 10.0 } </pre> +<p>In this example, we want the word "item" to be optional. Please note that we include a trailing space in the variant "{item |}" +and not between this and the following variant ("{price|cost}") to prevent the resulting step from containing multiple consecutive spaces.</p> + <p>The pattern variants are built by the <a href="javadoc/core/org/jbehave/core/steps/PatternVariantBuilder.html">PatternVariantBuilder</a>, which interprets the directives of the form:</p> <pre class="brush: plain">