# fmendozaro/junit-tests architecture

> Architecture diagram of the GitHub repository fmendozaro/junit-tests, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fmendozaro/junit-tests
- Repository: https://github.com/fmendozaro/junit-tests

## Overview

##### Project Type and Purpose
- This is a library/tutorial repository (Java Maven project) focused on practicing Test-Driven Development (TDD) for two domain classes (`Student` and `Cohort`) using JUnit.
- It is not a multi-tier web application or microservices suite; it’s a single codebase with a production source package and a test package, plus a CI pipeline.

##### File Structure
- Top-level files:
- `pom.xml` — Maven build descriptor, defines dependencies (JUnit, etc.) and build lifecycle.
- `azure-pipelines.yml` — CI pipeline definition for Azure DevOps that runs build and tests.
- `README.md` — documentation and exercise instructions.
- `.gitignore`
- Standard Maven conventions:
- `src/main/java` — domain classes (`Student.java`, `Cohort.java`).
- `src/test/java` — test classes (`StudentTest.java`, `CohortTest.java`).

##### Extract Insights from README
- TDD cycle: tests written first (`StudentTest`, `CohortTest`); then implement `Student` and `Cohort`.
- Exercise flow: clone repo → write tests → implement code → commit → CI builds/tests.

##### Main Components
a. Developer Workstation
- Git client (clones/forks)
- IDE (IntelliJ or CLI)
b. Source Code Repository (GitHub)
- Branches: `main`, `students-tests`, `cohorts-tests`, `cohorts-feature`
c. Maven Build System
- `pom.xml` orchestrates compile, test, package phases
- Dependencies: JUnit
d. Code Modules
- Domain Package (`Student`, `Cohort`)
- Test Package (`StudentTest`, `CohortTest`)
e. Continuous Integration (Azure Pipelines)
- Trigger: push to GitHub
- Steps: checkout, `mvn test`, report results

##### Relationships and Data Flow
- Developer → GitHub: push commits/branches
- GitHub → Azure Pipelines: webhook triggers CI
- Azure Pipelines steps:
1. Pull code
2. Invoke `mvn test`
3. Run JUnit tests against domain classes
4. Report success/failure
- Maven: compiles `src/main/java` first, then runs tests in `src/test/java`
- JUnit: test framework invoked by Maven Surefire plugin

##### Architectural Patterns / Design Principles
- Layered design:
- Domain layer (production code)
- Test layer (unit tests)
- TDD practice: tests define behavior and drive implementation
- CI/CD pipeline enforces quality gates

##### Technologies / Frameworks
- Java 8+
- Maven (pom.xml)
- JUnit (testing)
- Azure DevOps Pipelines

- Clearly labeled components: Developer, GitHub Repo, Maven (pom.xml), Domain Package, Test Package, Azure Pipelines.
- Domain (blue)
- Tests (green)
- CI (orange)

## Diagram (Mermaid)

```mermaid
flowchart TB
    Developer["Developer\n(Git Client & IDE)"]:::external
    GitHubRepo[(GitHub Repository)]:::external
    CI["Azure Pipelines"]:::ci
    Maven["Maven Build System\n(pom.xml)"]:::build
    subgraph "Project Configuration"
        Documentation["README.md"]:::config
        GitIgnore[".gitignore"]:::config
    end
    subgraph "Source Code"
        Domain["Domain Package\n(Student.java, Cohort.java)"]:::domain
        Test["Test Package\n(StudentTest.java, CohortTest.java)"]:::test
    end
    Legend["Legend:\nBlue=Domain\nGreen=Tests\nOrange=CI\nYellow=Build System\nGray=External/Config"]:::legend

    Developer -->|push commits/branches| GitHubRepo
    GitHubRepo -->|webhook trigger| CI
    CI -->|checkout code| GitHubRepo
    CI -->|executes build & tests| Maven
    Maven -->|compile phase| Domain
    Maven -->|test phase| Test
    Test -->|TDD cycle| Domain
    Domain -->|drive via tests| Test
    Maven -->|reads| Documentation
    Maven -->|reads| GitIgnore

    click Maven "https://github.com/fmendozaro/junit-tests/blob/master/pom.xml"
    click CI "https://github.com/fmendozaro/junit-tests/blob/master/azure-pipelines.yml"
    click Documentation "https://github.com/fmendozaro/junit-tests/blob/master/README.md"
    click GitIgnore "https://github.com/fmendozaro/junit-tests/blob/master/.gitignore"

    classDef domain fill:#ADD8E6,stroke:#333
    classDef test fill:#90EE90,stroke:#333
    classDef ci fill:#FFD580,stroke:#333
    classDef build fill:#FFF2CC,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333
    classDef config fill:#F0F0F0,stroke:#333
    classDef legend fill:#EEEEEE,stroke:#000,stroke-dasharray: 2 2
```
