简体   繁体   English

在Java Play中检查动态表中是否存在值?

[英]Check for existence of a value in a dynamic table in java play?

In my IntegrationTest.java class, I have the following test 在我的IntegrationTest.java类中,我进行了以下测试

   @Test
       public void testTableIsPopulated() {
           running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, browser -> {
               browser.goTo("http://localhost:9000");
               assertThat(browser.pageSource(), hasKey("key")));
           });
       }

Which fails to ascertain whether the dynamic table produced in 哪个无法确定是否在

/views/index.scala.html contains id=key. /views/index.scala.html包含id = key。 This effectively tests whether the table is populated with values as the table is populated using the javascript 当使用javascript填充表格时,这可以有效地测试该表格是否填充了值

   .each(data, function(key, value) {

So no key implies no value. 因此,没有钥匙就意味着没有价值。

What should replace the assertThat line that will ascertain if the key exists? 用什么来代替可以确定密钥是否存在的assertThat行?

       browser.goTo("http://localhost:3333");

问题不是assertThat() ,我将请求发送到了错误的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM