Arho Huttunen
Arho Huttunen

Reputation: 1131

What are the real-life use cases of JUnit 5 @EnumSource?

JUnit 5 @EnumSource provides a way to use enum constants as parameters for parameterized tests.

However, I'm failing to picture good real-life use cases for this. The documentation examples are only demonstrating how the annotation is used and not really testing anything.

Can you give examples of @EnumSource in a real use case?

Upvotes: 1

Views: 901

Answers (1)

Stefan Birkner
Stefan Birkner

Reputation: 24510

There is an article about Burst that provides examples: https://medium.com/square-corner-blog/better-parameterized-tests-with-burst-6f17560013a

It is about JUnit 4 but I think the examples are valuable for JUnit Jupiter's @EnumSource, too.

Upvotes: 2

Related Questions