@Test
public void testExpandWithBrackets() throws IOException {
DSLMappingEntry entry1 = this.createEntry( "attr {attr_name} is in \\[ {values} \\]",
"{attr_name} in ( {values} )" );
DSLMappingEntry entry2 = this.createEntry( "((H|h)e|(S|s)he) \\(is\\) (a|an) $xx {attribute} (man|woman)",
"Person( attribute == \"{attribute}\" )" );
DSLMappingEntry entry3 = this.createEntry( "DSL sentence with {key1} {key2}",
"Sentence( {key1} == {key2} )" );
DSLMappingEntry entry4 = this.createEntry( "When the credit rating is {rating:ENUM:Applicant.creditRating}",
"applicant:Applicant(credit=={rating})" );
DSLMappingEntry entry5 = this.createEntry( "When the credit rating is {rating:regex:\\d{3}}",
"applicant:Applicant(credit=={rating})" );
assertEquals( lookbehind + "When\\s+the\\s+credit\\s+rating\\s+is\\s+(\\d{3})(?=\\W|$)",
entry5.getKeyPattern().toString() );
assertEquals( "applicant:Applicant(credit=={rating})",
entry5.getValuePattern() );
DSLMappingEntry entry6 = this.createEntry( "This is a sentence with line breaks",
"Cheese\\n(price == 10)" );
assertEquals( lookbehind + "This\\s+is\\s+a\\s+sentence\\s+with\\s+line\\s+breaks(?=\\W|$)",
entry6.getKeyPattern().toString() );
assertEquals( "Cheese\n(price == 10)",
entry6.getValuePattern());
DSLMappingEntry entry7 = this.createEntry( "Bedingung-\\#19-MKM4",
"eval ( $p.getTempVal(\"\\#UML-ATZ-1\") < $p.getZvUmlStfr() )" );
assertEquals( lookbehind + "Bedingung-#19-MKM4(?=\\W|$)",
entry7.getKeyPattern().toString() );
assertEquals( "eval ( $p.getTempVal(\"#UML-ATZ-1\") < $p.getZvUmlStfr() )",
entry7.getValuePattern());
DefaultExpander ex = makeExpander( entry1, entry2, entry3, entry4,
entry5, entry6, entry7 );
StringBuilder sb = new StringBuilder( "rule x\n" ).append( "when\n" );