You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/11/07 15:42:14 UTC

[commons-net] branch master updated: Port to JUnit 5's assertThrows()

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d49fe8b Port to JUnit 5's assertThrows()
3d49fe8b is described below

commit 3d49fe8b51ee43f0100b85d95b0a9787ef36d701
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 7 10:42:09 2022 -0500

    Port to JUnit 5's assertThrows()
---
 src/test/java/org/apache/commons/net/ntp/TestNtpPacket.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/net/ntp/TestNtpPacket.java b/src/test/java/org/apache/commons/net/ntp/TestNtpPacket.java
index f08f1ea4..9aa49e99 100644
--- a/src/test/java/org/apache/commons/net/ntp/TestNtpPacket.java
+++ b/src/test/java/org/apache/commons/net/ntp/TestNtpPacket.java
@@ -138,11 +138,11 @@ public class TestNtpPacket {
         Assert.assertEquals(2, message.getLeapIndicator());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test
     public void testCreateFromBadPacket() {
         final NtpV3Packet message = new NtpV3Impl();
         final DatagramPacket dp = new DatagramPacket(ntpPacket, ntpPacket.length-4); // drop 4-bytes from packet
-        message.setDatagramPacket(dp);
+        assertThrows(IllegalArgumentException.class, () -> message.setDatagramPacket(dp));
     }
 
     @Test
@@ -153,6 +153,7 @@ public class TestNtpPacket {
         Assert.assertEquals(4, message.getMode());
     }
 
+    @Test
     public void testCreateFromNullPacket() {
         final NtpV3Packet message = new NtpV3Impl();
         assertThrows(IllegalArgumentException.class, () -> message.setDatagramPacket(null));