Skip to content

Consolidate the duplicated rejectsGarbage() tests in ZstdFrameTest #53

Description

@dfa1

Background

ZstdFrameTest repeats the same "given non-zstd bytes → operation fails with ZstdException" test across several nested classes, each named rejectsGarbage():

  • IsFrame (~L32)
  • CompressedSize (~L63)
  • DecompressedBound (~L85)
  • DecompressedSize (~L153)

Each builds a small garbage byte[] and asserts the call throws (or returns false, for isZstdFrame).

Task

Reduce the duplication. Either a shared helper that takes the operation under test, or a @ParameterizedTest over (operation, garbage-input) cases. isZstdFrame returns false rather than throwing, so keep that case correct (don't force it into the throwing path).

Acceptance criteria

  • The repeated bodies are expressed once; each frame operation is still covered.
  • Conventions per CLAUDE.md (Given/When/Then; assertThatThrownBy on a captured ThrowingCallable).
  • ./mvnw -pl zstd test stays green.

Pointers

  • zstd/src/test/java/io/github/dfa1/zstd/ZstdFrameTest.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersjavaPull requests that update java code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions