I actually find that Guice boilerplate is fairly minimal in my integration tests. I keep my modules very small and independent so that I can just tie the ones together that I need for that test and get tends to make the injector creation step quite small as well. Rather than using an external library i might just use a superclass of a set of JUnit tests to automatically create and inject certain objects that i'm testing. I'd be interested to hear if any libraries exist to make this easier.
发布评论
评论(1)
事实上,我发现 Guice 样板在我的集成测试中相当少。我将我的模块保持得非常小并且独立,这样我就可以将测试所需的模块捆绑在一起,并且往往会使注入器创建步骤也变得非常小。我可能不使用外部库,而是使用一组 JUnit 测试的超类来自动创建和注入我正在测试的某些对象。我很想知道是否存在任何库可以使这变得更容易。
I actually find that Guice boilerplate is fairly minimal in my integration tests. I keep my modules very small and independent so that I can just tie the ones together that I need for that test and get tends to make the injector creation step quite small as well. Rather than using an external library i might just use a superclass of a set of JUnit tests to automatically create and inject certain objects that i'm testing. I'd be interested to hear if any libraries exist to make this easier.