2014-11-23 35 views
0

我試圖存根交互(Groovy代碼)異常在matchingJsonPath與wiremock

stubInteraction(
     post(urlEqualTo("/someUrl")) 
       .withRequestBody(matchingJsonPath("\$.firstName")) 
      aResponse() 
       .withBody("") 
       .withStatus(200) 

我收到異常

Problem accessing /someUrl. Reason: 
com.jayway.jsonpath.JsonPath.read(Ljava/lang/String;Ljava/lang/String;[Lcom/jayway/jsonpath/Filter;)Ljava/lang/Object;</pre></p><h3>Caused by:</h3><pre>java.lang.NoSuchMethodError: com.jayway.jsonpath.JsonPath.read(Ljava/lang/String;Ljava/lang/String;[Lcom/jayway/jsonpath/Filter;)Ljava/lang/Object; 
at com.github.tomakehurst.wiremock.matching.ValuePattern.isJsonPathMatch(ValuePattern.java:194) 

對JSON:

{"firstName":"Jan"} 

我在做什麼錯誤?

回答

1

看起來像一個依賴性問題。你有通過一些其他依賴包括jsonpath嗎?

如果是這樣的話,你可能想這裏描述的嘗試,包括單機版與排除所有依賴:http://wiremock.org/getting-started.html

+0

謝謝,我會努力 – MariuszS 2014-11-25 09:57:05

+0

單機版包括老班'javax.servlet.http.HttpServletRequest'沒有'isAsyncStarted',所以我仍然有問題。 – MariuszS 2014-11-25 11:51:32