java-testing-advanced

pluginagentmarketplace/custom-plugin-java · updated Apr 8, 2026

$npx skills add https://github.com/pluginagentmarketplace/custom-plugin-java --skill java-testing-advanced
0 commentsdiscussion
summary

Advanced testing techniques for comprehensive test coverage.

skill.md

Java Testing Advanced Skill

Advanced testing techniques for comprehensive test coverage.

Overview

This skill covers advanced testing patterns including Testcontainers for integration testing, contract testing with Pact, mutation testing with PIT, and property-based testing.

When to Use This Skill

Use when you need to:

  • Test with real databases (Testcontainers)
  • Verify API contracts
  • Find gaps with mutation testing
  • Generate test cases automatically

Quick Reference

Testcontainers

@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();
    }
}

Contract Testing (Pact)

@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");
    }
}

Mutation Testing (PIT)

<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-Based Testing

@Property
void shouldReverseListTwiceReturnsOriginal(@ForAll List<Integer> list) {
    Collections.reverse(list);
    Collections.reverse(list);
    // Original order restored
}

Testing Pyramid

     /\        E2E Tests (few)
    /  \       Contract Tests
   /----\      Integration Tests
  /------\     Unit Tests (many)

Troubleshooting

Problem Solution
Container slow Reuse containers
Port conflicts Random ports
Flaky tests Wait strategies

Usage

Skill("java-testing-advanced")

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.651 reviews
  • Diego Robinson· Dec 24, 2024

    Keeps context tight: java-testing-advanced is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Michael Lopez· Dec 20, 2024

    We added java-testing-advanced from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Chaitanya Patil· Dec 16, 2024

    java-testing-advanced has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Camila Sharma· Nov 15, 2024

    java-testing-advanced is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Michael Flores· Nov 11, 2024

    java-testing-advanced fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Piyush G· Nov 7, 2024

    java-testing-advanced reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Shikha Mishra· Oct 26, 2024

    We added java-testing-advanced from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Sakura Khanna· Oct 6, 2024

    Solid pick for teams standardizing on skills: java-testing-advanced is focused, and the summary matches what you get after install.

  • Evelyn Rao· Oct 2, 2024

    java-testing-advanced has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Valentina Chawla· Sep 13, 2024

    Useful defaults in java-testing-advanced — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

showing 1-10 of 51

1 / 6