ContextCapturer extends BaseContextHandler { String transformToRegex(String pattern) { return pattern.replaceAll(GROUP_PATTERN, GROUP_PATTERN_REGEX); }  void capture(String pattern, String value); static final String GROUP_PATTERN_REGEX; }
@Test public void shouldTransformPatternToValidRegex() { String regex = capturer.transformToRegex("{(hello)} world"); assertThat(regex, equalTo("(.*) world")); }
@Test public void shouldTransformMultiplePatternToValidRegex() { String regex = capturer.transformToRegex("{(hello)} {(world)}"); assertThat(regex, equalTo("(.*) (.*)")); }