Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JUnit中的注释列表_Java_Junit4 - Fatal编程技术网

Java JUnit中的注释列表

Java JUnit中的注释列表,java,junit4,Java,Junit4,最近,我研究并实现了JUnit框架。因此,我知道JUnit中使用的注释很少:@Test,之前的,之后的,@Ignore,@BeforeClass,@AfterClass,@Runwith(Suite.class),@suitecases({}),@Parameters,@Runwith(参数化.class)和@规则 我确信JUnit中使用了更多的注释。有谁能给我提供一个可以使用的注释列表,以及在什么情况下使用这些注释 谢谢。此Github搜索(@interface)提供了所有注释的列表: 基本

最近,我研究并实现了JUnit框架。因此,我知道JUnit中使用的注释很少:@Test,之前的
之后的
@Ignore
@BeforeClass
@AfterClass
@Runwith(Suite.class)
@suitecases({})
@Parameters
@Runwith(参数化.class)
@规则

我确信JUnit中使用了更多的注释。有谁能给我提供一个可以使用的注释列表,以及在什么情况下使用这些注释

谢谢。

此Github搜索(
@interface
)提供了所有注释的列表:

基本注释

参数化测试 对于参数化测试,使用
@Parameters
@RunWith(Parameterized.class)

类别
将测试分组到类别中。e、 快、慢等


仅运行所需的类和方法 用
@IncludeCategory
注释或该类别的子类型


@IncludeCategory的逆

规则
规则允许非常灵活地添加或重新定义测试类中每个测试方法的行为。e、 g.创建临时文件夹规则,用于在运行测试时创建临时文件夹

理论与相关注释
理论给出了更灵活、更具表现力的断言


@DataPoint
注释字段或方法将导致字段值 或方法返回的值,用作的潜在参数 那门课的理论

扩展
@Datapoint

@DataPoints
将使给定的数组或iterable中的值用作电势 该类理论的参数

@FromDataPoints
注释
@Theory
方法的参数将限制 数据点被视为该参数的潜在值,仅适用于
@DataPoints
具有给定名称


应用的
@参数注释
@理论
方法参数会导致提供该参数 作为理论运行时,来自命名的
参数supplier
的值

@TestedOn
注释采用一个值数组作为注释对象的数据点 参数

e、 g

@Theory
public void multiplyIsInverseOfDivideWithInlineDataPoints(
        @TestedOn(ints = {0, 5, 10}) int amount,
        @TestedOn(ints = {0, 1, 2}) int m
) {
    assumeThat(m, not(0));
    assertThat(new Dollar(amount).times(m).divideBy(m).getAmount(), is(amount));
}