mureinik opened a new pull request #50: CSV-252: Clean up exception handling
URL: https://github.com/apache/commons-csv/pull/50
 
 
   As a followup to commit e2f0a4d8a83a41eaa984086636a3712c682307ea that 
introduced JUnit Jupiter to the project, this patch leverages the new 
`Assertions#assertThrows` method to clean up tests for expected exceptions.
   
   Instead of the somewhat clunky structure common in JUnit 4 tests:
   
   ```java
   try {
       someMethod();
       fail("SomeException should be thrown");
   } catch (SomeException e) {
       // Expected...
       // Possibly some assertion on e
   }
    ```
   
   JUnit Jupiter allows the following elegant syntax:
   
   ```java
   SomeException e = assertThrows(SomeException.class, () -> someMethod());
   // Possibly some assertions on e
   ```
   
   In addition, redundant `throws` clauses in the test code were removed to 
make the code more concise and easier to read

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to