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

Add tiny DSL for Extension configuration #27

Open
efenderbosch opened this issue May 30, 2023 · 0 comments
Open

Add tiny DSL for Extension configuration #27

efenderbosch opened this issue May 30, 2023 · 0 comments

Comments

@efenderbosch
Copy link

Nothing absolutely necessary, but having a DSL around the WireMockExtension.Builder would be nice.

fun wireMockExtension(block: WireMockExtension.Builder.() -> Unit): WireMockExtension =
    WireMockExtension.newInstance().apply(block).build()

Before:

companion object {
    @JvmField
    @RegisterExtension
    val wiremock: WireMockExtension = WireMockExtension.newInstance()
        .options(wireMockConfig().dynamicPort())
        .failOnUnmatchedRequests(true)
        .build()
}

After:

companion object {
    @JvmField
    @RegisterExtension
    val wiremock = wireMockExtension {
        options(wireMockConfig().dynamicPort())
        failOnUnmatchedRequests(true)
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant