teragrep / pth_10

Data Processing Language (DPL) translator for Apache Spark
GNU Affero General Public License v3.0
0 stars 2 forks source link

Get rid of try catch blocks in tests #222

Closed StrongestNumber9 closed 6 months ago

StrongestNumber9 commented 6 months ago

Description

Don't use throws or try/catch in tests.

For example this test will pass if anything throws before assert calls. https://github.com/teragrep/pth_10/blob/57586b4575bf084e3cc4a34bd39bca6c2166fa9a/src/test/java/com/teragrep/pth10/Rex4jOldTransformationTest.java#L117-L140

Use case or motivation behind the feature request

Every situation in tests should be known so throwing and try/catching should not be needed.. Using them can mask errors or even false positively pass the test if the flow is not implemented correctly.

Related issues

Additional context

Use Assertions.assertAll when you want to run a codeblock that should not throw anything

Use Assertions.assertThrows when you expect code to throw specific exception

eemhu commented 6 months ago

got rid of try-catch blocks in merged internal PR. however, iplocation tests contain a try-catch block but it should not be a problem as the caught exception is rethrown