Hi Jonas
I made the following change in the java file
@And ("the strings \"((?:[^\"]|(?<=\\)\")*)\" and \"((?:[^\"]|(?<=\\)
\")*)\" are EQUAL")
public void str(String s1, String s2) {
Assert.assertEquals("The string is " + s1 + "\nand " + s2, s1, s2);
}
In the .feature file:
Feature: Ftr1
Scenario: Scn1
Given the strings "abcd" and "abcd" are EQUAL
the result was
[java] java.util.regex.PatternSyntaxException: Unclosed group
near index 69
[java] the strings "((?:[^"]|(?<=\)")*)" and "((?:[^"]|(?<=
\)")*)" are EQUAL
[java]
^ (NativeException)
I modified the java file again, as given below:
@And ("the strings \"((?:[^\"]|(?<=\\\\)\")*)\" and \"((?:[^\"]|(?<=\\
\\)\")*)\" are EQUAL")
public void str(String s1, String s2) {
Assert.assertEquals("The string is " + s1 + "\nand " + s2, s1, s2);
}
For the feature file
Feature: Ftr1
Scenario: Scn1
Given the strings "a\"bc\"d" and "a\"bc\"d" are EQUAL
The result was:
The test was passing:
Given the strings "a\"bc\"d" and "a\"bc\"d" are EQUAL
Account.str(String,String)
{Though I was expecting the strings to be passed as a"bc"d, without
the escape {backslash} character, in the string arguments}
For the feature file
Feature: Ftr1
Scenario: Scn1
Given the strings "a\"bc\"d" and "a\"boc\"d" are EQUAL.
The result was:
The test was failing:
Given the strings "a\"bc\"d" and "a\"boc\"d" are
EQUAL Account.str(String,String)
org.junit.ComparisonFailure: The string is a\"bc\"d
and a\"boc\"d expected:<a\"b[]c\"d> but was:<a\"b[o]c\"d>
{Here again I was expecting the strings to passed without the escape
(backslash) character in the string arguments}
So in essence, now the double quotes {which are escaped using
backslash charcter are parsed correctly} and this resolves the first
part of the problem.
The solution will be complete if the second part is also addressed;
i.e., the escape (backslash) character is not part of the string
arguments / cucumber results}
Appreciate, if you could provide this resolution also.
I am using jruby version
jruby 1.5.2 (ruby 1.8.7 patchlevel 249)
and Java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
Regards
VENU
> >> For more options, visit this group athttp://
groups.google.com/group/cukes?hl=en.
> > For more options, visit this group athttp://
groups.google.com/group/cukes?hl=en.- Hide quoted text -
>
> - Show quoted text -