为什么@ Parameterized.Parameters会调用两次?

时间:2015-03-30 07:50:39

标签: java multithreading unit-testing testing junit

我有这段代码:

@RunWith(ParallelParameterized.class)
public class RoutingResponseShortRegressionOneByOne {

...

    @BeforeClass
    public static void oneTimeSetUp() {
        routingUrlHttpClientWithReRun = injector.getInstance(IRoutingUrlHttpClientWithReRun.class);
        System.out.println("in RoutingResponseRegressionOneByOne:: oneTimeSetUp");
    }

    @AfterClass
    public static void oneTearDown() {
        //        if (globalSettings.isSaveNewResponses) {
        assertE2eCheckers();
        stateSaver.save(e2EResultShort);
        //}
    }

    //takes the next matrix row from OrganizeTestParameterizedInput()
    public RoutingResponseShortRegressionOneByOne(String routingRequest, CompleteRoutingResponseShort
            routingResponse) {
        initNonStaticFromInjector();
        this.routingRequest = routingRequest;
        this.routingResponse = routingResponse;
    }


    //This is called before @BeforeClass !
    @Parameterized.Parameters
    public static Collection getRequests() throws IOException {
        injector = Guice.createInjector(new MainModule());
        initStaticFromInjector();
        initTestInput();
        e2EResultShort = new E2EResultShort();
        return OrganizeTestParameterizedInput();
    }

它的运行方式如下:

@Parameterized.Parameters

@Parameterized.Parameters

@BeforeClass

public RoutingResponseShortRegressionOneByOne --> ctor

@Test

为什么@Parameterized.Parameters连续两次调用?

此外,我怎么知道@RunWith(ParallelParameterized.class)确实有效?意思是如何检查运行是否并行?

0 个答案:

没有答案