Skip to content

Commit d3938e0

Browse files
Copilotafranken
andcommitted
Remove duplicated Spring/Kotlin/Testing guidance from AGENTS.md files; replace with references to docs/
Co-authored-by: afranken <763000+afranken@users.noreply.github.com>
1 parent 76cfb4e commit d3938e0

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

AGENTS.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,21 @@ docker/ # Docker image build
2929

3030
## DO / DON'T
3131

32+
> For Kotlin idioms and naming conventions, see **[docs/KOTLIN.md](docs/KOTLIN.md)**.
33+
> For Spring Boot patterns and testing setup, see **[docs/SPRING.md](docs/SPRING.md)**.
34+
> For testing conventions and commands, see **[docs/TESTING.md](docs/TESTING.md)**.
35+
3236
### DO
33-
- Use **constructor injection** for all Spring beans (in production code)
3437
- Use **data classes** for DTOs with Jackson XML annotations
35-
- Use **Kotlin stdlib** and built-in language features over third-party utilities
3638
- Use **AWS SDK v2** for all new integration tests
3739
- Use **JUnit 5** for all new tests
38-
- Use **`@SpringBootTest`** with **`@MockitoBean`** for unit tests — this is the project's standard mocking approach
39-
- Use **expression bodies** for simple functions
40-
- Use **null safety** (`?`, `?.`, `?:`) instead of null checks
41-
- **Name the `it` parameter** in nested lambdas, loops, and scope functions to avoid shadowing: `.map { part -> ... }` instead of `.map { it.name }`
42-
- Match **AWS S3 API naming exactly** in Jackson XML annotations (`localName = "..."`)
43-
- Keep tests **independent** — each test creates its own resources (UUID bucket names)
44-
- Use **backtick test names** with descriptive sentences: `` fun `should create bucket successfully`() ``
45-
- Mark test classes as **`internal`**: `internal class ObjectServiceTest`
46-
- **Refactor** legacy `testSomething` camelCase names to backtick style when touching existing tests
4740
- **Update the copyright year** in the file's license header to the current year whenever you modify an existing file
4841
- Validate XML serialization against [AWS S3 API documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html)
4942

5043
### DON'T
51-
- DON'T use `@Autowired` or field injection in production code — always use constructor injection
52-
- DON'T use `var` for public API properties — prefer `val` (immutability)
5344
- DON'T use AWS SDK v1 — it has been removed in 5.x
5445
- DON'T use JUnit 4 — it has been removed in 5.x
55-
- DON'T use `@ExtendWith(MockitoExtension::class)` or `@Mock` / `@InjectMocks` — use `@SpringBootTest` with `@MockitoBean` instead
56-
- DON'T add Apache Commons dependencies — use Kotlin stdlib equivalents
57-
- DON'T put business logic in controllers — controllers only map HTTP, delegate to services
58-
- DON'T return raw strings from controllers — use typed DTOs for XML/JSON responses
5946
- DON'T declare dependency versions in sub-module POMs — all versions are managed in root `pom.xml`
60-
- DON'T share mutable state between tests — each test must be self-contained
61-
- DON'T hardcode bucket names in tests — use `UUID.randomUUID()` for uniqueness
62-
- DON'T use legacy `testSomething` camelCase naming for new tests — use backtick names instead
6347
- DON'T update copyright years in files you haven't modified — copyright is only bumped when a file is actually changed
6448

6549
## Code Style
@@ -105,7 +89,7 @@ Environment variables (prefix: `COM_ADOBE_TESTING_S3MOCK_STORE_`):
10589

10690
Services throw `S3Exception` constants (`NO_SUCH_BUCKET`, `NO_SUCH_KEY`, `INVALID_BUCKET_NAME`, etc.).
10791
Spring exception handlers convert them to XML `ErrorResponse` with the correct HTTP status.
108-
See `server/AGENTS.md` for details.
92+
See **[docs/SPRING.md](docs/SPRING.md)** for exception handling patterns and `server/AGENTS.md` for the concrete handler classes.
10993

11094
## Testing
11195

docs/TESTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ Access `serviceEndpoint`, `serviceEndpointHttp`, and `serviceEndpointHttps` from
6767

6868
See **[docs/KOTLIN.md](KOTLIN.md)** for Kotlin naming conventions (backtick test names, `internal` visibility, naming patterns).
6969

70-
- **Naming**: Backtick names with descriptive sentences — `` fun `should create bucket successfully`() ``
71-
- **Visibility**: Mark test classes `internal`
7270
- **Pattern**: Arrange-Act-Assert
7371
- **Assertions**: AssertJ (`assertThat(...)`) — use specific matchers, not just `isNotNull()`
7472
- **Error cases**: Use AssertJ, not JUnit `assertThrows`:
@@ -78,7 +76,6 @@ See **[docs/KOTLIN.md](KOTLIN.md)** for Kotlin naming conventions (backtick test
7876
.hasMessageContaining("Status Code: 409")
7977
```
8078
- **Independence**: Each test creates its own resources — no shared state, UUID-based bucket names
81-
- **Legacy names**: Refactor `testSomething` camelCase names to backtick style when touching existing tests
8279

8380
## Running Tests
8481

server/AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ server/src/main/kotlin/com/adobe/testing/s3mock/
3636

3737
1. **DTO** (`dto/`): Data classes with Jackson XML annotations (`@JacksonXmlRootElement`, `@JacksonXmlProperty`, `@JacksonXmlElementWrapper(useWrapping = false)`). Verify element names against [AWS S3 API docs](https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html).
3838
2. **Store** (`store/`): Filesystem path resolution, binary storage, metadata JSON. Key classes: `BucketStore`, `ObjectStore`, `BucketMetadata`, `S3ObjectMetadata`.
39-
3. **Service** (`service/`): Validation, store coordination. Throw **`S3Exception` constants** (e.g., `S3Exception.NO_SUCH_BUCKET`) — don't create new exception classes.
39+
3. **Service** (`service/`): Validation, store coordination. Throw **`S3Exception` constants** (e.g., `S3Exception.NO_SUCH_BUCKET`) — see **[docs/SPRING.md](../docs/SPRING.md)** for exception handling rules.
4040
4. **Controller** (`controller/`): HTTP mapping only — delegate all logic to services. Controllers never catch exceptions.
4141

4242
## Error Handling
4343

4444
- `S3MockExceptionHandler` converts `S3Exception` → XML `ErrorResponse` with the correct HTTP status
4545
- `IllegalStateExceptionHandler` converts unexpected errors → `500 InternalError`
46-
- Add new error types as constants in `S3Exception` — DON'T create new exception classes
46+
47+
See **[docs/SPRING.md](../docs/SPRING.md)** for exception handling patterns and rules.
4748

4849
## Testing
4950

0 commit comments

Comments
 (0)