Tag: springmockito

如何模拟JdbcTemplate.queryForObject()方法

我的方法看起来像这样: public class Decompile extends JdbcDaoSupport public void getRunner(){ String val = this.getJdbcTemplate().queryForObject(sql,String.class, new Object[]{1001}); } } 请建议我如何嘲笑这个。

Springockito怎么样?

我想在我的一个IT中使用Springockito来模拟DAO bean。 在我的IT中,我必须使用spring context.xml来自动assembly某些服务,并使用mockApplication.xml来模拟DAO。 那么,我如何同时使用两个xml配置文件呢? @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader = SpringockitoContextLoader.class, locations = {“classpath*:/MockApplicationContext.xml”}) public class PayRollComponentFacadeIT { @Autowired IPayRollComponentFacade payRollComponentFacade; @ReplaceWithMock @Autowired IPayRollPersistenceManager payRollPersistenceManager; 我已将模拟上下文包含为@ContextConfiguration(loader = SpringockitoContextLoader.class, locations = {“classpath*:/MockApplicationContext.xml”}) 但我必须包括spring上下文@ContextConfiguration(locations = {“classpath*:/testApplicationContext.xml”}) 关心Rajib