consider my scenario
public class SomeClass {
@Autowired @Qualifier("converter1") private IConverter converter1;
@Autowired @Qualifier("converter2") private IConverter converter2;
public void doSomeAction(String mimeType) {
converter1.execute();
converter2.execute();
}
}
This is my code.
In order to test this
@RunWith(MockitoJUnitRunner.class)
public class SomeClassTest {
@Mock(name="converter1") IConverter converter1;
@Mock(name="converter2") IConverter converter2;
@InjectMocks SomeClass class = new SomeClass();
@Test
public void testGetListOfExcelConverters() throws Exception {
class.doSomeAction("abcd");
}
}
Here the mocks are not getting injected, please help with the proper mechanism for mocking a qualified beans.
If this is not the right way to code using spring, please let me know the correct method for using this.