Search in sources :

Example 1 with TestCaseInstanceProvider

use of com.carrotsearch.randomizedtesting.annotations.TestCaseInstanceProvider in project randomizedtesting by randomizedtesting.

the class RandomizedRunner method getInstanceProvider.

/**
   * Determine instance provider. 
   */
private InstanceProvider getInstanceProvider(Constructor<?> constructor, Object[] args) {
    TestCaseInstanceProvider.Type type = TestCaseInstanceProvider.Type.INSTANCE_PER_TEST_METHOD;
    TestCaseInstanceProvider providerAnn = suiteClass.getAnnotation(TestCaseInstanceProvider.class);
    if (providerAnn != null) {
        type = providerAnn.value();
    }
    switch(type) {
        case INSTANCE_PER_CONSTRUCTOR_ARGS:
            return new SameInstanceProvider(new NewInstanceProvider(constructor, args));
        case INSTANCE_PER_TEST_METHOD:
            return new NewInstanceProvider(constructor, args);
        default:
            throw new RuntimeException();
    }
}
Also used : TestCaseInstanceProvider(com.carrotsearch.randomizedtesting.annotations.TestCaseInstanceProvider)

Aggregations

TestCaseInstanceProvider (com.carrotsearch.randomizedtesting.annotations.TestCaseInstanceProvider)1