hack23/cia

integration-testing

Implement Spring Framework integration tests with TestContainers, Spring Test, and database fixtures

First seen Mar 4, 2026

Installation

$ npx skills add hack23/cia --skill integration-testing

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from hack23/cia · top by installs.

npx skills add hack23/cia

Browse all from hack23/cia

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 235
License LICENSE.txt
Default branch master
Open issues 0
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

LicenseApache-2.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,573 B
  • docs SUMMARY.md 127 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 8 installs

SKILL.md

Integration Testing Skill

Purpose

Test component interactions, database operations, and external API integrations using Spring testing framework with TestContainers.

When to Use

  • ✅ Testing repository layer with real database
  • ✅ Testing REST API endpoints (if applicable)
  • ✅ Testing Spring Security configuration
  • ✅ Testing external API integrations

Spring Integration Test Patterns

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = ApplicationContext.class)
@Sql(scripts = "/test-data.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public class PoliticianIntegrationTest {
    
    @Autowired
    private PoliticianRepository repository;
    
    @Test
    void shouldCreatePoliticianViaApi() {
        // Arrange
        PoliticianRequest request = new PoliticianRequest("John", "Doe", "S");
        
        // Act
        ResponseEntity<Politician> response = restTemplate.postForEntity(
            "/api/politicians",
            request,
            Politician.class
        );
        
        // Assert
        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
        assertThat(response.getBody()).isNotNull();
        
        // Verify in database
        Politician saved = repository.findById(response.getBody().getId()).orElseThrow();
        assertThat(saved.getFirstName()).isEqualTo("John");
    }
}

TestContainers for PostgreSQL

@Testcontainers
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = ApplicationContext.class)
public class DatabaseIntegrationTest {
    
    @ClassRule
    public static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:18")
        .withDatabaseName("cia_test")
        .withUsername("test")
        .withPassword("test");
    
    @BeforeClass
    public static void setupTestDatabase() {
        System.setProperty("spring.datasource.url", postgres.getJdbcUrl());
        System.setProperty("spring.datasource.username", postgres.getUsername());
        System.setProperty("spring.datasource.password", postgres.getPassword());
    }
    
    @Test
    public void shouldConnectToDatabase() {
        assertThat(postgres.isRunning()).isTrue();
    }
}

Security Integration Tests

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ApplicationContext.class, SecurityConfig.class})
@WebAppConfiguration
public class SecurityIntegrationTest {
    
    @Autowired
    private WebApplicationContext context;
    
    private MockMvc mockMvc;
    
    @Before
    public void setup() {
        mockMvc = MockMvcBuilders
            .webAppContextSetup(context)
            .apply(springSecurity())
            .build();
    }
    
    @Test
    @WithMockUser(roles = "ADMIN")
    public void shouldAllowAdminAccess() throws Exception {
        mockMvc.perform(get("/api/admin/users"))
            .andExpect(status().isOk());
    }
    
    @Test
    public void shouldDenyUnauthenticatedAccess() throws Exception {
        mockMvc.perform(get("/api/admin/users"))
            .andExpect(status().isUnauthorized());
    }
}

References