为了使这个答案:
public class MyTestClass {
private static String onceForAllTests;
@AfterClass
public static void afterClass() {
onceForAllTests = null; // silly, but just to demonstrate
}
@BeforeClass
public static void beforeClass() {
onceForAllTests = "This is set once for all tests";
}
@Test
public void sillyTest {
String someTestValue = "This is set during method";
assertNotEquals( onceForAllTests, someTestValue );
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1927 次 |
| 最近记录: |