运行默认Spring单元测试时:class DemoH2FlywayApplicationTests { void contextLoadscreating bean with name 'flyway' defined in class path resource spring-boot-starter-data-jdbcspring-<e
我正在为我的一个Spring控制器编写一个集成测试。测试包含一个配置文件(data-access-configuration.xml),该文件使用JNDI配置了DataSource。当我运行这个测试时,我得到了一个错误error creating bean with name dataSource嵌套异常NoIntialContextException。下面是我的Test类和配置文件<jee:jndi-lookup jndi-name="jobportal_db
我读到,当使用@Mock时,它应该与@RunWith(MockitoJUnitRunner.class)一起使用,而对于@MockBean,它应该与@RunWith(SpringRunner.class)一起使用。@RunWith(MockitoJUnitRunner.class) // also work when @RunWith(SpringRunner.class) is used
public class testS