# shaunthomas999/junit5-samples architecture

> Architecture diagram of the GitHub repository shaunthomas999/junit5-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaunthomas999/junit5-samples
- Repository: https://github.com/shaunthomas999/junit5-samples

## Overview

This repository contains two Java sample areas: small JUnit demonstration targets and a Spring Boot product-lookup API. The API workflow is an HTTP request to search by product name, service delegation to a repository, and a product response or mapped error. The JUnit module’s production examples are a calculator and palindrome checker; its test filenames indicate demonstrations of JUnit 5 features and JUnit 4 comparison. Those test sources were not sampled, so their detailed invocation wiring is not shown.

Main entry points: [`spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/ProductsEndpoint.java`](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/ProductsEndpoint.java) (Products endpoint), [`spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/repository/ProductsRepository.java`](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/repository/ProductsRepository.java) (Products repository), [`spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/GlobalExceptionHandler.java`](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/GlobalExceptionHandler.java) (Exception handler), [`spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/services/ProductsService.java`](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/services/ProductsService.java) (Products service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_junit["JUnit samples"]
  node_calculator["Calculator<br/>[Calculator.java]"]
  node_palindrome["Palindrome checker<br/>[Palindrome.java]"]
  node_calculator4tests["JUnit 4 comparison"]
  node_calculator5tests["JUnit 5 comparison"]
  node_palassertions["Assertions"]
  node_palassumptions["Assumptions"]
  node_paldynamic["Dynamic tests"]
  node_palnested["Nested tests"]
  node_palparameterized["Parameterized tests"]
  node_palrepeated["Repeated tests"]
  node_paldetails["Names and tags"]
  node_palannotation["Custom annotation"]
  node_palsuite["Unit test suite"]
end

subgraph group_api["Product API"]
  node_app["Spring Boot app"]
  node_endpoint["Products endpoint"]
  node_service["Products service"]
  node_repository[("Products repository")]
  node_product["Product entity<br/>[Product.java]"]
  node_exceptionhandler["Exception handler"]
  node_errordetails["Error details<br/>[ErrorDetails.java]"]
  node_notfound["Not-found exception"]
end

node_caller(("API client"))
node_database[("Relational database")]

node_caller -->|"requests products"| node_endpoint
node_app -->|"serves routes"| node_endpoint
node_endpoint -->|"searches by name"| node_service
node_service -->|"queries name"| node_repository
node_repository -->|"maps entity"| node_product
node_repository -->|"reads product"| node_database
node_endpoint -->|"throws if absent"| node_notfound
node_exceptionhandler -->|"handles"| node_notfound
node_exceptionhandler -->|"builds response"| node_errordetails

click node_calculator "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/main/java/com/shaunthomas999/junit5/comparison/Calculator.java"
click node_palindrome "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/main/java/com/shaunthomas999/junit5/features/Palindrome.java"
click node_calculator4tests "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit4Test.java"
click node_calculator5tests "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit5Test.java"
click node_palassertions "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssertionsTest.java"
click node_palassumptions "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssumptionsTest.java"
click node_paldynamic "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDynamicTest.java"
click node_palnested "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeNestedTest.java"
click node_palparameterized "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeParameterizedTest.java"
click node_palrepeated "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeRepeatedTest.java"
click node_paldetails "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDisplayNamesAndTagsTest.java"
click node_palannotation "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeTestAnnotation.java"
click node_palsuite "https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeUnitTestSuite.java"
click node_app "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/SpringBootMockitoJunit5App.java"
click node_endpoint "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/ProductsEndpoint.java"
click node_service "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/services/ProductsService.java"
click node_repository "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/repository/ProductsRepository.java"
click node_product "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/model/Product.java"
click node_exceptionhandler "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/GlobalExceptionHandler.java"
click node_errordetails "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ErrorDetails.java"
click node_notfound "https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ResourceNotFoundException.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_calculator,node_palindrome,node_calculator4tests,node_calculator5tests,node_palassertions,node_palassumptions,node_paldynamic,node_palnested,node_palparameterized,node_palrepeated,node_paldetails,node_palannotation,node_palsuite,node_caller toneBlue
class node_app,node_endpoint,node_service,node_repository,node_product,node_exceptionhandler,node_errordetails,node_notfound,node_database toneAmber
```

## Components

### JUnit samples

- [Calculator](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/main/java/com/shaunthomas999/junit5/comparison/Calculator.java): `junit5-features/src/main/java/com/shaunthomas999/junit5/comparison/Calculator.java`
- [Palindrome checker](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/main/java/com/shaunthomas999/junit5/features/Palindrome.java): `junit5-features/src/main/java/com/shaunthomas999/junit5/features/Palindrome.java`
- [JUnit 4 comparison](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit4Test.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit4Test.java`
- [JUnit 5 comparison](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit5Test.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/comparison/CalculatorJunit5Test.java`
- [Assertions](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssertionsTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssertionsTest.java`
- [Assumptions](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssumptionsTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeAssumptionsTest.java`
- [Dynamic tests](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDynamicTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDynamicTest.java`
- [Nested tests](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeNestedTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeNestedTest.java`
- [Parameterized tests](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeParameterizedTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeParameterizedTest.java`
- [Repeated tests](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeRepeatedTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeRepeatedTest.java`
- [Names and tags](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDisplayNamesAndTagsTest.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeDisplayNamesAndTagsTest.java`
- [Custom annotation](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeTestAnnotation.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeTestAnnotation.java`
- [Unit test suite](https://github.com/shaunthomas999/junit5-samples/blob/master/junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeUnitTestSuite.java): `junit5-features/src/test/java/com/shaunthomas999/junit5/features/PalindromeUnitTestSuite.java`

### Product API

- [Spring Boot app](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/SpringBootMockitoJunit5App.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/SpringBootMockitoJunit5App.java`
- [Products endpoint](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/ProductsEndpoint.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/ProductsEndpoint.java`
- [Products service](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/services/ProductsService.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/services/ProductsService.java`
- [Products repository](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/repository/ProductsRepository.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/repository/ProductsRepository.java`
- [Product entity](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/model/Product.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/model/Product.java`
- [Exception handler](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/GlobalExceptionHandler.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/GlobalExceptionHandler.java`
- [Error details](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ErrorDetails.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ErrorDetails.java`
- [Not-found exception](https://github.com/shaunthomas999/junit5-samples/blob/master/spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ResourceNotFoundException.java): `spring-boot-mockito-junit5/src/main/java/com/shaunthomas999/products/endpoints/exceptions/ResourceNotFoundException.java`

### Other components

- **API client**
- **Relational database**

## Connections

- API client → Products endpoint: requests products
- Spring Boot app → Products endpoint: serves routes
- Products endpoint → Products service: searches by name
- Products service → Products repository: queries name
- Products repository → Product entity: maps entity
- Products repository → Relational database: reads product
- Products endpoint → Not-found exception: throws if absent
- Exception handler → Not-found exception: handles
- Exception handler → Error details: builds response
