Skip to content

Commit d422309

Browse files
thcedclaude
andcommitted
chore: Rename underscore IT tests and complete plan checklist
Bring all tests in OpenApiServerIT into pure-camelCase form, matching the project convention applied on feat/combinators. Also flip the remaining final-verification items in the schema-booleans plan to [x] now that the branch is verified end to end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e706bd4 commit d422309

2 files changed

Lines changed: 36 additions & 36 deletions

File tree

docs/superpowers/plans/2026-05-08-schema-booleans-implementation.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
### Step 1.1: Add the schema records and extend `permits`
2828

29-
- [ ] **Step 1: Create `AlwaysSchema.java`**
29+
- [x] **Step 1: Create `AlwaysSchema.java`**
3030

3131
Write this file at `src/main/java/com/retailsvc/http/spec/schema/AlwaysSchema.java`:
3232

@@ -43,7 +43,7 @@ public record AlwaysSchema() implements Schema {
4343
}
4444
```
4545

46-
- [ ] **Step 2: Create `NeverSchema.java`**
46+
- [x] **Step 2: Create `NeverSchema.java`**
4747

4848
Write this file at `src/main/java/com/retailsvc/http/spec/schema/NeverSchema.java`:
4949

@@ -60,7 +60,7 @@ public record NeverSchema() implements Schema {
6060
}
6161
```
6262

63-
- [ ] **Step 3: Extend `Schema.java` permits clause**
63+
- [x] **Step 3: Extend `Schema.java` permits clause**
6464

6565
Open `src/main/java/com/retailsvc/http/spec/schema/Schema.java`. Add `AlwaysSchema` and `NeverSchema` to the `permits` list. The full list becomes (alphabetized as in the existing file):
6666

@@ -88,7 +88,7 @@ public sealed interface Schema
8888

8989
### Step 1.2: Add failing parser tests
9090

91-
- [ ] **Step 4: Append parser tests**
91+
- [x] **Step 4: Append parser tests**
9292

9393
Append to `src/test/java/com/retailsvc/http/spec/schema/SchemaParserTest.java` (inside the class, before the final `}`):
9494

