-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegrationTest.java
More file actions
35 lines (29 loc) · 1008 Bytes
/
IntegrationTest.java
File metadata and controls
35 lines (29 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package test;
import org.junit.Test;
import play.libs.F.Callback;
import play.test.TestBrowser;
import static org.fest.assertions.Assertions.assertThat;
import static play.test.Helpers.HTMLUNIT;
import static play.test.Helpers.fakeApplication;
import static play.test.Helpers.inMemoryDatabase;
import static play.test.Helpers.running;
import static play.test.Helpers.testServer;
/**
* Runs a server with a fake in-memory database to test the system.
*/
public class IntegrationTest {
/**
* Check to see that both the index and page1 pages can be retrieved.
*/
@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()).contains("home page");
browser.goTo("http://localhost:3333/page1");
assertThat(browser.pageSource()).contains("Page1");
}
});
}
}