<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Samuel Brodeur</title>
  <subtitle>I'm Samuel Brodeur, a backend developer who spends most days working on JAVA projects using Spring. This is where I write up what I learn — JAVA, Spring, Tests and other amazing features.</subtitle>
  <link rel="self" type="application/atom+xml" href="https://sambrodeur.dev/feed.xml"/>
  <link rel="alternate" type="text/html" href="https://sambrodeur.dev/"/>
  <id>https://sambrodeur.dev/</id>
  <updated>2026-10-21T00:00:00Z</updated>
  <author><name>Samuel Brodeur</name></author>
  <entry>
    <title>Why use Quartz Scheduler in a Spring Boot app</title>
    <link rel="alternate" type="text/html" href="https://sambrodeur.dev/posts/quartz-scheduler-spring-boot"/>
    <id>https://sambrodeur.dev/posts/quartz-scheduler-spring-boot</id>
    <published>2026-10-21T00:00:00Z</published>
    <updated>2026-10-21T00:00:00Z</updated>
    <category term="Spring Boot"/>
    <summary>When scheduling stops being static: why Quartz is worth the initial effort in a Spring Boot application, how it differs from Spring Batch, and where I use it.</summary>
    <content type="html">&lt;h2 class=&quot;post-page-heading&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Quartz Scheduler is a scheduling engine that runs tasks at specific times or according to a defined frequency. In a Spring Boot environment, its integration makes it easier to configure tasks and their triggers while taking advantage of dependency injection and the conventions of the Spring ecosystem.&lt;/p&gt;
&lt;p&gt;Quartz supports schedules based on intervals or cron expressions, as well as requirements such as persistence, recovery after a shutdown, and execution in a distributed environment. It is therefore a suitable solution when an application needs to schedule and orchestrate processing reliably.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Why Choose Quartz?&lt;/h2&gt;
&lt;p&gt;In our case, Quartz is valuable mainly because it provides a scheduling mechanism that remains reliable as the application evolves. We can start with a few simple tasks, then add more complex schedules, adjust a schedule without redeploying the application, or persist triggers in a database. If the application restarts or runs across multiple instances, Quartz also prevents us from having to rebuild all the recovery and coordination logic ourselves.&lt;/p&gt;
&lt;p&gt;Quartz therefore becomes a good choice when schedules are no longer entirely static, executions must survive a restart, or several application instances may process the same tasks. For a few simple recurring tasks, the “Schedule” annotation remains more direct and requires less configuration. The goal is not to use Quartz everywhere, but to choose it when scheduling becomes an important part of how the application operates.&lt;/p&gt;
&lt;p&gt;We also want to be able to start a job without waiting for its next scheduled run. For this need, an Actuator endpoint can receive the job identifier and ask Quartz to execute it immediately. This gives us a consistent way to administer the application while clearly controlling which jobs may be triggered manually. Because this action actually starts the job processing, the Actuator endpoint must be secured.&lt;/p&gt;
&lt;p&gt;This approach integrates well with an orchestrator such as Control-M. It can call the Actuator endpoint to start a job at the right time within a broader processing chain. Control-M retains the overall view—dependencies between systems, execution windows, recovery, and monitoring—while Quartz remains responsible for execution within the Spring Boot application. To make the integration reliable, the call should return an execution identifier and a clear status, prevent duplicate starts when necessary, and be protected by appropriate authentication.&lt;/p&gt;
&lt;p&gt;An asynchronous application can also benefit from Quartz when work should not be performed immediately within the request that initiated it. The application can record the request, schedule it for later and quickly return a response to the caller. Quartz then triggers the processing in the background, for example after a delay, at a specific date and time, or on a recurring basis. It can also retry a failed operation, group processing during a less busy period, or distribute triggers across multiple instances. The Quartz job should remain short and delegate the work to an asynchronous service or a message queue when processing is lengthy, thereby separating scheduling from the actual execution.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Quartz Scheduler VS Spring Batch&lt;/h2&gt;
&lt;p&gt;Quartz Scheduler and Spring Batch address two different needs. Quartz is mainly responsible for determining when and under what conditions processing should start. Spring Batch, on the other hand, provides a structure for running batch processing made up of steps, including reading, transforming, and writing data, as well as monitoring and restarting executions. In other words, Quartz schedules and triggers, while Spring Batch organizes the work to be performed.&lt;/p&gt;
&lt;p&gt;This difference does not make them incompatible. Quartz can trigger a Spring Batch job according to a schedule, a cron expression, or an external request, after which Spring Batch manages the various processing steps and their state. This combination is useful when data processing needs the restart and monitoring mechanisms of Spring Batch together with the more flexible and persistent scheduling offered by Quartz.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Quartz Scheduler + Spring Boot&lt;/h2&gt;
&lt;p&gt;Spring Boot provides a solid foundation for integrating Quartz: it simplifies scheduler initialization, centralizes part of the configuration, and allows jobs to use application services through dependency injection. However, this integration does not mean Quartz works without effort. We still need to define the jobs, create their triggers, organize their registration, and decide how errors, restarts, and concurrent executions will be handled.&lt;/p&gt;
&lt;p&gt;In memory mode, the setup is lighter, but the job and trigger structure still needs to be clearly defined in code. In database mode, the Quartz tables must also be prepared, the data source configured, and the behaviour during restarts or when several application instances are active must be validated. In both cases, a certain amount of code and configuration remains necessary to achieve reliable and maintainable operation.&lt;/p&gt;
&lt;p&gt;This initial effort becomes highly beneficial over the long term. Once the structure is in place, new schedules are easier to add, executions are better controlled, and the application can evolve toward more advanced requirements without replacing its scheduling mechanism. We therefore gain visibility, robustness, and flexibility, especially as the number of jobs increases or their execution becomes critical to the organization.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;My Usage Preferences&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;1) For a process based on state or status changes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I like to use Quartz when a process requested through an API may take several seconds or even several minutes. Instead of blocking the consumer until processing is complete, the application can record the request with an initial status, immediately return a response, and then delegate execution to a Quartz job. The status then changes as processing progresses until completion. This approach keeps the API responsive while providing a simple way to track progress. For some needs, it is also a good alternative to a message queue: an MQ remains better suited to highly distributed architectures or very large volumes, but Quartz can cover several scenarios without adding extra infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2) For use with Spring Batch when no orchestrator is available&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Quartz can trigger processing according to a schedule, a cron expression, or an external request, while Spring Batch manages the steps, state, and restart of the execution. This combination provides centralized scheduling, controlled executions, and better monitoring without immediately requiring an external orchestration tool.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3) For data purge processes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Quartz can automate the deletions required to control data growth and comply with retention rules. By scheduling these purges during less busy periods, we can reduce their impact on users and application performance. Jobs can also be monitored, triggered manually when needed, and adjusted as retention rules evolve, making it easier to preserve relevant data and maintain a reasonably sized database.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Quartz Scheduler is therefore a worthwhile investment when scheduling becomes an important part of the application. Integrating it with Spring Boot requires an initial configuration effort, but in the long run it provides greater reliability, flexibility, and control over executions. Whether used on its own, with Spring Batch, or as part of an asynchronous process, Quartz can address a range of needs while allowing the solution to evolve as the context becomes more complex.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Unit and Integration Tests - A new approach for developers</title>
    <link rel="alternate" type="text/html" href="https://sambrodeur.dev/posts/automated-tests"/>
    <id>https://sambrodeur.dev/posts/automated-tests</id>
    <published>2026-10-02T00:00:00Z</published>
    <updated>2026-10-02T00:00:00Z</updated>
    <category term="Java Tests"/>
    <summary>A pragmatic, field-tested structure for unit, integration, and acceptance tests in Java — and why the role of QA needs to evolve alongside it.</summary>
    <content type="html">&lt;h2 class=&quot;post-page-heading&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In modern development environments, the increasing complexity of applications requires a robust and automated testing strategy. Automated tests in Java are a key enabler to ensure software quality, reliability, and scalability, while supporting fast and continuous delivery cycles.&lt;/p&gt;
