我不確定是否可以這樣做,但是我需要根據測試調用不同的@Before方法。是否有可能爲此制定一些解決方案?Junit Jmock測試:用於測試的多個@Before
@Before
performBeforeOne();
@Before
performBeforeTwo();
@Test
callBeforeOneAndExecuteTestOne();
@Test
callBeforeTwoAndExecuteTestTwo();
或者我應該只是創建幾個方法,並從每個測試手動調用它們?
儘管您可以擁有多個@Before方法。你不能保證他們運行的順序。 – JamesB
謝謝,我忘了沒有命令:(。 –