
How to Test Microservices Without Running Everything
Test a Java microservice in isolation: unit and slice tests, Testcontainers for its own database, WireMock for dependencies and contract tests.
Tag
223 posts

Test a Java microservice in isolation: unit and slice tests, Testcontainers for its own database, WireMock for dependencies and contract tests.

Secure a Quarkus service with OIDC and Keycloak: bearer token mode, Dev Services for Keycloak, role based access with annotations and testing with tokens.

Fix a JSF commandButton or commandLink that does nothing: check the form, validation messages, conversion errors, nested forms, rendered and immediate.

Inject your own objects into JUnit 5 test methods and constructors with ParameterResolver, and combine it with lifecycle callbacks to manage resources.

Debug classpath problems in Java: find which jar a class came from, duplicate classes, version conflicts, class loaders and load logging.

Learn where Struts 2 evaluates OGNL, why user input must never reach an expression, and which settings and habits keep the value stack safe.

Test a Play application with JUnit, from plain controller unit tests to full-application tests that route fake HTTP requests and use an embedded server.

Secure a Micronaut API with JWT bearer tokens: configure signing, issue a token from a login endpoint and protect routes with annotations and roles.

Build a custom Java runtime with jlink that contains only the modules your app needs, and package it into a small Docker image with a multi-stage build.

Use Mockito spy to stub part of a real object, learn the doReturn syntax, and see why a spy often signals a class that should be split instead.

Find slow endpoints in a Java service with Micrometer timers, percentile histograms, distributed tracing and slow query logs.

Use Protobuf and gRPC between Java services: define a proto file, generate code, write a server and client, set deadlines and evolve messages.