@@ -133,7 +133,7 @@ void parsesArrayWithBooleanItemsSchema() {
133133

134134
The `assertThatThrownBy` static is not yet imported — leave the fully-qualified call in place; it lives only in this single test and matches the pattern used elsewhere in the codebase before that import was added in `feat/combinators`.
135135

136-
- [ ] **Step 5: Run the failing tests**
136+
- [x] **Step 5: Run the failing tests**
137137

138138
Run: `mvn -q test -Dtest=SchemaParserTest`
139139

@@ -143,7 +143,7 @@ Expected: the build fails to compile. The new tests call `SchemaParser.parse(Boo
143143

144144
### Step 1.3: Change the parser entry to accept `Object`
145145

146-
- [ ] **Step 6: Rewrite `SchemaParser.parse(...)` entry**
146+
- [x] **Step 6: Rewrite `SchemaParser.parse(...)` entry**
147147

148148
Open `src/main/java/com/retailsvc/http/spec/schema/SchemaParser.java`. Replace the public `parse(Map<String, Object>)` method with a new `parse(Object)` entry, and rename the original body to a private `parseMap(...)`. Concretely:
149149

@@ -233,7 +233,7 @@ private static List<Schema> parseList(Map<String, Object> raw, String key) {
233233
234234
### Step 1.4: Drop `Map` casts on external `parse` callers in `Spec.java`
235235
236-
- [ ] **Step 7: Edit `Spec.java`**
236+
- [x] **Step 7: Edit `Spec.java`**
237237
238238
Open `src/main/java/com/retailsvc/http/spec/Spec.java`. Drop the `(Map<String, Object>)` cast on the four direct `SchemaParser.parse(...)` callers. The lines (in current commit):
239239
@@ -253,19 +253,19 @@ The four `@SuppressWarnings("unchecked")` annotations on the surrounding methods
253253
254254
### Step 1.5: Verify and commit
255255
256-
- [ ] **Step 8: Run the parser tests**
256+
- [x] **Step 8: Run the parser tests**
257257
258258
Run: `mvn -q test -Dtest=SchemaParserTest`
259259
260260
Expected: all parser tests pass (existing + the 5 new).
261261
262-
- [ ] **Step 9: Run the full unit suite**
262+
- [x] **Step 9: Run the full unit suite**
263263
264264
Run: `mvn -q test`
265265
266266
Expected: BUILD SUCCESS. No regressions in `Spec`-driven tests, validator tests, or container tests.
267267
268-
- [ ] **Step 10: Commit**
268+
- [x] **Step 10: Commit**
269269
270270
```bash
271271
git add src/main/java/com/retailsvc/http/spec/schema/AlwaysSchema.java \
@@ -302,7 +302,7 @@ Pre-commit hook (Google Java Formatter, commitlint, editorconfig) may reformat
302302
303303
### Step 2.1: Add failing validator tests
304304
305-
- [ ] **Step 1: Append validator tests**
305+
- [x] **Step 1: Append validator tests**
306306
307307
Append to `src/test/java/com/retailsvc/http/validate/DefaultValidatorDispatchTest.java` (inside the class, before the final `}`):
308308
@@ -365,15 +365,15 @@ import com.retailsvc.http.spec.schema.NeverSchema;
365365
366366
If `Map` isn't already imported (it likely is for surrounding tests), add `import java.util.Map;` next to other `java.util.*` imports.
367367

368-
- [ ] **Step 2: Run the failing tests**
368+
- [x] **Step 2: Run the failing tests**
369369

370370
Run: `mvn -q test -Dtest=DefaultValidatorDispatchTest`
371371

372372
Expected: 7 new tests fail. The validator currently has no case for `AlwaysSchema` or `NeverSchema`, so the sealed `switch` is non-exhaustive and the file no longer compiles. (Recall that Java's exhaustive switch on a sealed type requires all permitted subtypes to be covered.) Compilation will fail with "switch expression does not cover all possible input values" — that's the expected red state for TDD here.
373373

374374
### Step 2.2: Add the validator branches
375375

376-
- [ ] **Step 3: Edit `DefaultValidator.validate(...)`**
376+
- [x] **Step 3: Edit `DefaultValidator.validate(...)`**
377377

378378
Open `src/main/java/com/retailsvc/http/validate/DefaultValidator.java`. Inside the `switch (schema)` block in `validate(...)`, add two new cases. Place them adjacent to the other "trivial" cases (after `BooleanSchema`/`NullSchema`, before the primitive cases — the exact ordering doesn't matter, but stay consistent with the file's existing case order):
379379

@@ -389,19 +389,19 @@ import com.retailsvc.http.spec.schema.AlwaysSchema;
389389
import com.retailsvc.http.spec.schema.NeverSchema;
390390
```
391391

392-
- [ ] **Step 4: Run the validator tests**
392+
- [x] **Step 4: Run the validator tests**
393393

394394
Run: `mvn -q test -Dtest=DefaultValidatorDispatchTest`
395395

396396
Expected: BUILD SUCCESS. All existing tests + the 7 new ones pass.
397397

398-
- [ ] **Step 5: Run the full unit suite**
398+
- [x] **Step 5: Run the full unit suite**
399399

400400
Run: `mvn -q test`
401401

402402
Expected: BUILD SUCCESS, no regressions.
403403

404-
- [ ] **Step 6: Commit**
404+
- [x] **Step 6: Commit**
405405

406406
```bash
407407
git add src/main/java/com/retailsvc/http/validate/DefaultValidator.java \
@@ -432,7 +432,7 @@ Pre-commit hook may reformat — re-stage / re-run as needed.
432432

433433
### Step 3.1: Extend the OpenAPI fixture
434434

435-
- [ ] **Step 1: Add `/gates` to `openapi.yaml`**
435+
- [x] **Step 1: Add `/gates` to `openapi.yaml`**
436436

437437
Open `src/test/resources/openapi.yaml`. After the existing `/blocked` (or `/shapes` if `/blocked` doesn't exist on this branch — see note below) endpoint, add:
438438
@@ -457,7 +457,7 @@ Open `src/test/resources/openapi.yaml`. After the existing `/blocked` (or `/shap
457457
458458
**Note about base branch.** This branch (`feat/schema-booleans`) is cut from `master`, which does NOT have `/shapes`, `/filters`, or `/blocked` (those live on `feat/combinators`). The fixture on this branch instead has stub `/anyOf` and `/allOf` paths with `post: {}`. Add `/gates` after `/anyOf` and `/allOf` to keep the surrounding ordering predictable. Do NOT remove the `/anyOf` / `/allOf` stubs — that cleanup is owned by `feat/combinators`.
459459
460-
- [ ] **Step 2: Mirror in `openapi.json`**
460+
- [x] **Step 2: Mirror in `openapi.json`**
461461
462462
Open `src/test/resources/openapi.json`. Find the `"/anyOf"` and `"/allOf"` keys. Add `"/gates"` immediately after them. The block:
463463
@@ -489,7 +489,7 @@ Mind the trailing commas: the previous path entry needs a trailing comma if it d
489489

490490
### Step 3.2: Add the integration tests
491491

492-
- [ ] **Step 3: Add `Gates` nested class to `OpenApiServerIT.java`**
492+
- [x] **Step 3: Add `Gates` nested class to `OpenApiServerIT.java`**
493493

494494
Open `src/test/java/com/retailsvc/http/OpenApiServerIT.java`. Add a new nested class at the bottom of the outer class (immediately before its final `}`). All test method names are pure camelCase per the project convention:
495495

@@ -546,13 +546,13 @@ class Gates {
546546

547547
### Step 3.3: Verify and commit
548548

549-
- [ ] **Step 4: Run the verify build**
549+
- [x] **Step 4: Run the verify build**
550550

551551
Run: `mvn -q verify`
552552

553553
Expected: BUILD SUCCESS. The two new IT methods pass alongside everything else.
554554

555-
- [ ] **Step 5: Commit**
555+
- [x] **Step 5: Commit**
556556

557557
```bash
558558
git add src/test/resources/openapi.yaml src/test/resources/openapi.json \
@@ -577,9 +577,9 @@ Pre-commit hook may reformat YAML / Java — re-stage / re-run as needed.
577577

578578
## Final verification
579579

580-
- [ ] Run `mvn -q verify` once more.
581-
- [ ] `git log --oneline master..HEAD` shows the spec commit followed by three feature commits in this order: `feat: Parse boolean schemas…`, `feat: Validate AlwaysSchema and NeverSchema…`, `test: Add integration coverage for boolean schemas…`.
582-
- [ ] `grep -rEn "void [a-zA-Z][a-zA-Z0-9]*_[a-zA-Z]" src/test/java/` returns nothing — confirms test method names follow the pure-camelCase convention.
580+
- [x] Run `mvn -q verify` once more.
581+
- [x] `git log --oneline master..HEAD` shows the spec commit followed by three feature commits in this order: `feat: Parse boolean schemas…`, `feat: Validate AlwaysSchema and NeverSchema…`, `test: Add integration coverage for boolean schemas…`.
582+
- [x] `grep -rEn "void [a-zA-Z][a-zA-Z0-9]*_[a-zA-Z]" src/test/java/` returns nothing — confirms test method names follow the pure-camelCase convention.
583583

584584
## Out of scope
585585

src/test/java/com/retailsvc/http/OpenApiServerIT.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Data {
3131
String path = "/data";
3232

3333
@Test
34-
void getData_shouldReturnJsonBody() {
34+
void getDataShouldReturnJsonBody() {
3535
try (var server = newServer(Map.of("get-data", new GetDataHandler()));
3636
var client = httpClient()) {
3737

@@ -54,7 +54,7 @@ void getData_shouldReturnJsonBody() {
5454
}
5555

5656
@Test
57-
void getData_shouldReturnBadRequestOnInvalidXNameHeader() {
57+
void getDataShouldReturnBadRequestOnInvalidXNameHeader() {
5858
try (var server = newServer(Map.of("get-data", new GetDataHandler()));
5959
var client = httpClient()) {
6060

@@ -80,7 +80,7 @@ void getData_shouldReturnBadRequestOnInvalidXNameHeader() {
8080
}
8181

8282
@Test
83-
void postData_shouldReturnJsonBody() {
83+
void postDataShouldReturnJsonBody() {
8484
try (var server = newServer(Map.of("post-data", new EchoHandler()));
8585
var client = httpClient()) {
8686

@@ -129,7 +129,7 @@ void postData_shouldReturnJsonBody() {
129129
}
130130

131131
@Test
132-
void postData_shouldReturnBadRequestOnMissingRequiredProperties() {
132+
void postDataShouldReturnBadRequestOnMissingRequiredProperties() {
133133
Map<String, HttpHandler> handlers = Map.of("post-data", new EchoHandler());
134134

135135
try (var server = newServer(handlers);
@@ -187,7 +187,7 @@ class ListObjects {
187187
String path = "/list/objects";
188188

189189
@Test
190-
void listObjects_shouldReturnJsonBody() {
190+
void listObjectsShouldReturnJsonBody() {
191191
try (var server = newServer(Map.of("post-list-objects", new EchoHandler()));
192192
var client = httpClient()) {
193193

@@ -218,7 +218,7 @@ void listObjects_shouldReturnJsonBody() {
218218
}
219219

220220
@Test
221-
void listObjects_shouldReturnBadRequestOnPassingObjectInsteadOfArray() {
221+
void listObjectsShouldReturnBadRequestOnPassingObjectInsteadOfArray() {
222222
try (var server = newServer(Map.of("post-list-objects", new EchoHandler()));
223223
var client = httpClient()) {
224224

@@ -252,7 +252,7 @@ class QueryParams {
252252
String path = "/params/query";
253253

254254
@Test
255-
void getParamsQuery_shouldReturnOkOnValidQueryParams() {
255+
void getParamsQueryShouldReturnOkOnValidQueryParams() {
256256
try (var server = newServer(Map.of("query-params", new EchoHandler()));
257257
var client = httpClient()) {
258258

@@ -276,7 +276,7 @@ void getParamsQuery_shouldReturnOkOnValidQueryParams() {
276276
}
277277

278278
@Test
279-
void paramsQuery_shouldReturnBadRequestOnMissingRequiredQueryParams() {
279+
void paramsQueryShouldReturnBadRequestOnMissingRequiredQueryParams() {
280280
try (var server = newServer(Map.of("query-params", new EchoHandler()));
281281
var client = httpClient()) {
282282

@@ -309,7 +309,7 @@ class PathParams {
309309
String path = "/params/path";
310310

311311
@Test
312-
void getPathParams_shouldReturnOkOnValidPathParam() {
312+
void getPathParamsShouldReturnOkOnValidPathParam() {
313313
try (var server = newServer(Map.of("path-params", new EchoHandler()));
314314
var client = httpClient()) {
315315

@@ -332,7 +332,7 @@ void getPathParams_shouldReturnOkOnValidPathParam() {
332332
}
333333

334334
@Test
335-
void getPathParams_shouldReturnOkOnMultipleValidPathParams() {
335+
void getPathParamsShouldReturnOkOnMultipleValidPathParams() {
336336
try (var server = newServer(Map.of("path-params-multi", new EchoHandler()));
337337
var client = httpClient()) {
338338

@@ -355,7 +355,7 @@ void getPathParams_shouldReturnOkOnMultipleValidPathParams() {
355355
}
356356

357357
@Test
358-
void getPathParams_shouldReturnBadRequestOnBadFormatPathParam() {
358+
void getPathParamsShouldReturnBadRequestOnBadFormatPathParam() {
359359
try (var server = newServer(Map.of("path-params-multi", new EchoHandler()));
360360
var client = httpClient()) {
361361

@@ -382,7 +382,7 @@ void getPathParams_shouldReturnBadRequestOnBadFormatPathParam() {
382382
}
383383

384384
@Test
385-
void getPathParams_shouldReturnInternalErrorOnMissingHandler() {
385+
void getPathParamsShouldReturnInternalErrorOnMissingHandler() {
386386
try (var server = newServer(Map.of("not-a-valid-operation-id", new EchoHandler()));
387387
var client = httpClient()) {
388388

0 commit comments

Comments
 (0)