How to write database integration test properly in Play 2.1?

I am new at Play! 2.1. I'm trying to TDD my database integration test. After reading the examples on the website. I wrote my test like this.

    @Test
    public void shouldGetDealName() {
        running(fakeApplication(), new Runnable() {
            public void run() {
                List books = Book.find.all();
                Assert.assertEquals(books.size(), 1);
            }
        });
    }

My question would be, do I need to wrap the code in running(fakeAppliation()... all the time? Because if I run this code without the fakeApplication. It doesn't seem to work. If it has to be like that then is there a better way to do this in Java? It seems wrong for me to wrap the code in that block every time for integration or functional test. Thanks.

以上就是How to write database integration test properly in Play 2.1?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