DEV Community

Cover image for Migration from Junit 4 to Junit 5

Migration from Junit 4 to Junit 5

Victor Gallet on April 23, 2018

While working on my current project, I got some time to migrate from JUnit 4 to JUnit 5. Since JUnit 5 was released in September 2017, it's the rig...
Collapse
 
ahmedmusallam profile image
Ahmed Musallam

I wrote a simple http server extension based on an existing junit4 one.

Existing one (junit4) gist.github.com/rponte/710d65dc3be...
Mine (junit5): gist.github.com/ahmed-musallam/f62...

really makes testing apache's HttpClient easy!

Collapse
 
pgomezalvarez profile image
pedro gomez

Hi Victor, many thanks for this nice guide. It helped me a lot.
I think you have a typo:

import org.junit.jupiter.api.Test;

Should be without the last semicolon

Collapse
 
vga profile image
Victor Gallet

Thank you for your comment! Glad to hear it helps you.

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

Awesome post! thank you, helped me a lot!

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

Hi, starting with maven-surefire-plugin version 2.22.0 there is full support for JUnit 5 see the documentation maven.apache.org/surefire/maven-su....

Collapse
 
vga profile image
Victor Gallet

Yes, thank you for your comment. A lot of things has changed since I wrote this post.

The extension TemporaryExtension is now available with the project junit-pioneer.org/.
And Mockito now does fully support JUnit 5 -> twitter.com/sam_brannen/status/102...