如何使用JMockit模拟getProperty方法?代码如下:
LWPropertyResource props = LWSupportFactoryImpl.getInstance().getPropertyResource(VALIDATE_HANDLER_PROPS);
String endDate = props.getProperty("endDate");发布于 2014-07-18 22:47:47
您需要模拟props类:
@Mocked LWPropertyResource props; //instance variable
new NonStrictExpectations {{
props.getProperty("endDate"); result="My fake prop";
}};https://stackoverflow.com/questions/24827662
复制相似问题