BrotliErrorChecker { static int assertBrotliOk(int errorCodeOrSizeInformation) throws BrotliException { if (!isBrotliOk(errorCodeOrSizeInformation)) throw new BrotliException(resolveErrorCode2Message(errorCodeOrSizeInformation)); return errorCodeOrSizeInformation; }    }
@Test(expectedExceptions = BrotliException.class) public void when_valid_error_exception_is_thrown() throws Exception { BrotliErrorChecker.assertBrotliOk(-1); }
@Test public void when_no_error_nothing_happens() throws Exception { BrotliErrorChecker.assertBrotliOk(0); BrotliErrorChecker.assertBrotliOk(1); }
@Test public void assertBroltiOk_returns_the_error_code_if_all_ok() throws Exception { int actual = BrotliErrorChecker.assertBrotliOk(23_42); assertThat(actual).isEqualTo(23_42); }