IllegalArgumentException黄瓜自定义参数Java

问题描述 投票:0回答:1

我正在获得运行时CucumberException:

cucumber.runtime.CucumberException: Failed to invoke com.inin.testing.cucumber.stepdefs.ui.chat.ChatRosterStepDefs.a_splat_is_displayed_on_the_groups_tab_of_the_chat_roster(String,String) in file: *******/cucumber-tests/target/classes/, caused by java.lang.IllegalArgumentException: argument type mismatch

我的功能步骤是:Then a splat is not displayed on the "user" tab of our roster

我对黄瓜表达的自定义参数是:

registry.defineParameterType(new ParameterType<>(
                "isOrIsNot",                     // name
                "is|is not",                     // regexp
                boolean.class,                   // type
                (String arg) -> "is".equals(arg) // transformer function
        ));

最后是我的小黄瓜:

@Then("a splat {isOrIsNot} displayed on the {string} tab of our roster")

我不太确定自己在做什么错,我的自定义参数定义不正确吗?

java cucumber-java
1个回答
0
投票

对任何想知道的人,我只需要将自定义参数定义更改为String.class,并让该函数返回arg!

© www.soinside.com 2019 - 2024. All rights reserved.