强制Cucumber不为DataTable调用错误的构造函数

时间:2017-01-17 14:31:45

标签: cucumber-jvm

在不更改Data类的情况下,最简单的方法是什么?

public class MySteps {
    @Given("^some data table:$")
    public void some_data_table (
        final List<ThirdPartyEntityCucumberHatesMe> rows) throws Throwable {
            for (ThirdPartyEntityCucumberHatesMe row : rows) {
                // I get 1 rows here \o/
            }
        }
    }

    public static class ThirdPartyEntityCucumberHatesMe extends ThirdPartyEntity {
        // this was the easiest way to get cucumber to not call the wrong constructor :'(
    }
}

1 个答案:

答案 0 :(得分:2)

我找到的最好方法是通过覆盖我的测试类中的实体来隐藏我不希望黄瓜调用的构造函数:

sysctl -w net.ipv4.conf.all.accept_local=1
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.your_nic.rp_filter=0