java IntegrationTest.java

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java IntegrationTest.java相关的知识,希望对你有一定的参考价值。

import org.junit.*;

import play.libs.ws.WS;
import play.libs.ws.WSResponse;
import play.mvc.*;
import play.test.*;
import play.libs.F.*;

import static play.test.Helpers.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import static org.fluentlenium.core.filter.FilterConstructor.*;

public class IntegrationTest extends WithApplication {

    /**
     * add your integration test here
     * in this example we just check if the welcome page is being shown
     */
    @Test
    public void test() {
        running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
            public void invoke(TestBrowser browser) {
                browser.goTo("http://localhost:3333");
                assertThat(browser.pageSource(), containsString("Add Person"));
            }
        });
    }

    @Test
    public void testRequest() {
        Promise<WSResponse> promise = WS.url("http://www.google.com").get();
        assertThat(
        promise.get(1000).getStatus(), equalTo(OK));
    }
}

以上是关于java IntegrationTest.java的主要内容,如果未能解决你的问题,请参考以下文章

Java Math

Java 布尔运算

java [Java] Java常用代码#java

Java - 35 Java 实例

Java While 循环

Java 字符串