java-setup-integration-tests

Set up Java Spring Boot integration tests with Spock and Testcontainers.

40|33|Updated Aug 20, 2015
One-click install
npx skills add https://github.com/bitsoex/bitso-java --skill java-setup-integration-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-setup-integration-tests
Source: https://github.com/bitsoex/bitso-java/tree/main/.claude/skills/java-setup-integration-tests
Command: npx skills add https://github.com/bitsoex/bitso-java --skill java-setup-integration-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive framework and best practices for setting up robust integration tests for Java/Spring Boot services using the Spock Framework, significantly improving test reliability and developer productivity.

Core Features & Use Cases

  • Testcontainers Integration: Seamlessly configure and use Docker containers for databases (PostgreSQL) and caches (Valkey/Redis).
  • Mocking Strategies: Implement effective mocking for external services using GrpcMock (for gRPC) and WireMock (for REST), with clear guidelines on when to use @MockitoBean or @SpringBean for ProtoShims.
  • gRPC & REST Testing: Detailed patterns for testing gRPC handlers, external gRPC clients, and REST controllers.
  • Kafka Consumer Testing: Utilize @EmbeddedKafka for efficient testing of Kafka message consumers.
  • Use Case: When developing a new microservice, use this Skill to quickly establish a solid integration testing foundation, ensuring all external dependencies are correctly mocked and infrastructure is properly configured, leading to faster development cycles and fewer production bugs.

Quick Start

Use the java-setup-integration-tests skill to create a new BaseIntegrationSpec for your Java Spring Boot service.

Frequently Asked Questions about java-setup-integration-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Java Spring Boot integration tests using Spock?

Set up Java Spring Boot integration tests using Spock by creating a BaseIntegrationSpec that centralizes configuration, mock resets, and data cleanup strategies. This framework standardizes test reliability and accelerates microservice development cycles.

How do I test Kafka consumers in a Spring Boot integration test?

Test Kafka consumers in a Spring Boot integration test by using the @EmbeddedKafka annotation. This facilitates efficient validation of Kafka message consumers within your Spock testing framework without requiring external broker connections.

What is the best way to mock gRPC clients in Java integration tests?

The best way to mock gRPC clients in Java integration tests is using GrpcMock. It provides resilience testing for external gRPC clients, with clear guidelines on when to use @MockitoBean or @SpringBean for ProtoShims.

How do I configure Testcontainers for PostgreSQL and Redis in Spock tests?

Configure Testcontainers for PostgreSQL and Valkey/Redis in Spock tests by integrating them into your BaseIntegrationSpec. This seamlessly provisions Docker containers for databases and caches, isolating infrastructure dependencies during test execution.

How do I mock REST clients in a Spock integration test?

Mock REST clients in a Spock integration test using WireMock. The framework provides detailed patterns for testing REST controllers and external REST clients, ensuring external service dependencies are reliably mocked.

Why use Spock instead of JUnit for Spring Boot integration tests?

Use Spock instead of JUnit for Spring Boot integration tests to leverage its standardized framework and best practices for complex mocking. It centralizes configuration for Testcontainers, GrpcMock, and WireMock, improving test reliability and developer productivity.