Journal

How to Write Unit Tests for Java Reflection and Annotation Processing
Reflection and annotation processing often sit behind frameworks, dependency injection, validation, serialisation, mapping, and code generation. When the…
Vagrant and Testcontainers for reliable dockerized test environments
Modern software teams rarely run tests against the same operating system, kernel, or system libraries that ship to production. Linux containers changed that,…
Testing JPA Repositories with @DataJpaTest and Testcontainers
JPA repositories sit close to the database, so tests that replace PostgreSQL with an in-memory H2 database can create misleading confidence. SQL generated by…
Reliable Retry Logic for Flaky HTTP Tests
Flaky HTTP tests pass and fail without a meaningful code change. They may time out when a service is briefly overloaded, receive a 502 from a reverse proxy, or…
Generating Reliable Random Test Data in Java
Random test data helps reveal assumptions that fixed fixtures often hide. A service may pass every test with Alice, 12345, and today’s date, then fail when it…
Testing REST API Pagination and Sorting Logic for Production APIs
When backend services serve thousands of records — product catalogues, transaction ledgers, ASX-listed share registers or NBN outage reports — pagination and…
Testing Java code with Spock and Maven in a Groovy workflow
Java developers who default to JUnit often inherit a sea of assertion libraries and ceremonial setup. Groovy paired with the Spock framework gives the same JVM…
Mocking database calls with H2 and Spring Test
Spring Boot applications spend a surprising amount of time talking to a database, and a surprising amount of test flakiness starts there. A query that works on…
Coordinating Async Tests Using CountDownLatch and ExecutorService
When Java code fires work onto a thread pool and continues without waiting, tests have a problem: how do you assert that the callback actually ran? Synchronous…
Load Testing a WebSocket Server with k6
WebSocket applications keep a connection open so that the server can push data as soon as it becomes available. That model suits chat, live dashboards,…