-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix EventMeshGrpcProducerTest#testPublishWithException Although EventMeshGrpcProducerTest#testPublishWithException passes, it's wrong to do so. This tests calls the EventMeshGrpcProducer#produce method with a valid EventMeshMessage instance, so it does not, in fact, throw an error. The test then doesn't fail on the following line. Since no exception is ever thrown, the catch block is never reached, and the assertion in it is never called. This patch fixes the test by passing a truly invalid message (just a string), and adds an explicit failure if an exception is not called. * Standardize exception handling in tests Following 7508251, the upgrade to JUnit Jupiter allows us to standardize the way exceptions are handled in tests and reduce boilerplate code. - There is no need to catch an exception and explicitly fail the test. The test should be allowed to throw the exception and error-out, which is technically the correct behavior (the test didn't really fail on any logic test). - In the cases where the only assertion was explicitly failing the test in case an exception was thrown, Assertions.assertDoesNotThrow was used instead. - In order to test cases when an exception must be thrown, Assertions.assertThrows can be used. There is no need to catch the exception and assert it's not null. - It's also worth noting that some instances that used the idiom of catching an expected exception did not fail the test in case the exception was never thrown, meaning this patch not only improves the tests style, but also their correctness. Fixes #4483
- Loading branch information
Showing
20 changed files
with
87 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.