类 InfraClassRule

java.lang.Object
cn.taketoday.test.context.junit4.rules.InfraClassRule
所有已实现的接口:
org.junit.rules.TestRule

public class InfraClassRule extends Object implements org.junit.rules.TestRule
ApplicationClassRule is a custom JUnit TestRule that supports class-level features of the TestContext Framework in standard JUnit tests by means of the TestContextManager and associated support classes and annotations.

In contrast to the JUnit4ClassRunner, Framework's rule-based JUnit support has the advantage that it is independent of any Runner and can therefore be combined with existing alternative runners like JUnit's Parameterized or third-party runners such as the MockitoJUnitRunner.

In order to achieve the same functionality as the JUnit4ClassRunner, however, a ApplicationClassRule must be combined with a InfraMethodRule, since ApplicationClassRule only supports the class-level features of the JUnit4ClassRunner.

Example Usage

 public class ExampleInfraIntegrationTest {

    @ClassRule
    public static final ApplicationClassRule applicationClassRule = new ApplicationClassRule();

    @Rule
    public final ApplicationMethodRule applicationMethodRule = new ApplicationMethodRule();

    // ...
 }

The following list constitutes all annotations currently supported directly or indirectly by ApplicationClassRule. (Note that additional annotations may be supported by various TestExecutionListener or TestContextBootstrapper implementations.)

NOTE: this class requires JUnit 4.12 or higher.

从以下版本开始:
4.0
作者:
Sam Brannen, Philippe Marschall
另请参阅: