|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||
org.junit Annotation Type Before
When writing tests, it is common to find that several tests need similar
objects created before they can run. Annotating a public void method
with @Before causes that method to be run before the Test method.
The @Before methods of superclasses will be run before those of the current class.
No other ordering is defined.
public class Example {
List empty;
@Before public void initialize() {
empty= new ArrayList();
}
@Test public void size() {
...
}
@Test public void remove() {
...
}
}
- 另请参见:
BeforeClass,After
|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||