Skip to content

Latest commit

Β 

History

History
96 lines (71 loc) Β· 3.25 KB

File metadata and controls

96 lines (71 loc) Β· 3.25 KB

Java 8+ Practice Project

A hands-on learning project exploring Java 8+ features through practical, real-world examples.
Topics covered: Optional, Function (Functional Interface), JUnit 5 tagging, and CI/CD basics.


πŸ“š What Is This Project?

See docs/WHAT_IS_IT.md for a full overview of the project goals and structure.


πŸ“‚ Project Structure

src/
β”œβ”€β”€ main/java/
β”‚   β”œβ”€β”€ functionalInterface/function/myimpl/   ← Function<T,R> interface demo
β”‚   β”œβ”€β”€ optionaldemoone/                        ← Optional with real-world domain objects
β”‚   └── jenkins/                               ← CI/CD placeholder
└── test/java/
    β”œβ”€β”€ junitdemo/                              ← JUnit 5 Tags & Display Names
    β”œβ”€β”€ optionaldemoone/                        ← Tests for DiscountService
    └── optionaldemoWithPerson/                 ← Optional stream scenarios

πŸ—‚οΈ Learning Guides

Guide Description
docs/WHAT_IS_IT.md Project overview and learning goals
docs/optional-guide.md Deep dive into Java Optional
docs/advanced-optional-scenarios-explained.md Advanced Optional patterns explained in depth
docs/functional-interface-function-guide.md Function<T,R>, andThen, compose
docs/junit5-tagging-guide.md JUnit 5 @Tag, @DisplayName, selective test runs
docs/java21-modern-java-guide.md Java 21 features used in this project
docs/github-actions-guide.md GitHub Actions explained for beginners
docs/github-actions-advanced-guide.md Advanced GitHub Actions β€” concurrency, secrets, matrix, artifacts, reusable workflows

πŸš€ Running the Project

Prerequisites

  • Java 21+
  • Maven 3.6+

Run All Tests (locally)

mvn test

Run Tests by Tag (locally)

# Run integration tests only
mvn test -Dgroups="integration"

# Run unit tests only
mvn test -Dgroups="ecomm-unit-tests"

# Run sanity tests only
mvn test -Dgroups="ecomm-sanity"

# Run Optional demo tests
mvn test -Dgroups="Rel1"

Pass Custom System Properties

mvn test -DinParameter=MyValue

πŸ€– Run via GitHub Actions (CI/CD)

Workflow Trigger What it runs
CI β€” Build & Test All Auto on every push & PR All tests
Ecommerce β€” Unit Tests Manual (Actions tab) @Tag("ecomm-unit-tests")
Ecommerce β€” Sanity Tests Manual (Actions tab) @Tag("ecomm-sanity")
Run Tests by Tag Manual with input Any tag you specify

πŸ“– New to GitHub Actions? See docs/github-actions-guide.md for a full walkthrough.


πŸ› οΈ Tech Stack

Technology Version Purpose
Java 21 (LTS) Language β€” enables records, switch expressions, var, .toList(), text blocks, and more
Maven 3.6+ Build tool
JUnit Jupiter 5.10.2 Unit testing framework
AssertJ 3.19.0 Fluent assertions