我是JUNITS的新手,一直试图使用Mockito和PowerMockito为我的代码编写一些测试用例,但一直面临一个问题。 类代码: public class Example implements Callable<Void> {
int startIndex;
int endIndex;
ConnectionPool connPool;
Properti
从遗留应用程序中提取一些数据,我目前使用powermock来准备一些相当混乱的类,并用mock替换一些依赖项。 因此,我有一个JUnit测试,其基本上作用: @RunWith(PowerMockRunner.class)
@PrepareForTest(LegacyDependency.class)
public class ThisIsNotReallyATest {
@Test
这里使用Powermockito一个构造函数,给基类引用的是这种情况下,我有这样的事情在我的一类方法MyClass的 public class MyClass{
public Object build(Map map) {
BaseClass cls;
if(SomeconditionTrue) {
cls = new ChildClass1