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
Background
ZstdFrameTestrepeats the same "given non-zstd bytes → operation fails withZstdException" test across several nested classes, each namedrejectsGarbage():IsFrame(~L32)CompressedSize(~L63)DecompressedBound(~L85)DecompressedSize(~L153)Each builds a small garbage
byte[]and asserts the call throws (or returns false, forisZstdFrame).Task
Reduce the duplication. Either a shared helper that takes the operation under test, or a
@ParameterizedTestover(operation, garbage-input)cases.isZstdFramereturnsfalserather than throwing, so keep that case correct (don't force it into the throwing path).Acceptance criteria
CLAUDE.md(Given/When/Then;assertThatThrownByon a capturedThrowingCallable)../mvnw -pl zstd teststays green.Pointers
zstd/src/test/java/io/github/dfa1/zstd/ZstdFrameTest.java