在功能测试中,fakeApplication() 的实际地址是什么?
@Test
public void findById() {
running(fakeApplication(), new Runnable() {
public void run() {
Computer macintosh = Computer.find.byId(21l);
assertThat(macintosh.name).isEqualTo("Macintosh");
assertThat(formatted(macintosh.introduced)).isEqualTo("1984-01-24");
}
});
}
编辑
安迪的答案对我有用。
@Test
public void findById() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), new Runnable() {
public void run() {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost:3333/endpoint");
}
});
}