copilot-setting testing.instructions.md

Testing rules for Java 8 projects using JUnit 4, Mockito, and Spring Test 3.2.

In plain words
What is it for?
Use them to write unit and integration tests with JUnit 4 annotations, Mockito, Spring XML contexts, Arrange–Act–Assert structure, and automatic test transaction rollback.
Why use it?
They keep tests compatible with the project and encourage isolated tests that check one behavior without depending on order or external services.

Instructions file for GitHub Copilot

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.

agentmods
npx agentmods add instructions/zexion7873/copilot-setting/testing
Clone the repo
git clone --depth 1 https://github.com/zexion7873/copilot-setting

Made for: GitHub Copilot.

Per session 609 This file is loaded in full into every session.
When invoked 609 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00609 $0.00609
Opus 5 $0.00304 $0.00304
Sonnet 5 $0.00122 $0.00122
Haiku 4.5 $0.00061 $0.00061

Measured yesterday against content hash 64149ce265d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

copilot-setting testing.instructions.md 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.

.github/instructions/testing.instructions.md · 42 lines

What it actually says

Testing Conventions

Java 8 language rules apply: instructions/java.instructions.md.

Framework Boundary (JUnit 5 / Spring Boot Forbidden)

  • JUnit 4org.junit.Test, @Before / @After, Assert.assertEquals. No org.junit.jupiter.* / @BeforeEach / @ExtendWith
  • Spring Test 3.2@RunWith(SpringJUnit4ClassRunner.class) + @ContextConfiguration. No @SpringBootTest / @WebMvcTest / @ExtendWith(SpringExtension.class)
  • Mockito@RunWith(MockitoJUnitRunner.class) or MockitoAnnotations.initMocks(this). No @ExtendWith(MockitoExtension.class)
  • Assertions: Assert.* or Hamcrest assertThat; AssertJ only if already on the classpath

Structure

  • One behavior per test; name methodName_condition_expectedResult; Arrange–Act–Assert, visually separated
  • No interdependence (isolated, any order); no logic (loops / conditionals) inside a test

Integration Tests

  • @ContextConfiguration against a test-scoped XML context, not production beans
  • Test-class @Transactional auto-rollback is sanctioned — test-only; does NOT violate the production <tx:advice>-only rule (instructions/spring-hibernate.instructions.md)
  • Never hit a real external service — stub at the boundary

Data & Mocks

  • Mock collaborators at the layer boundary (DAO in service tests); no shared mutable static fixtures
  • Deterministic: no new Date() / unseeded random — inject a fixed clock or seed

Anti-Patterns

Pattern Problem Fix
org.junit.jupiter.api.Test JUnit 5 org.junit.Test
@SpringBootTest No Spring Boot @RunWith(SpringJUnit4ClassRunner.class) + @ContextConfiguration
@BeforeEach / @AfterEach JUnit 5 lifecycle @Before / @After
@ExtendWith(MockitoExtension.class) JUnit 5 extension @RunWith(MockitoJUnitRunner.class)
Thread.sleep() for async Flaky, slow Await a condition / synchronous executor
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. yesterday First seen · 42 lines · 609 tokens per session scan A 64149ce265d6

Subscribe to this mod's changes

copilot-setting testing.instructions.md is an instructions file published in the GitHub repository zexion7873/copilot-setting (1 stars, last pushed 28d ago), licensed MIT. It adds 609 tokens to every session, about $0.0030 per session on Opus 5. 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.