netflix测试能不能看_Netflix监管者测试–引入知事,准官员
netflix測試能不能看
 考慮一個典型的Netflix Governator junit測試。 
該測試利用了Netflix Governator提供的Junit規(guī)則支持,并測試了Governator的某些功能集-引導(dǎo)模塊,程序包掃描,配置支持等。
但是,該測試有很多樣板代碼,我認為可以通過使用Junit Runner類型的模型來減少。 作為這個概念的證明,我將介紹一個沒有想象力的項目– Governorator-junit-runner ,現(xiàn)在考慮使用該庫重寫的同一測試:
@RunWith(GovernatorJunit4Runner.class) @LifecycleInjectorParams(modules = SampleModule.class, bootstrapModule = SampleBootstrapModule.class, scannedPackages = "sample.gov") public class SampleGovernatorRunnerTest {@Injectprivate BlogService blogService;@Testpublic void testExampleBeanInjection() throws Exception {assertNotNull(blogService.get(1l));assertEquals("Test Blog Service", blogService.getBlogServiceName());}}現(xiàn)在,大多數(shù)樣板都在Junit運行器中實現(xiàn),并且通過LifecycleInjectorParams批注傳遞引導(dǎo)監(jiān)管程序所需的參數(shù)。 測試實例本身是一個綁定的組件,因此可以被注入,這樣,需要測試的實例可以被注入測試本身并被斷言。 如果您想要更細粒度的控制,則可以將LifecycleManager本身注入到測試中!:
@Inject private Injector injector;@Inject private LifecycleManager lifecycleManager;如果您對此感興趣,可以在此處的項目現(xiàn)場找到更多示例。
翻譯自: https://www.javacodegeeks.com/2015/02/netflix-governator-tests-introducing-governator-junit-runner.html
netflix測試能不能看
總結(jié)
以上是生活随笔為你收集整理的netflix测试能不能看_Netflix监管者测试–引入知事,准官员的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: linux新建文件的命令有哪些(linu
- 下一篇: 我的安卓手机连不上苹果热点(我的安卓手机
