public StepExpression createExpression(StepDefinition stepDefinition) {
        List<ParameterInfo> parameterInfos = stepDefinition.parameterInfos();

        if (parameterInfos.isEmpty()) {
            return createExpression(
                stepDefinition.getPattern(),
                stepDefinitionDoesNotTakeAnyParameter(stepDefinition),
                false);
        }

        ParameterInfo parameterInfo = parameterInfos.get(parameterInfos.size() - 1);
        return createExpression(
            stepDefinition.getPattern(),
            parameterInfo.getTypeResolver()::resolve,
            parameterInfo.isTransposed());
    }
@Test
    void throws_for_unknown_parameter_types() {
        StepDefinition stepDefinition = new StubStepDefinition("Given a {unknownParameterType}");

        List<Envelope> events = new ArrayList<>();
        bus.registerHandlerFor(Envelope.class, events::add);

        CucumberException exception = assertThrows(
            CucumberException.class,
            () -> stepExpressionFactory.createExpression(stepDefinition));
        assertThat(exception.getMessage(), is("" +
                "Could not create a cucumber expression for 'Given a {unknownParameterType}'.\n" +
                "It appears you did not register a parameter type."

        ));
        assertThat(events, iterableWithSize(1));
        assertNotNull(events.get(0).getUndefinedParameterType());
    }