开发者

Anyone using Junit4 with cpsuite-1.2.5 and EasyMock?

We are using ClassPathSuite to simplify our testing: http://www.johanneslink.net/projects/cpsuite.jsp

This works extremely well. The only issue we are encountering is with EasyMock. EasyMock works fine if we run a single test class in isolation. But if we try to run all of our tests using ClassPathSuite EasyMock does not work correctly:

import org.junit.experimental.c开发者_如何学JAVAategories.Categories;
import org.junit.experimental.categories.Categories.*;
import org.junit.extensions.cpsuite.ClasspathSuite.*;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Categories.class)
@ExcludeCategory(SlowTest.class)
@SuiteClasses( {AllCITests.class})
public class FastTestSuite {

}

No exceptions occur, however the following code appears to not function as expected (we never get back what we define in the andReturn:)

EasyMock.expectLastCall().andReturn(somethingElse);

Has anyone seen & solved this issue?


This turned out to have nothing to do with ClassPathSuite or EasyMock. Instead it was caused by the use of Singletons in our code. We had a specific scenario where EasyMock was not being called because a Singleton already existed for the object we were trying to mock.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