制作一个假的javax.sql.DataSource?(Make a fake javax.sql.DataSource?)
我必须使用String Test框架编写测试,其中使用了许多数据库连接。
在测试中,我不需要所有数据源,但Spring希望它们全部注入。
是否有任何标准或众所周知的假javax.sql.DataSource实现只是为了满足Spring DI机制?
I have to write tests with String Test framework where many DB connections was used.
In test I don't need all data sources but Spring want them all to inject.
Are there any standard or well known fake javax.sql.DataSource implementation just to satisfy Spring DI mechanic?
最满意答案
您可以使用Mockito框架。 使用Springockito,您可以在Spring环境中模拟数据源。
在这个SO答案中 ,这个资源的信用是kubek2k 。
You can use Mockito framework. Using Springockito you can mock your datasources on a Spring environment.
Credit of this resource is for kubek2k in this SO answer.
更多推荐
发布评论