armeria
armeria copied to clipboard
Expose unexpected decoding exception reason
Motivation:
Issue: https://github.com/line/armeria/issues/5177
Modifications:
- I added
UnexpectedDecodeException
to throw an exception if aDecompressionException
is thrown and the if condition is not met. - Added tests ( I decided that it is important that the decoder throws a
DecompressionException
and that understanding the internal implementation of the decoder is not what i am testing, so i decided to use a mock at the first time. However, it was difficult to use 'mock' because the 'decoder' variable is created and initialized in the constructor instead of being injected, and it was difficult to manipulate it using inheritance because the access modifier level of the constructor ofAbstractStreamDecoder
is 'protected'. Therefore, I added two separate classes for testing. I don't think this structure is efficient, and I think it's hard to manage whenAbstractStreamDecoder
class changes are made. I couldn't think of any other way to do it, so I went with this, but if anyone has a better idea, I'd love to hear it.
Result:
- Closes https://github.com/line/armeria/issues/5177
🔍 Build Scan® (commit: e3da519403d0619b237906658b49a08e90d46700)
Job name | Status | Build Scan® |
---|
And please sign the ICLA :bow:
I've signed ICLA. Sorry for missed this.
I've applied trustin's review. left one jrhee's comment.
Revised and cleaned up the PR description and commit message, which was previously out of sync.