This is my second backend project using Java, focused on deepening core concepts like TDD (Test-Driven Development),
Generics, and Unit Testing with a structured and modular approach.
It follows the same CRUD foundation as the first project, but this time with a strong emphasis on writing tests first and applying best development practices.
🔗 Want to have a look at the first project? Check out Project 1 - Java CRUD Example, it’s the starting point of my Java journey.
- Application of the TDD methodology: tests are created before implementation;
- Usage of
Genericsfor both DAO and Service layers to reduce code repetition; - Custom domain models like
ClientandProductimplementing aPersistableinterface; GenericMapDAOandGenericServicefor reusable CRUD operations across entities;- Unit tests using JUnit 5, structured for DAO and Service layers with mock implementations for isolation;
- Dependency injection used to wire DAOs into services in the test setup;
- Detailed Javadoc comments across classes and test files;
br.com.eaugusto.domain: Domain models likeClientandProduct, and thePersistableinterface;br.com.eaugusto.dao: DAO interfaces and implementations, includingClientDAOandProductDAO;br.com.eaugusto.dao.generics: Generic DAO interfaces and base implementations usingMapstorage;br.com.eaugusto.services: Service interfaces and classes, such asClientServiceandProductService;br.com.eaugusto.services.generics: Generic service interfaces and implementations using the generic DAO layer;br.com.eaugusto(test): Contains test classes for DAO and service layers using mock implementations and dependency injection;
- Follows the test-first approach with JUnit 5;
- Includes coverage for CRUD operations on both service and DAO layers;
- Mock classes like
ClientDAOMockandProductDAOMocksimulate data access for isolated tests; - Each test class includes setup logic, method verification, and meaningful assertions;
- Coverage tools like EclEmma are being used for visual feedback during development.
- Added Javadoc to
ProductServiceTestfor clarity and documentation; - Completed
ProductServiceand its test class, following the TDD pattern; - Updated
Productto use a default constructor and setter-based initialization in tests.
- Created
Productentity and DAO with full test coverage usingProductDAOMockandProductDAOTest; - Applied generic DAO structure to both
ClientandProductworkflows.
- Implemented
deleteandmodifyactions in DAO and service layers with respective tests.
- Initial project setup with domain models, DAO, and service layers for
Client; - Set up TDD structure and created first unit tests.
- Practice TDD effectively in a real-world-style CRUD application;
- Use generics to build flexible, reusable service and DAO layers;
- Write clean, modular tests that simulate business logic and edge cases;
- Understand the integration of Swing (coming soon) into backend-driven Java apps.