2013-06-05 44 views
0

在嘗試了很多方法來玩java來僞造一個發佈到我的控制器的請求,但沒有任何效果。如何在Play中僞造一個json發佈請求2.1.1

callAction(controllers.routes.ref.MyController.myFunction(), fakeRequest().withHeader("Content-Type", "application/json").withJsonBody(json)); 

在eclipse中它總是說the method fakeRequest() is undefinded

+0

您沒有提供太多的代碼,所以我的第一個猜測是它沒有定義。 – keyser

+0

http://stackoverflow.com/a/24850328/243233 – Jus12

回答

1

Add import static play.test.Helpers。*