[英]play 2.0.2 test query parameter error
我有一個Java play 2控制器,它接受如下查詢字符串參數:
控制器:
public static Result syncInterests(
String lastsyncdate,
String fooid) {
}
測試:
Result result = routeAndCall(fakeRequest(GET, "/foo/sync?fooid=123"));
但是得到這個錯誤。 這是什么意思? 當然,這是一個Java操作。
failed: This is not a JavaAction and can't be invoked this way.
編輯:
這就是我在路線中定義的方式。 lastsyncdate是可選的。
GET /foo/sync controllers.FooSync.syncInterests(lastsyncdate: String, fooid: String)
編輯:
我無法使它正常工作。 因此,我使用此功能進行測試以繼續進行其他工作。
Result result = callAction(controllers.routes.ref.FooSync.syncInterests(time, fooId));
我認為您的網址“ / foo / sync?fooid = 123”對於控制器不正確。 它應該是“ / foo / syncInterests?fooid = 123”,並且syncInterests方法應該具有return語句。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.