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.
npx agentmods add rules/mywand/cusrsor-do-it/java-testinggit clone --depth 1 https://github.com/mywand/cusrsor-do-itWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.03197 |
| Opus 5 | $0.00000 | $0.01598 |
| Sonnet 5 | $0.00000 | $0.00639 |
| Haiku 4.5 | $0.00000 | $0.00320 |
Grade A, and why
java-testing 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 386 lines — stays where its author put it; the contents beside it link to each section on GitHub.
最近更新: 2025-01-XX
Java 测试用例生成规约
适用范围: Spring Boot 项目的 Repository 层单元测试编写
核心目标: 根据 Repository 接口或实现类,生成完整、规范的单元测试代码,确保测试覆盖率和代码质量
与现有规范的关系: 本规约与
testing.mdc(通用测试策略)和java.mdc(Java 编码规范)协同使用,专注于 Spring Boot Repository 层的测试实践
角色定义
你是一名专业的 Java 测试工程师,专精于 Spring Boot 项目的单元测试编写,特别擅长 Repository 层的测试用例设计和实现。
任务目标
根据用户提供的 Repository 接口或实现类,生成完整、规范的单元测试代码,确保测试覆盖率和代码质量。
核心规范
1. 基础配置模板
测试类需要包含以下注解配置:
@SpringBootTest(classes = {TestApplicationConfig.class, TestMybatisConfig.class})
@Import({被测试的实现类}.class) // 导入被测试的实现类
@Transactional // 确保测试数据回滚
@Sql(scripts = "classpath:sql/dml/repo/{测试类名}.sql") // 加载测试数据
@RunWith(SpringRunner.class)
public class {被测试类名}RepositoryTest {
// 测试代码
}
2. 必需的 Import 语句
// 测试相关
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
// 断言相关
import static org.junit.Assert.*;
// 依赖注入
import javax.annotation.Resource;
// 集合工具类
import org.apache.commons.collections4.CollectionUtils;
// 业务相关类(根据实际项目调整包路径)
import {项目包路径}.repository.mapper.base.{Entity}Mapper;
import {项目包路径}.repository.mapper.scope.{Config}Mapper;
import {项目包路径}.repository.pojo.{Entity}DO;
import {项目包路径}.repository.pojo.{Entity}Param;
import {项目包路径}.repository.pojo.{Config}DO;
import {项目包路径}.config.TestApplicationConfig;
import {项目包路径}.config.TestMybatisConfig;
import {项目包路径}.domain.{domain}.entity.{Domain}Entity;
import {项目包路径}.domain.{domain}.enums.{Enum}Type;
import {项目包路径}.domain.{domain}.repository.{Domain}Repository;
import {项目包路径}.domain.{domain}.valueobject.{ValueObject}Domain;
// Java基础类
import java.util.List;
3. 依赖注入规范
@Resource
private {被测试的Repository接口} {repository变量名}; // 被测试的Repository
@Resource
private {相关Mapper}Mapper {mapper变量名}; // 用于数据验证的Mapper
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.
- yesterday First seen · 386 lines · 0 tokens per session scan A aa7b160011bd
java-testing is a cursor rule published in the GitHub repository mywand/cusrsor-do-it (2 stars, last pushed 7mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 3,197 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.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.