@Test public void explains_undefined_parameter_types() { final Executable testMethod = () -> createExpression("{x}"); final CucumberExpressionException thrownException = assertThrows(CucumberExpressionException.class, testMethod); assertThat("Unexpected message", thrownException.getMessage(), is(equalTo("Undefined parameter type {x}. Please register a ParameterType for {x}."))); }
public Expression createExpression(String expressionString) { if (BEGIN_ANCHOR.matcher(expressionString).find() || END_ANCHOR.matcher(expressionString).find()) { return createRegularExpressionWithAnchors(expressionString); } Matcher m = SCRIPT_STYLE_REGEXP.matcher(expressionString); if (m.find()) { return new RegularExpression(Pattern.compile(m.group(1)), parameterTypeRegistry); } return new CucumberExpression(expressionString, parameterTypeRegistry); }
ExpressionFactory { public Expression createExpression(String expressionString) { if (BEGIN_ANCHOR.matcher(expressionString).find() || END_ANCHOR.matcher(expressionString).find()) { return createRegularExpressionWithAnchors(expressionString); } Matcher m = SCRIPT_STYLE_REGEXP.matcher(expressionString); if (m.find()) { return new RegularExpression(Pattern.compile(m.group(1)), parameterTypeRegistry); } return new CucumberExpression(expressionString, parameterTypeRegistry); } }
ExpressionFactory { public Expression createExpression(String expressionString) { if (BEGIN_ANCHOR.matcher(expressionString).find() || END_ANCHOR.matcher(expressionString).find()) { return createRegularExpressionWithAnchors(expressionString); } Matcher m = SCRIPT_STYLE_REGEXP.matcher(expressionString); if (m.find()) { return new RegularExpression(Pattern.compile(m.group(1)), parameterTypeRegistry); } return new CucumberExpression(expressionString, parameterTypeRegistry); } ExpressionFactory(ParameterTypeRegistry parameterTypeRegistry); }
ExpressionFactory { public Expression createExpression(String expressionString) { if (BEGIN_ANCHOR.matcher(expressionString).find() || END_ANCHOR.matcher(expressionString).find()) { return createRegularExpressionWithAnchors(expressionString); } Matcher m = SCRIPT_STYLE_REGEXP.matcher(expressionString); if (m.find()) { return new RegularExpression(Pattern.compile(m.group(1)), parameterTypeRegistry); } return new CucumberExpression(expressionString, parameterTypeRegistry); } ExpressionFactory(ParameterTypeRegistry parameterTypeRegistry); Expression createExpression(String expressionString); }
ExpressionFactory { public Expression createExpression(String expressionString) { if (BEGIN_ANCHOR.matcher(expressionString).find() || END_ANCHOR.matcher(expressionString).find()) { return createRegularExpressionWithAnchors(expressionString); } Matcher m = SCRIPT_STYLE_REGEXP.matcher(expressionString); if (m.find()) { return new RegularExpression(Pattern.compile(m.group(1)), parameterTypeRegistry); } return new CucumberExpression(expressionString, parameterTypeRegistry); } ExpressionFactory(ParameterTypeRegistry parameterTypeRegistry); Expression createExpression(String expressionString);  }