|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||
org.junit Annotation Type AfterClass
If you allocate expensive external resources in a BeforeClass method you need to release them
after all the tests in the class have run. Annotating a public static void method
with @AfterClass causes that method to be run after all the tests in the class have been run. All @AfterClass
methods are guaranteed to run even if a BeforeClass method throws an
exception. The @AfterClass methods declared in superclasses will be run after those of the current
class.
public class Example {
private static DatabaseConnection database;
@BeforeClass public static void login() {
database= ...;
}
@Test public void something() {
...
}
@Test public void somethingElse() {
...
}
@AfterClass public static void logout() {
database.logout();
}
}
- 另请参见:
BeforeClass,Test
|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||