I have an original unit test not written by me, where there is a @ContextConfiguration loading from an XML file. I made a change where one of the beans now has a dependency injected, but the config load is now failing.
Unit Test
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
@ContextConfiguration(classes={ BaseTest.Config.class })
public class BaseTest {
@ImportResource({ "/spring/patch-config.xml" })
public static class Config {
@Bean
@Primary
public tagImpl getTagImpl() {
return Mockito.mock(TagImpl.class);
}
Class with new dependency
@Named
public class TagImpl implements Tagging {
@Inject
RCA rca;
Error when running
Error creating bean with name 'getTagImpl': Unsatisfied dependency expressed through field 'rca'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.paypal.partner.config.RCA' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.inject.Inject()}
It seems like the test is broken due to the new dependency I’ve added, but I have no clue where to fill in this gap. Some help, or tips to where to read up on this would be greatly appreciated
zeepzeep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.