MCPcopy Index your code
hub / github.com/bonigarcia/mastering-junit5

github.com/bonigarcia/mastering-junit5 @5.12

Chat with this repo
repository ↗ · DeepWiki ↗ · release 5.12 ↗ · + Follow
669 symbols 1,202 edges 200 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build Status badge-jdk License badge Support badge Twitter Follow

This repository contains the code examples of JUnit 5 for the book Mastering Software Testing with JUnit 5, authored by [Boni García] and published by Packt.

These examples cover the main features of JUnit 5, such as:

  • JUnit 5 tests lifecycle.
  • Assertions.
  • Tagging and filtering tests.
  • Conditional test execution.
  • Nested and repeated tests.
  • Migration from JUnit 4.
  • Dependency injection.
  • Dynamic tests.
  • Test interfaces.
  • Test templates.
  • Parameterized tests.
  • Parallel execution.
  • Ordered tests.

Moreover, the integration with third-party technologies is also illustrated with examples, concretely:

  • Mockito (popular mock framework).
  • Spring (Java framework aimed to created enterprise applications based on dependency injection).
  • Docker (container platform technology).
  • Selenium WebDriver (test automation library for web applications).
  • Appium (test automation library for mobile devices).
  • Android (open source mobile operating system based on Linux).
  • REST services (using REST Assured, Retrofit2, or WireMock).

JUnit 5 versions

This repository has different tags, one per minor version of JUnit 5. Currently, the available tags are the following:

  • 5.0: Examples using JUnit 5.0.3. The examples of the book Mastering Software Testing with JUnit 5 are based on this version.
  • 5.1: Examples using JUnit 5.1.1.
  • 5.2: Examples using JUnit 5.2.0.
  • 5.3: Examples using JUnit 5.3.2.
  • 5.4: Examples using JUnit 5.4.2.
  • 5.5: Examples using JUnit 5.5.2.
  • 5.6: Examples using JUnit 5.6.3.
  • 5.7: Examples using JUnit 5.7.2.
  • 5.8: Examples using JUnit 5.8.2.
  • 5.9: Examples using JUnit 5.9.3.

Complete example

The project Rate my cat! contains a sample web application based on Spring Boot (Spring MVC, Thymeleaf, and Spring Data JPA) with a complete set of JUnit 5 tests (unit with Mockito, integration with Spring, and end-to-end tests with Selenium).

About

Mastering JUnit 5 (Copyright © 2017-2024) is a project created and maintained by Boni Garcia and licensed under the terms of the Apache 2.0 License.

Extension points exported contracts — how you extend this code

TimeExecutionLogger (Interface)
(no doc) [1 implementers]
junit5-test-interfaces/src/main/java/io/github/bonigarcia/TimeExecutionLogger.java
NonFunctionalTests (Interface)
(no doc)
junit4/src/test/java/io/github/bonigarcia/NonFunctionalTests.java
RemoteFileApi (Interface)
(no doc)
junit5-wiremock/src/main/java/io/github/bonigarcia/RemoteFileApi.java
TestLifecycleLogger (Interface)
(no doc) [1 implementers]
junit5-test-interfaces/src/main/java/io/github/bonigarcia/TestLifecycleLogger.java
FunctionalTests (Interface)
(no doc)
junit4/src/test/java/io/github/bonigarcia/FunctionalTests.java

Core symbols most depended-on inside this repo

login
called by 30
junit4-mockito/src/main/java/io/github/bonigarcia/LoginService.java
login
called by 29
junit5-mockito/src/main/java/io/github/bonigarcia/LoginService.java
push
called by 6
junit4-cucumber/src/main/java/io/github/bonigarcia/Calculator.java
push
called by 6
junit5-cucumber/src/main/java/io/github/bonigarcia/Calculator.java
getName
called by 5
junit5-assertions/src/main/java/io/github/bonigarcia/MySUT.java
getTitle
called by 4
junit4-cucumber/src/main/java/io/github/bonigarcia/Book.java
getUsername
called by 4
junit4-mockito/src/main/java/io/github/bonigarcia/UserForm.java
getPage
called by 4
junit5-spring-boot-web/src/main/java/io/github/bonigarcia/PageService.java

Shape

Method 467
Class 196
Interface 6

Languages

Java100%

Modules by API surface

junit4/src/test/java/io/github/bonigarcia/TestRuleChain.java11 symbols
junit5-parameterized/src/test/java/io/github/bonigarcia/MethodSourceObjectsParameterizedTest.java10 symbols
junit5-nested-tests/src/test/java/io/github/bonigarcia/StackTest.java10 symbols
junit5-disabled-tests/src/test/java/io/github/bonigarcia/DisabledOnJreRangeTest.java10 symbols
junit5-disabled-tests/src/main/java/io/github/bonigarcia/MySUT.java9 symbols
junit5-basic-tests/src/main/java/io/github/bonigarcia/MySUT.java9 symbols
junit5-assertions/src/main/java/io/github/bonigarcia/MySUT.java9 symbols
junit4/src/test/java/io/github/bonigarcia/TestRuleExternalResource.java9 symbols
junit5-test-templates/src/test/java/io/github/bonigarcia/MyTestTemplateInvocationContextProvider.java8 symbols
junit5-spring-boot-rest/src/main/java/io/github/bonigarcia/Book.java8 symbols
junit5-nested-tests/src/test/java/io/github/bonigarcia/NestTest.java8 symbols
junit5-disabled-tests/src/test/java/io/github/bonigarcia/DisabledIfTest.java8 symbols

Datastores touched

(mysql)Database · 1 repos
testdbDatabase · 1 repos

For agents

$ claude mcp add mastering-junit5 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact