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

Support jUnit5 extension #67

Open
tasomaniac opened this issue Jan 19, 2019 · 2 comments
Open

Support jUnit5 extension #67

tasomaniac opened this issue Jan 19, 2019 · 2 comments

Comments

@tasomaniac
Copy link

Support jUnit5 extension. It is super easy to do, the question is how to distribute it. A new module with new artifact? Or include them together? I also don't know what is the best practice.

Here is how it would look like

class MockServerExtension : BeforeEachCallback, AfterEachCallback {

    lateinit var server: MockWebServer

    override fun beforeEach(context: ExtensionContext) {
        server = MockWebServer()
        DispatcherRetainer.registerRetainer()
        DispatcherRetainer.resetDispatchers()
        server.start()
    }

    override fun afterEach(context: ExtensionContext) {
        server.shutdown()
        DispatcherRetainer.resetDispatchers()
        server.setDispatcher(DispatcherRetainer.queueDispatcher)
    }
}
@tasomaniac
Copy link
Author

If we agree here, I would like to contribute this.

@JorgeCastilloPrz
Copy link
Owner

I think a new artifact would fit better IMO. hiroaki-junit5.

One example of other libs using the same approach, Spring: https://github.com/sbrannen/spring-test-junit5/blob/master/README.md#jitpack-with-gradle

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

Successfully merging a pull request may close this issue.

2 participants