我有一个测试套件类:
@RunWith(Suite.class)
@Suite.SuiteClasses({
GameMasterTest.class,
PlayerTest.class,
})
public class BananaTestSuite {
Run Code Online (Sandbox Code Playgroud)
在包含实际测试的任何类之前,我需要使用什么注释来在此类中运行函数?现在,我正在这样做,它可以工作,但它不是那么可读:
static {
try {
submitPeelAction = new Player(new GameMaster(1)).getClass().getDeclaredMethod("submitPeelAction");
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
submitPeelAction.setAccessible(true);
}
Run Code Online (Sandbox Code Playgroud)
我试过@BeforeClass但它没用.