ワンクリックで
java-testing-advanced
Advanced testing - Testcontainers, contract testing, mutation testing, property-based
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Advanced testing - Testcontainers, contract testing, mutation testing, property-based
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Master Java concurrency - threads, executors, locks, CompletableFuture, virtual threads
Containerize Java applications - Dockerfile optimization, JVM settings, security
Master core Java programming - syntax, OOP, collections, streams, and exception handling
Master Gradle - Kotlin DSL, task configuration, build optimization, caching
Master JPA/Hibernate - entity design, queries, transactions, performance optimization
Master Maven and Gradle - build configuration, dependencies, plugins, CI/CD
| name | java-testing-advanced |
| description | Advanced testing - Testcontainers, contract testing, mutation testing, property-based |
| sasmp_version | 1.3.0 |
| version | 3.0.0 |
| bonded_agent | 04-java-testing |
| bond_type | SECONDARY_BOND |
| allowed-tools | Read, Write, Bash, Glob, Grep |
| parameters | {"technique":{"type":"string","enum":["testcontainers","contract","mutation","property_based"],"description":"Advanced testing technique"}} |
Advanced testing techniques for comprehensive test coverage.
This skill covers advanced testing patterns including Testcontainers for integration testing, contract testing with Pact, mutation testing with PIT, and property-based testing.
Use when you need to:
@Testcontainers
@SpringBootTest
class OrderRepositoryIT {
@Container
static PostgreSQLContainer<?> postgres =
new PostgreSQLContainer<>("postgres:15")
.withDatabaseName("test")
.withUsername("test")
.withPassword("test");
@Container
static KafkaContainer kafka =
new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.4.0"));
@DynamicPropertySource
static void configure(DynamicPropertyRegistry registry) {
registry.add("spring.datasource.url", postgres::getJdbcUrl);
registry.add("spring.kafka.bootstrap-servers", kafka::getBootstrapServers);
}
@Test
void shouldPersistOrder() {
Order saved = repository.save(new Order("item", 100.0));
assertThat(saved.getId()).isNotNull();
}
}
@ExtendWith(PactConsumerTestExt.class)
class UserServiceContractTest {
@Pact(consumer = "order-service", provider = "user-service")
public RequestResponsePact createPact(PactDslWithProvider builder) {
return builder
.given("user exists")
.uponReceiving("get user request")
.path("/users/1")
.method("GET")
.willRespondWith()
.status(200)
.body(new PactDslJsonBody()
.integerType("id", 1)
.stringType("name", "John"))
.toPact();
}
@Test
@PactTestFor(pactMethod = "createPact")
void testGetUser(MockServer mockServer) {
User user = client.getUser(mockServer.getUrl(), 1L);
assertThat(user.getName()).isEqualTo("John");
}
}
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.15.0</version>
<configuration>
<targetClasses>
<param>com.example.service.*</param>
</targetClasses>
<mutationThreshold>80</mutationThreshold>
</configuration>
</plugin>
@Property
void shouldReverseListTwiceReturnsOriginal(@ForAll List<Integer> list) {
Collections.reverse(list);
Collections.reverse(list);
// Original order restored
}
/\ E2E Tests (few)
/ \ Contract Tests
/----\ Integration Tests
/------\ Unit Tests (many)
| Problem | Solution |
|---|---|
| Container slow | Reuse containers |
| Port conflicts | Random ports |
| Flaky tests | Wait strategies |
Skill("java-testing-advanced")