Skip to content

Latest commit

 

History

History
53 lines (53 loc) · 3.48 KB

File metadata and controls

53 lines (53 loc) · 3.48 KB

Study Of Java Unit Tests

Repository focused on the study and practice of Java unit testing using the JUnit 5 framework.
Includes practical examples of assertions, layered architecture with services and DAOs, and integration with code coverage tools like EclEmma. Made using Spring Tools Suite 4.

🔍 Covered Concepts

  • Project structure for unit testing (src/main/java and src/test/java);
  • Basic unit tests using assertEquals and assertNotEquals;
  • Tests for business logic through service and DAO abstraction layers;
  • Use of Mock implementations to simulate success and failure scenarios;
  • Filtering logic validation through unit tests (FilterByGenderTest);
  • Code coverage analysis using EclEmma plugin (Eclipse);
  • Javadoc and inline comments included for clarity.

🗂️ Project Structure

  • br.com.eaugusto: Contains ClientTest and its unit test TestClientTest;
  • br.com.eaugusto.coursetask: Contains Person, FilterByGender, and related tests;
  • br.com.eaugusto.mocks.dao / service: DAO and service layer interfaces and mock implementations for Client testing;
  • br.com.eaugusto.mockstests.service: Unit tests for client service behavior (success/failure);
  • br.com.eaugusto.contract.dao / service: Interface definitions and mock/realistic DAO implementations for Contract logic;
  • br.com.eaugusto.contracttests: Contains ContractServiceTest, testing all contract-related functionality.

🚀 How to Run

  1. Clone this repository;
  2. Import into an IDE that supports JUnit 5 (e.g., Eclipse with EclEmma, IntelliJ);
  3. Run test classes (e.g., FirstTest, TestClientTest, ClientServiceTest, ContractServiceTest);
  4. Use EclEmma to verify test coverage and validate implementation.

📅 Commit Highlights

June 20, 2025

  • Added search, delete, and edit methods to ContractService, with full unit test coverage.
  • Created service and DAO layers for Contract, including mock and exception-based implementations.
  • Developed ClientService and corresponding unit tests with dependency injection and mock DAO use.

June 19, 2025

  • Added FilterByGenderTest to check gender-based filtering accuracy;
  • Created FilterByGender and Person in the coursetask package with parsing logic;
  • Implemented ClientTest and TestClientTest with basic structure and coverage;
  • Initialized the project with FirstTest and integrated JUnit 5 and EclEmma.

📚 Learning Goals

  • Understand and structure Java projects with unit testing and test source folders;
  • Learn to write assertions using JUnit 5 and analyze code behavior through testing;
  • Practice service and DAO patterns with mock implementations and exception handling;
  • Use test coverage tools to ensure testing effectiveness and code reliability.