lliangyu-lin opened a new pull request, #12624:
URL: https://github.com/apache/iceberg/pull/12624

   ### Description
   * Added regex to check usage of `assertThatThrownBy` and 
`assertThatExceptionOfType` need to include check on the error message content.
   * Resolve all current files that didn't include error message check and 
causing checkstyle failures.
   ```
   
assertThatExceptionOfType\((?:(?!\.withMessage\w*\().)*?isThrownBy\((?:(?!\.withMessage\w*\().)*?;
   ```
   The regex will flag when a code block starts with 
`assertThatExceptionOfType`, ends with `;`, and includes `isThrownBy` 
in-between, but didn't have `withMessageXXX(...` before or after the 
`isThrownBy`
   
   Examples that will get flagged:
   ```
   assertThatExceptionOfType(NotFoundException.class).isThrownBy(() -> 
fileIO.newInputFile("s3://nonexistent/file"));
   
   assertThatExceptionOfType(NotFoundException.class)
       .isThrownBy(() -> fileIO.newInputFile("s3://nonexistent/file"));
   ```
   
   Examples that will not get flagged:
   ```
   assertThatExceptionOfType(NotFoundException.class).isThrownBy(() -> 
fileIO.newInputFile("s3://nonexistent/file")).hasMessage("123");
   
   assertThatExceptionOfType(NotFoundException.class)
       .isThrownBy(() -> fileIO.newInputFile("s3://nonexistent/file"))
       .hasMessage("123");
   ```
   
   Closes #7040


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to