Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 java.lang.AbstractMethodError: Receiver class org.wiremock.RandomHelper does not define or inherit an implementation of the resolved method abstract java.lang.Object apply #15

Open
zyberzebra opened this issue Nov 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zyberzebra
Copy link

zyberzebra commented Nov 22, 2024

Proposal

Proposal

I get an Error using multiple Extensions:

Error 500 java.lang.AbstractMethodError: Receiver class org.wiremock.RandomHelper does not define or inherit
        an implementation of the resolved method 'abstract java.lang.Object apply(java.lang.Object,
        wiremock.com.github.jknack.handlebars.Options)' of interface
        wiremock.com.github.jknack.handlebars.Helper.

Reproduction steps

@SpringBootApplication
public class Demo4Application {

    public static void main(String[] args) {
        SpringApplication.run(Demo4Application.class, args);
        var store = new CaffeineStore();
        WireMockServer server = new WireMockServer(
                options()
                        .port(1234)
                        .templatingEnabled(true)
                        .globalTemplating(true)
                        .extensions(new StateExtension(store))
                        .extensions(new RandomExtension())
                        .usingFilesUnderDirectory("src/main/resources")
        );
        server.start();
    }
}

The mapping:

{
  "mappings": [
    {
      "request": {
        "urlPathPattern": "/store",
        "method": "POST"
      },
      "response": {
        "status": 200,
        "body": "{{ random 'BojackHorseman.quotes'}}"
      },
      "serveEventListeners": [
        {
          "name": "recordState",
          "parameters": {
            "state": {
              "stored": "{{request.body}}"
            },
            "context": "profile"
          }
        }
      ]
    },
    {
      "request": {
        "urlPathPattern": "/stored",
        "method": "GET"
      },
      "response": {
        "body": "stored {{state context='profile' property='stored' default='nothing here'}} + a random value"

      }
    }
  ]
}

The gradle File

plugins {
    java
    id("org.springframework.boot") version "3.4.0"
    id("io.spring.dependency-management") version "1.1.6"
}

group = "zebra.zyber"
version = "0.0.1-SNAPSHOT"

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
    maven { url = uri("https://repo.spring.io/milestone") }
}

extra["springCloudVersion"] = "2024.0.0-RC1"

dependencies {
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.springframework.cloud:spring-cloud-contract-wiremock")
    implementation("org.wiremock:wiremock-standalone:3.9.2")
    implementation("org.wiremock.extensions:wiremock-faker-extension:0.2.0")
    implementation("org.wiremock.extensions:wiremock-state-extension-standalone:0.8.0")
    
    testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

dependencyManagement {
    imports {
        mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

@zyberzebra zyberzebra added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant