spring-boot-test

spring-boot-test is a cursor rule for Cursor from lsampaioweb/ai-instructions. It costs 0 tokens per session (1,047 once invoked), scanned A, original, MIT.

A set of Spring Boot testing rules for testing individual application layers and complete integrations. It covers test names, suitable test setups, HTTP contract checks, database tests, unit tests, and full application tests.

In plain words
What is it for?
Use it when creating or reviewing controller, repository, unit, integration, or API-contract tests in a Spring Boot project.
Why use it?
It helps tests stay focused and avoids starting the entire application when only one layer needs checking. It also keeps test imports and naming consistent with Spring Boot 4.x.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when creating or reviewing controller, repository, unit, integration, or API-contract tests in a Spring Boot project.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/lsampaioweb/ai-instructions/spring-boot-test
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/lsampaioweb/ai-instructions

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for spring-boot-test

README.md
[![agentmods](https://agentmods.dev/badge/rules/lsampaioweb/ai-instructions/spring-boot-test/github.svg)](https://agentmods.dev/rules/lsampaioweb/ai-instructions/spring-boot-test)
Your own site
<a href="https://agentmods.dev/rules/lsampaioweb/ai-instructions/spring-boot-test"><img src="https://agentmods.dev/badge/rules/lsampaioweb/ai-instructions/spring-boot-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for spring-boot-test

Your own site · 80×15
<a href="https://agentmods.dev/rules/lsampaioweb/ai-instructions/spring-boot-test"><img src="https://agentmods.dev/badge/rules/lsampaioweb/ai-instructions/spring-boot-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,047 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01047
Opus 5.5 $0.00000 $0.00419
Sonnet 5.5 $0.00000 $0.00209
Haiku 4.5 $0.00000 $0.00105

Measured 1mo ago against content hash 57b83ec48353, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

spring-boot-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/spring-boot-test.mdc · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Spring Boot Testing Contract

These rules apply to automated tests in real application modules. i18n key-parity tests stay in the i18n contract. Compile/test verification after edits stays in the Java style contract. Security assertion expectations stay in the Security contract. HTTP load scripts stay in the k6 contract; do not run k6 from Maven Surefire. Do not restate those contracts here.

Applications must meet this contract for every feature they ship.

Dependencies

  • Add spring-boot-starter-test with test scope to every application module.
  • Add spring-boot-starter-webmvc-test with test scope when the module has a REST controller. Real REST apps always ship @WebMvcTest.
  • Import @WebMvcTest from org.springframework.boot.webmvc.test.autoconfigure. On Spring Boot 4, spring-boot-starter-test does not provide this class.
  • Add spring-security-test with test scope when the module tests Spring Security behavior.
  • Keep a one-line purpose comment above each dependency (pom contract).
  • Place test-scoped dependencies last in pom.xml (pom contract).

Mandatory baseline

  • Every application module has an *ApplicationTests class annotated with @SpringBootTest that proves the Spring context loads.
  • Every module with message bundles also has an I18nConsistencyTest (or equivalent) as required by the i18n contract.

REST controller tests

  • For each REST feature controller, ship at least one @WebMvcTest (or equivalent MockMvc slice) covering:
    • one happy-path request
    • one validation or domain-error path
  • Declare the service interface mock at class level with @MockitoBean (or the current Boot mock annotation); constructor-inject mocks used by test methods. Do not call a real database from a controller slice test.
  • Assert HTTP status, important headers (for example Location on create), and key JSON fields.
  • Prefer @WebMvcTest over a full @SpringBootTest for controller HTTP contract checks.

Service tests

Read the full file on GitHub · 103 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +43 lines 57b83ec48353
  2. 3mo ago First seen · 60 lines · 0 tokens per session scan A 8e07de868df3

Subscribe to this mod's changes

spring-boot-test is a cursor rule published in the GitHub repository lsampaioweb/ai-instructions (1 stars, last pushed 11d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,047 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

spring-boot-test compared with cursor rules from other repositories

spring-boot-test next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
spring-boot-testlsampaioweb/ai-instructionsCursor rule111d agoMITA0Cursor
use-contract-ir-factoriesprisma/ormCursor rule48ktodayApache-2.0A0Codex, Cursor
mockitosanjeed5/awesome-cursor-rules-mdcCursor rule3.6k8d agoCC0-1.0A1,653Cursor
gonavi-goSyngnat/GoNaviCursor rule2.1ktodayApache-2.0A0Cursor
python-general-coding-standardsholtwood/awesome-cursorrules-zhCursor rule2441mo agoMITA140Cursor
project-conventionskequach/uniqlo-sales-alerterCursor rule323d agoMITA1,033Cursor
unit-testing-standardsadobecom/da-express-miloCursor rule6yesterdayApache-2.0A2,431Cursor