Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Receiver class does not define or inherit an implementation" with RestAssured 4.3.0

When running the following WebTestClient test

    @Test
    fun `test accepted response`() {
        standaloneSetup(SapKontraktEndpointV1())

        given()
            .body(
                "{}", ObjectMapperType.JACKSON_2
            )
            .contentType(ContentType.JSON)
        .`when`()
            .post("/api/v1/kontrakt/erstellen")
        .then()
            .statusCode(202)
    }

Then the following error occurs:

java.lang.AbstractMethodError: Receiver class io.restassured.internal.mapping.ObjectMapperSerializationContextImpl does not define or inherit an implementation of the resolved method 'abstract void setProperty(java.lang.String, java.lang.Object)' of interface groovy.lang.GroovyObject.

    at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:213)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:496)
    at io.restassured.internal.mapping.ObjectMapping.serializationContext(ObjectMapping.groovy:275)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:149)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:100)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:196)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:224)
    at io.restassured.internal.mapping.ObjectMapping.serialize(ObjectMapping.groovy:123)
    at io.restassured.module.webtestclient.internal.WebTestClientRequestSpecificationImpl.body(WebTestClientRequestSpecificationImpl.java:357)

With 4.2.0 the test run is successful.

like image 567
Andras Hatvani Avatar asked Apr 29 '20 17:04

Andras Hatvani


1 Answers

In my case it seems to be a bug in 4.3.0, because with 4.2.0 tests run fine.

like image 88
Andras Hatvani Avatar answered Oct 20 '22 05:10

Andras Hatvani