Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC Test Json Path missing dependencies? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC Test Json Path missing dependencies?

    I am working in Spring 3.2.0 RC1 with the new MVC Test framework. One issue I was having was getting JsonPath to work correctly.

    For example:
    Code:
     this.mockMvc.perform(get("/test")).andExpect(jsonPath("path").value("test"))
    It kept giving me the error code of "java.lang.AssertionError: No value for JSON path: test". I finally debugged and did research to find out that it is missing a few dependencies in order to use jsonPath.

    The dependencies it needs are the ones below.

    Code:
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <version>0.8.1</version>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    The question is: Are we supposed to have to include those dependencies in order to get the Spring MVC Test with JsonPath to work? Or are they supposed to be packaged within Spring 3.2.0 RC1?

    Thanks!
Working...
X