0

在功能测试中,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");
    }
  });
}
4

1 回答 1

4

AFAICT,如果你需要一个 url,你应该使用 FakeServer 而不是 FakeApplication

于 2012-06-05T05:17:03.263 回答