You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/02/21 17:22:46 UTC
[GitHub] [commons-codec] itamarc commented on a change in pull request #113: CODEC-285-JUnit5
itamarc commented on a change in pull request #113:
URL: https://github.com/apache/commons-codec/pull/113#discussion_r811323952
##########
File path: src/test/java/org/apache/commons/codec/StringEncoderAbstractTest.java
##########
@@ -72,16 +67,10 @@ public void testEncodeNull() throws EncoderException {
@Test
public void testEncodeWithInvalidObject() throws Exception {
- boolean exceptionThrown = false;
- try {
- final StringEncoder encoder = this.getStringEncoder();
- encoder.encode(Float.valueOf(3.4f));
- } catch (final Exception e) {
- exceptionThrown = true;
- }
- Assert.assertTrue("An exception was not thrown when we tried to encode " + "a Float object", exceptionThrown);
+ final StringEncoder encoder = this.getStringEncoder();
+ assertThrows(EncoderException.class, () -> { encoder.encode(Float.valueOf(3.4f)); },
Review comment:
I tried to not change or remove any of the messages (except for typos), even if I think the message was not necessary. All I did was to change the position of the message as a parameter, since this changed from JUnit 4 to 5. My intention was to minimize the changes, and afterall, some of the messages give information about the failure of the test that the message from JUnit will not give.
--
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-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org