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/11/05 19:10:44 UTC

[GitHub] [commons-net] garydgregory commented on a diff in pull request #121: JUnit5 assertThrows SimpleSMTPHeaderTestCase

garydgregory commented on code in PR #121:
URL: https://github.com/apache/commons-net/pull/121#discussion_r1014692159


##########
src/test/java/org/apache/commons/net/smtp/SimpleSMTPHeaderTestCase.java:
##########
@@ -103,9 +105,10 @@ public void testToStringAddHeaderDate() {
         assertEquals("Date: dummy date\nFrom: from@here.invalid\n\n", hdr.toString());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test
     public void testToStringNoFrom() {
-        new SimpleSMTPHeader(null, null, null);
+        final Executable testMethod = () -> new SimpleSMTPHeader(null, null, null);
+        assertThrows(IllegalArgumentException.class, testMethod);

Review Comment:
   The local variable is not needed and feels like it just clutters up the code.



-- 
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