title: Getting java.lang.AbstractMethodError when I test using REST Assured
body: <p>I'm trying to test a REST api defined in my controller class using <code>REST Assured v4.3.0</code>, but I get <code>java.lang.AbstractMethodError</code> when I run the test. I understand this error is occurring because I'm calling an abstract method, but I'm having a hard time resolving it. </p>
  
  <p>It seems that the error is occurring due to <code>.body(is(equalTo("success")))</code> in <code>SampleControllerTest.java</code> because when I remove this line, the test succeeds. I tried a few things to resolve it, but didn't get any success:</p>
  
  <ul>
  <li>Searched online for suggestions and examples, but they are either for older versions or not related to <code>io.rest-assured/spring-mock-mvc</code></li>
  <li>Tried different matchers (<code>org.hamcrest.Matchers.*</code> and <code>org.hamcrest.CoreMatchers.*</code>)</li>
  <li>Tried adding <code>org.hamcrest/hamcrest</code> dependency in the pom file explicitly</li>
  </ul>
  
  <p>Here's my code for your reference:</p>
  
  <p><strong>Code structure:</strong></p>
  
  <pre><code>test
  |- src/
  |  |- main/
  |  |  |- java/
  |  |  |  |- org/
  |  |  |  |  |- example/
  |  |  |  |  |  |- Application.java
  |  |  |  |  |  |- SampleController.java
  |  |- test/
  |  |  |- java/
  |  |  |  |- org/
  |  |  |  |  |- example/
  |  |  |  |  |  |- SampleControllerTest.java
  |- target/
  |- pom.xml
  </code></pre>
  
  <p><strong>Application.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package org.example;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class Application {
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p><strong>SampleController.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package org.example;
  
  import org.springframework.http.HttpStatus;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseStatus;
  import org.springframework.web.bind.annotation.RestController;
  
  @RestController
  public class SampleController {
      @RequestMapping(value = "/sample")
      @ResponseStatus(value = HttpStatus.OK)
      public String getSample() {
          return "success";
      }
  }
  </code></pre>
  
  <p><strong>SampleControllerTest.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package org.example;
  
  import org.junit.Test;
  
  import static io.restassured.module.mockmvc.RestAssuredMockMvc.*;
  import static org.hamcrest.Matchers.*;
  import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
  
  public class SampleControllerTest {
      @Test
      public void testGetSample() {
          given()
              .standaloneSetup(new SampleController())
              .when()
              .get("/sample")
              .then()
              .assertThat(status().isOk())
              .body(is(equalTo("success")));
      }
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.2.1.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;groupId&gt;org.example&lt;/groupId&gt;
      &lt;artifactId&gt;test&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;8&lt;/java.version&gt;
          &lt;start-class&gt;org.example.Application&lt;/start-class&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;!-- JUnit --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/io.rest-assured/spring-mock-mvc --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;spring-mock-mvc&lt;/artifactId&gt;
              &lt;version&gt;4.3.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/io.rest-assured/json-path --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;json-path&lt;/artifactId&gt;
              &lt;version&gt;4.3.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/io.rest-assured/xml-path --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;xml-path&lt;/artifactId&gt;
              &lt;version&gt;4.3.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
              &lt;version&gt;4.3.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>When I run the test using <code>mvn test</code>, this is the error I get:</p>
  
  <pre><code>[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.325 s &lt;&lt;&lt; FAILURE! - in org.example.SampleControllerTest
  [ERROR] testGetSample(org.example.SampleControllerTest)  Time elapsed: 1.288 s  &lt;&lt;&lt; ERROR!
  java.lang.AbstractMethodError: Method io/restassured/internal/ResponseSpecificationImpl.getProperty(Ljava/lang/String;)Ljava/lang/Object; is abstract
          at org.example.SampleControllerTest.testGetSample(SampleControllerTest.java:20)
  </code></pre>
  
  <p>Thanks for any help in advance!</p>