Hi All,
Am trying to mock local object by using
Mockito framework ,that is being created from the spring application context .But every time when am running the application by
TestNG its failed to replace the original object by the mocked object.
Here is the original class's code spinets:
public void executeMyJob(){
ApplicationContext springContext = ApplicationContextUtil.getApplicationContext();
MusicEAO music= (MusicEAO) springContext.getBean("MusicEAO"); List<Brand> dataList =music.getAll();
......
......
}
I want to mock the MusicEAO and when the getAll() method being called it will call the mock object.
Below is my
test class code snippets:
@Mock
MusicEAO musicEAO ;
when(musicEAO.findAll()).thenReturn(myDefinedList);
Can anybody help me out this ?
Thanks and warm regards,
Satya