Skip to content

codegen: add unit tests for pure-function pipeline pieces #14

Description

@bokelley

Follow-up from #12 review.

Track 2 ships ~2700 LOC of generator with 44 round-trip integration tests proving "the artifact compiles and a few payloads round-trip." That's good but thin — several pure-function pieces have non-trivial branching logic that's only exercised transitively through the generated output.

build-logic/src/test/ does not exist yet.

Add focused unit tests for:

Class Why it needs a test
NamingConventions Java reserved-word collisions, digit-leading enum constants, $-prefix handling, escape() Javadoc-safety (e.g. */ in description)
DiscriminatorDetector.pickBestDiscriminator 4 branches incl. tiebreak between candidates with equal coverage — currently non-deterministic
SchemaPreprocessor Recursive normalization; conditional-allOf strip, array-constraint strip — silent breakage today
SchemaRegistry.resolve All four $ref shapes (absolute, fragment, relative, $defs); cross-version refs returning null
SealedInterfaceIndex byFqn vs bySchemaPath precedence
InlineTypeCollector Collision warning emits to stderr but loses the second type — needs explicit coverage

Acceptance: build-logic/src/test/kotlin/codegen/ exists, unit tests run under :build-logic:test and are picked up by CI. Coverage of the listed classes ≥ 80%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions