JUnit测试中的Guice注入器 [英] Guice injector in JUnit tests
本文介绍了JUnit测试中的Guice注入器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Guice,在每个JUnit测试类中获取一个新的注入器是一个好习惯,因为每个测试类应该是独立的吗?
Using Guice, is it a good practice to get a new injector in each JUnit test class, as each test class should be independant?
推荐答案
看看 Guice Berry 。
我现在不建议使用它(文档非常糟糕),但是看看他们的方法可以让你清楚地了解如何在jUnit中完成DI。
I won't recommend using it now (documentation is really terrible), but looking at their approach can make you think clear about how DI should be done in jUnit.
这篇关于JUnit测试中的Guice注入器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文