Provides unit test, integration test, and mock AI patterns for LangChain4j applications. Creates mock LLM responses, tests retrieval chains, validates RAG workflows, and implements Testcontainers-based integration tests for Java AI services.
SkillScore96Maintained
Automatic
◆QA & Test Engineering pack
Last verified 8/21/2026
What it changes
Passed 22 of 23 test cases with the skill, and 18 of 23 without it.
Without skill78%
With skill96%
Checks it passed that the model alone missed
Specifies using the image ollama/ollama:0.5.4.
Recommends adding langchain4j-test to the build dependencies.
Recommends executing a preliminary ping generation call wrapped in assertDoesNotThrow.
and 1 more in the full report
4 fixed18 passed either way1 still failing0 broke
Pass-rate lift
+17 pp
Tokens
+58%
Agent turns
0%
Response time
-18%
Model gemini-3.6-flashMeasured 8/21/2026v122 of 23 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 4
Prompt
When setting up an Ollama container in a Java integration test, what quick diagnostic step should be executed right after verifying the container is running and listening, before proceeding to main evaluation queries?
What was checked, without and with the skill
Checked
Without skill
With skill
Recommends executing a preliminary ping generation call wrapped in assertDoesNotThrow.
Missed
Passed
case-05 · gemini-3.6-flash · 8/21/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md203 lines6 files
LangChain4J Testing Strategies
Overview
Patterns for unit testing with mocks, integration testing with Testcontainers, and end-to-end validation of RAG systems, AI Services, and tool execution.
When to Use
Unit testing AI services: When you need fast, isolated tests for services using LangChain4j AiServices
Integration testing LangChain4j components: When testing real ChatModel, EmbeddingModel, or RAG pipelines with Testcontainers
Mocking AI models: When you need deterministic responses without calling external APIs
Testing LLM-based Java applications: When validating RAG workflows, tool execution, or retrieval chains
Instructions
1. Unit Testing with Mocks
Use mock models for fast, isolated testing. See references/unit-testing.md.
ChatModel mockModel = mock(ChatModel.class);
when(mockModel.generate(any(String.class)))
.thenReturn(Response.from(AiMessage.from("Mocked response")));
var service = AiServices.builder(AiService.class)
.chatModel(mockModel)
.build();
2. Configure Testing Dependencies
Setup Maven/Gradle dependencies. See references/testing-dependencies.md.
Provides comprehensive memory file management capabilities including auditing, quality assessment, and targeted improvements for files such as CLAUDE.md. Use when user asks to check, audit, update, improve, fix, maintain, or validate project memory files. Also triggers for "project memory optimization", "CLAUDE.md quality check", "documentation review", or when a project memory file needs to be created from scratch. This skill scans memory files, evaluates quality against standardized criteria,