&lt;p&gt;What follows highlights unit tests and integration tests in Java, which respectively validate isolated component behavior and interactions within the system. These tests form the foundation of any effective technical validation strategy. Although the content is based on Java, the concepts presented can be applied to most other programming languages.&lt;/p&gt;
&lt;p&gt;Beyond these traditional approaches, modern solutions increasingly rely on distributed and microservice oriented architectures. In this context, end to end tests play a key role by validating complete functional scenarios across multiple services, databases, and external dependencies. They ensure that the system behaves correctly under production like conditions.&lt;/p&gt;
&lt;p&gt;The following presents an alternative approach designed to optimize the interaction between unit, integration, and end‑to‑end tests. Although less common, this approach aims to improve overall test consistency, reduce redundancy, and better meet the requirements of complex, modern architectures.&lt;/p&gt;
&lt;p&gt;The idea behind this approach originated more than fifteen years ago. Over time, the model has evolved: the technique and methodology have been refined, but the core concept remains the same — delivering well tested software with as few defects as possible.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Automated Testing Context&lt;/h2&gt;
&lt;p&gt;Historically, unit tests are often implemented using a black box approach, where a single test class contained all possible cases for a given class or component. While functional at a small scale, this approach had several limitations. As scenarios multiplied within a single class, tests became difficult to read, maintain, and evolve. Test data management also quickly became problematic, leading to duplicated data, implicit dependencies between tests, unclear expected system states, and a higher risk of unstable or interdependent tests.&lt;/p&gt;
&lt;p&gt;Over time, this approach revealed its weaknesses, particularly in larger and constantly evolving codebases. Teams ended up with tests that were costly to maintain and sometimes more restrictive than beneficial, limiting long term adoption.&lt;/p&gt;
&lt;p&gt;On the integration testing side, the evolution of software architectures led to the emergence of many tools now popular on the market. These solutions allow teams to simulate or orchestrate databases, external services, message queues, and third party APIs. While powerful, these tools often require heavy setup, complex configuration, and increased infrastructure dependency. For development and QA teams, this represents a significant investment in time, expertise, and maintenance.&lt;/p&gt;
&lt;p&gt;Another key contextual factor is QA resource availability. In the absence of a dedicated QA team, developers are forced to wear a dual hat: developer and tester. This role shift requires a mindset change that is not always natural. Moving from a development mindset to one focused on validation, challenging the results, and defect detection can be difficult, especially under delivery pressure.&lt;/p&gt;
&lt;p&gt;On the other hand, when QA resources are present, they are not always comfortable with the diversity and complexity of technical solutions used for integration testing. The proliferation of tools, frameworks, and configurations can create a technical barrier, limit QA autonomy and increasing dependency on developers. Another observed reality is that, in many contexts, QA resources do not necessarily have the technical skills required to fully take ownership of automated unit and integration tests.&lt;/p&gt;
&lt;p&gt;These observations highlight a recurring challenge: the need for a testing approach that is more accessible, better integrated with development practices, and still effective in complex environments.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;New Solution&lt;/h2&gt;
&lt;p&gt;The implementation of this new solution addresses several recurring issues faced by modern development teams. One of the main challenges is the rotation of QA personnel, or in some cases, the complete absence of dedicated QA resources. This situation leads to increased dependency on individual knowledge, loss of continuity, and higher risk during release validation phases.&lt;/p&gt;
&lt;p&gt;In addition, manual and functional testing often represents a significant investment in time and effort. Test cycles frequently span two to three weeks, delaying production releases and limiting the team's ability to deliver new features quickly. These delays are difficult to reconcile with modern expectations around agility and responsiveness.&lt;/p&gt;
&lt;p&gt;In this context, it becomes essential to move closer to a continuous delivery model without compromising product quality. The objective is to avoid turning end users into involuntary testers, a situation that can negatively impact system stability, user experience, and solution credibility.&lt;/p&gt;
&lt;p&gt;The proposed solution therefore aims to automate a significant portion of functional and technical validation, reducing dependency on manual tests, securing deployments, and enabling more frequent releases while maintaining a high level of quality.&lt;/p&gt;
&lt;p&gt;For those who have already implemented unit and integration tests, the following content is not meant to challenge fundamental principles, but rather to present a technique and way of working rooted in real world experience. The goal is not to explain what tests are, but to share a practical approach that simplifies implementation, improves maintainability, maximizes value in real and complex environments, and aligns with developers' strengths so they can be more directly involved in software quality.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Unit Tests&lt;/h2&gt;
&lt;p&gt;The concept of unit testing is generally well known: validating the behavior of a portion of code in isolation, most often a class or a public method. This approach enables rapid defect detection, secures changes, and promotes more robust software design.&lt;/p&gt;
&lt;p&gt;The new approach presented is based on a slightly different vision from traditional practices. It focuses on code coverage, with particular emphasis on fully testing utility classes. These classes are often used across the system and represent a critical point where exhaustive coverage can significantly reduce large scale regression risks.&lt;/p&gt;
&lt;p&gt;In this context, the use of mocks is a key element. External dependencies such as databases, remote services, or other components are simulated to ensure that tests focus exclusively on the internal logic of the unit under test. This isolation makes tests faster, more reliable, and easier to execute frequently.&lt;/p&gt;
&lt;p&gt;With this approach, each test class is structured around a single public method of the target class. This promotes clear readability of test scenarios and better alignment with real world usage of the code.&lt;/p&gt;
&lt;p&gt;Additionally, test data management is standardized through a common structure. For each tested class, an abstract test class is created using the name of the main class followed by Test. This abstract class is used for data preparation. Every test class containing unit tests must extend this abstract class. This ensures that each test class can reuse a common dataset while keeping it relatively small for easier test maintenance. Test classes focus exclusively on method specific scenarios, improving readability, reducing duplication, and facilitating long term maintainability.&lt;/p&gt;
&lt;p&gt;Finally, this approach also defines the scope of validations performed by unit tests. In general, unit tests do not aim to validate the full return object; they focus instead on verifying that a result is returned and that the expected behavior occurs. This deliberate limitation keeps unit tests simple, fast, and stable, while ensuring that the validations with the highest functional and behavioral value are performed at the integration test level.&lt;/p&gt;
&lt;p&gt;An exception applies to utility classes, whose logic is often pure and deterministic. In this specific case, the full content of the returned object can and should be validated to guarantee complete result accuracy. This distinction maintains a balance between unit test efficiency and coverage relevance, while avoiding unnecessary duplication of the same tests and validations at the integration test level.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Integration Tests&lt;/h2&gt;
&lt;p&gt;Integration tests represent the validation level where the goal is to confirm that system components work correctly together in an environment as close as possible to real application execution. Unlike unit tests, the objective is no longer to isolate a single unit of code, but to validate complete logic and component interactions.&lt;/p&gt;
&lt;p&gt;This approach maintains a structure like unit tests, particularly in how test code is organized. The same abstract test class concept is used to centralize dataset management and shared configuration. For each tested class, an abstract class named according to the pattern “ClassNameIntegrationTest” is responsible for preparing the environment required to execute integration tests.&lt;/p&gt;
&lt;p&gt;Each public method of the target class has its own dedicated test class, which must extend the abstract class. This organization ensures consistency across tests while improving readability, maintenance, and evolution of integration scenarios.&lt;/p&gt;
&lt;p&gt;A fundamental difference from unit tests is that mocks are no longer used. Integration tests run against real implementations, whether services, internal components, or persistence layers. This lack of simulation allows real system behavior to be validated and issues to be detected that unit tests cannot reveal.&lt;/p&gt;
&lt;p&gt;Another important difference lies in layer responsibility is that integration tests aim to validate the complete target layer without reproducing all tests already performed on underlying components. Each layer is responsible for covering its own important and critical cases, while consumed components are considered validated at their respective test levels.&lt;/p&gt;
&lt;p&gt;When one component depends on another, integration tests primarily focus on happy paths, while covering a limited number of representative failure scenarios to validate overall behavior and system reactions. The goal is not to redo all internal validations of the consumed component, but to ensure that integration between layers functions correctly. This approach avoids unnecessary duplication, reduces scenario complexity, and focuses validation efforts where they provide the most value.&lt;/p&gt;
&lt;p&gt;Each integration test therefore validates the complete processing chain, from test entry point to the result, without artificial interruption. This ensures that business logic, interactions, and data flows function correctly as a whole, while avoiding duplication of validations already covered by unit tests.&lt;/p&gt;
&lt;p&gt;Integration tests thus become the level where high value validations are concentrated, directly complementing unit tests and serving as a key step toward functional and end to end testing.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Acceptance Testing of the Ecosystem&lt;/h2&gt;
&lt;p&gt;In a modern solution, a system is typically composed of multiple distinct components, such as user interfaces as well as multiple internal or external APIs. Each component has its own responsibilities, logic, and business rules.&lt;/p&gt;
&lt;p&gt;The purpose of acceptance testing is not to redo integration tests at the level of the complete solution, nor to deeply validate the internal behavior of each component. These validations should already be covered by unit tests and integration tests specific to each component. Acceptance tests operate at a more global and functional level.&lt;/p&gt;
&lt;p&gt;In this approach, the different components are treated as black boxes that have already been individually validated. Communication between them is viewed primarily as communication links, making it possible to verify that exchanges, functional flows, and main business scenarios execute correctly from the perspective of the overall system.&lt;/p&gt;
&lt;p&gt;Acceptance tests therefore aim to confirm that the solution meets functional expectations, acceptance criteria, and business needs, without duplicating technical validations already performed at lower test levels. This clear separation of responsibilities helps limit redundancy, keeps acceptance tests focused and understandable, and concentrates validation efforts where they deliver the greatest value.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Future Role of QA&lt;/h2&gt;
&lt;p&gt;In a context where test automation and continuous delivery practices are becoming increasingly prevalent, the role of QA resources must evolve. QA should no longer carry sole responsibility for functional testing, nor be perceived only as the people validating the product at the end of the cycle.&lt;/p&gt;
&lt;p&gt;QA must be involved earlier in the development lifecycle, particularly in the design and creation of integration tests. Their functional expertise and understanding of critical scenarios bring significant value in defining high impact cases, identifying risks, and ensuring that component interactions truly meet business needs.&lt;/p&gt;
&lt;p&gt;As automation increases, the volume of manual testing should naturally decrease. This evolution does not reduce the importance of QA; instead, it transforms their role. QA professionals become true quality gatekeepers, responsible for the overall vision, test strategy, functional coverage, and coherence across validation levels.&lt;/p&gt;
&lt;p&gt;Indeed, developers naturally tend to test their code rather than validating the functionality from a business and end‑user perspective. The role of QA therefore becomes essential to ensure that complete scenarios, functional flows, and real‑world use cases are properly covered across the entire automated testing suite.&lt;/p&gt;
&lt;p&gt;Rather than focusing primarily on test execution, QA actively contributes to defining quality standards, analyzing automated test results, continuously improving testing practices, and collaborating closely with development teams. This approach strengthens overall product quality while supporting faster and more reliable delivery cycles.&lt;/p&gt;
&lt;h2 class=&quot;post-page-heading&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This document presents a structured and pragmatic approach to automated testing, designed to address the realities of modern, distributed, and complex solutions. By clearly defining the role and scope of unit tests, integration tests, and acceptance tests, it establishes a strategy in which each test level delivers specific value without unnecessary duplication.&lt;/p&gt;
&lt;p&gt;Unit tests are intentionally kept simple, fast, and focused, securing the code and utility classes without adding maintenance overhead. Integration tests handle higher‑value validations by testing complete logic flows and real interactions between components, while respecting the responsibility of each individual layer. Acceptance tests validate the system's overall functional behavior by treating components as already‑proven black boxes.&lt;/p&gt;
&lt;p&gt;This approach also reflects an evolution in the role of quality assurance resources. In a context where automation progressively reduces the reliance on manual testing, QA professionals become quality gatekeepers, responsible for the overall vision, functional coverage, and consistency across validation levels. Their role is essential in complementing the developer‑centric view—often focused on code—with validation driven by business and end‑user perspectives.&lt;/p&gt;
&lt;p&gt;Finally, this approach is based on a shared responsibility for quality. Quality is not the sole responsibility of QA teams: analysts play a key role by defining clear, testable requirements aligned with business reality, while developers are responsible for delivering robust, well‑tested code that adheres to established standards. Quality thus becomes a collective objective, embraced by the entire team from the earliest design stages through to production.&lt;/p&gt;
&lt;p&gt;By combining a clear separation of responsibilities, a coherent test structure, and strengthened collaboration between development and quality assurance, this strategy improves overall delivery quality, reduces risk, and effectively supports a continuous delivery approach.&lt;/p&gt;
</content>
  </entry>
</feed>
