|
1 | | -# CLAUDE.md |
2 | | - |
3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | | - |
5 | | -## Project Overview |
6 | | - |
7 | | -ApprovalTests.Java is a snapshot-based testing library that simplifies assertions by comparing expected output to approved files. The library supports JUnit 3/4/5 and TestNG, and works with JDK 1.8-25. |
8 | | - |
9 | | -## Architecture |
10 | | - |
11 | | -This is a multi-module Maven project with the following key modules: |
12 | | - |
13 | | -- **approvaltests**: Main library containing core functionality (`Approvals.java`, writers, reporters, namers) |
14 | | -- **approvaltests-util**: Shared utilities and helper classes (used as a dependency by approvaltests) |
15 | | -- **approvaltests-tests**: Integration tests and examples |
16 | | -- **approvaltests-util-tests**: Tests for utility classes |
17 | | -- **counter_display**: Sample application |
18 | | -- **html_locker**: Additional tooling |
19 | | - |
20 | | -The core API is in `org.approvaltests.Approvals` class, which provides static methods like `verify()`, `verifyAll()`, `verifyAsJson()`. The library uses a pattern of Writers (generate output), Namers (determine file names), and Reporters (show differences when tests fail). |
21 | | - |
22 | | -## Common Commands |
23 | | - |
24 | | -### Build and Test |
25 | | -```bash |
26 | | -# Build and test via Mise (requires mise installed) |
27 | | -./build_and_test |
28 | | -``` |
29 | | - |
30 | | -**Note:** The project uses [Mise](https://mise.jdx.dev/) for task automation. The `.mise.toml` file defines tasks like `build_and_test` and `format`. Java version is specified in `.java-version` file. |
31 | | - |
32 | | -## Key Files and Concepts |
33 | | - |
34 | | -- **Approved files**: `*.approved.*` files must be committed to source control. These are automatically treated as binary in git via `.gitattributes` (`*.approved.* binary diff`) |
35 | | -- **Received files**: `*.received.*` files generated during test failures, showing actual output vs approved. These should not be committed |
36 | | -- **Reporters**: Tools that show diffs when tests fail (IntelliJ, Beyond Compare, etc.). Located in `org.approvaltests.reporters` |
37 | | -- **Namers**: Determine approval file naming based on test method/class. Located in `org.approvaltests.namer` |
38 | | -- **Writers**: Generate the actual content to be approved. Located in `org.approvaltests.writers` |
39 | | - |
40 | | -## Running Single Tests |
41 | | - |
42 | | -Individual test methods can be run using standard Maven/IDE approaches: |
43 | | -```bash |
44 | | -mvn test -Dtest=ClassName#methodName |
45 | | -``` |
46 | | - |
47 | | -**Note:** Tests run with `en_US` locale by default (configured in surefire plugin) to ensure consistent output across different environments. |
48 | | - |
49 | | -## Code Style |
50 | | - |
51 | | -There is an automatic code formatter that is used every time you build the project. |
| 1 | +Read @AGENTS.md |
0 commit comments