How fmendozaro/junit-tests works
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)