/micronaut-standards:testcontainersfrom Micronaut Standards
OneLiteFeather's mandatory Testcontainers integration-test convention for Micronaut REST APIs — MariaDB and PostgreSQL containers via micronaut-test-resources, JUnit 5 lifecycle conventions, and the boundary between unit tests (no container) and integration tests (container required). Use this whenever writing a repository, migration, or controller integration test for a Micronaut backend, or reviewing a project that still relies on an embedded H2 database as its only test strategy.
Ships in Micronaut Standards. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Every Micronaut backend's integration tests run against real MariaDB and PostgreSQL instances via Testcontainers — never against an embedded H2 database standing in for "a database" in general. H2's SQL dialect and behavior diverge from both real targets in exactly the ways that matter for catching a migration or query bug before production does.
dependencies {
testImplementation(mn.testcontainers.core)
testImplementation(mn.testcontainers.mariadb)
testImplementation(mn.testcontainers.postgresql)
testImplementation(mn.micronaut.test.resources.extensions.core)
testImplementation(mn.micronaut.test.resources.extensions.junit.platform)
}
micronaut-test-resources manages the container lifecycle automatically per test run — a test class
doesn't need to manually start/stop a container or wire its JDBC URL into application-test.yml by hand;
Micronaut's test-resources service starts the right container on demand and injects its connection
properties. That automatic lifecycle management doesn't remove the need for the Testcontainers module
dependencies themselves (mn.testcontainers.mariadb, mn.testcontainers.postgresql) — test-resources
still needs them on the test classpath to know which container images exist to manage in the first
place.
@MicronautTest
class FontRepositoryTest {
@Inject
FontRepository fontRepository;
@Test
void savesAndFindsAFont() {
FontEntity saved = fontRepository.save(new FontEntity(null, "Test Font", "textures/test.png"));
assertThat(fontRepository.findById(saved.getId())).isPresent();
}
}
With micronaut-test-resources on the test classpath, @MicronautTest is enough — no explicit
@Testcontainers/@Container annotations are needed for the common case, since test-resources handles
container startup/teardown itself. Reach for manual @Testcontainers/@Container management only for a
test that needs direct control over the container instance (e.g. asserting against a container's own
logs, or deliberately restarting it mid-test) rather than the default managed lifecycle.
Containers are reused across test classes within the same test run by default — avoid forcing a fresh container per test class (e.g. via a per-class-unique container label) unless a test genuinely needs total isolation from every other test's data, since that multiplies test suite runtime for no benefit in the common case.
@MicronautTest(environments = "mariadb")
class LiquibaseMariaDbTest {
@Test
void changelogAppliesCleanly(DataSource dataSource) throws Exception {
// schema is already migrated by the time the Micronaut context starts;
// assert against the resulting schema/data here.
}
}
@MicronautTest(environments = "postgresql")
class LiquibasePostgresTest {
@Test
void changelogAppliesCleanly(DataSource dataSource) throws Exception {
// same assertions, against the PostgreSQL-backed context
}
}
Running the same test logic under both a mariadb and a postgresql Micronaut environment (each
resolving to its own Testcontainers-backed datasource) is how a Liquibase changelog's cross-DB claim
(see the liquibase skill) gets actually verified, rather than assumed from reading the XML.
Don't reach for a container-backed test to verify pure business logic that a mocked-repository unit test would cover just as well, and don't reach for a mocked-repository unit test to verify that a query or a migration actually behaves correctly against a real database — each has a job the other can't do.
What SKILL.md sets; muted values are Claude Code's defaults
14 skills in this plugin
/configurationOneLiteFeather's convention for typed application configuration in a Micronaut REST API — one @ConfigurationProperties class per functional area in a dedicated config/ package, instead of ad-hoc properties scattered across the application entry point. Use this whenever a Micronaut backend needs a new piece of externalized configuration (a feature flag, an external service URL, a limit/threshold) and you're deciding where the corresponding Java type should live./dependency-managementOneLiteFeather's Gradle/Micronaut dependency-management conventions for REST API backends — the Micronaut Application and AOT plugins, reading the Micronaut version from gradle.properties instead of hardcoding it, the mn.* platform catalog, the private OneLiteFeather Maven repo, and the optional CycloneDX SBOM plugin. Use this whenever setting up or editing a Micronaut backend's build.gradle.kts/settings.gradle.kts. For the general OneLiteFeather Gradle/BOM mechanics that apply beyond Micronaut (private repo credential split, Java toolchain pattern), see minestom-knowledge:gradle/boms instead. For observability, database-migration, Testcontainers, and security dependencies specifically, see the observability, liquibase, testcontainers, and security skills — this skill only lists that those dependencies exist and where to look, not their coordinates; the one exception is structured-logging dependencies (Logstash encoder, OpenTelemetry MDC appender), whose coordinates live directly in this skill since `logging` covers only their usage.npx claudepluginhub onelitefeathernet/onelitefeather-claude-marketplace --plugin micronaut-standardsOther plugins' skills for the same job