Skip to content

Demonstrate migration path from JUnit 4 to JUnit 5 #169

@sbrannen

Description

@sbrannen

Overview

Based on discussions I've had with developers in the community, it is apparent that some people fear an upgrade from JUnit 4 to JUnit 5. Aside from the fact that it's totally feasible to run JUnit 4 tests alongside JUnit 5 tests, we should still attempt to migrate an existing JUnit 4 test suite just to see where the hurdles are.

Proposal

Demonstrate how to migrate from JUnit 4's ExpectedException Rule to a JUnit 5 Extension-based alternative.

Food for Thought

Can this be achieved with simple search-and-replace?

Can a JUnit 5 extension be implemented that honors JUnit 4's ExpectedException transparently, without the need to modify a single line within test methods -- for example, by removing @Rule from the ExpectedException field and adding @ExtendWith(SomeExpectedExceptionExtension.class)?

Related Issues

Related Blogs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions