demo-junit-5 icon indicating copy to clipboard operation
demo-junit-5 copied to clipboard

Demonstrating JUnit 5 features

Demo of JUnit 5

Demo project accompanying a series of posts exploring JUnit 5.

First Steps

  • Setup: have a look at pom.xml or build.gradle
  • Basics: LifecycleTest is a good introduction, for more details see the other classes in test/.../basics
  • Tests in interfaces in test/.../interfaces

Next Steps

  • Parameter injection: demonstrated in test/.../injection
  • Nested tests: demonstrated in test/.../nested
  • Parameterized tests: demonstrated in test/.../parameterized, starting with HelloParams
  • Dynamic tests: demonstrated in test/.../dynamic

JUnit 4 and 5

  • Architecture (has no code samples)
  • Side by side with JUnit 4: configured in pom.xml and build.gradle (search for 4.12) and demonstrated in LegacyTest
  • JUnit 4 rules in JUnit Jupiter: demonstrated in JUnit4RuleInJupiter

Extensions

  • Extension model: implemented in main and used in test/.../extensions
  • Conditions: implemented in main and used in test/.../extensions
  • Example integrations, e.g. with Mockito, in test/.../integrations