Monthly Archives: December 2016

Spring + TestNG + @Spy Example

@ContextConfiguration({“/spring/applicationContext.xml”}) public class SprintTestngWithSpyAnnotationITCase extends AbstractTestNGSpringContextTests { //this bean will take mocked objects injected into it, but it itself is not going to be mocked @InjectMocks @Resource SomeService someService; //it equals to one that is created via spy(applicationContext.getBean(SomeDAO.class)) and it will be // injected to “someService” above @Spy @Resource SomeDAO someDAO; @BeforeMethod public void beforeMethod() […]