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 163ae0a0 JUnit5 assertThrows TestTimeInfo
new abccacd3 Merge pull request #120 from
nhojpatrick/junit5-assertThrows-TestTimeInfo
163ae0a0 is described below
commit 163ae0a032331a8a581c0c9fcfc8f2b500fc471e
Author: John Patrick <[email protected]>
AuthorDate: Thu Oct 20 17:19:27 2022 +0100
JUnit5 assertThrows TestTimeInfo
---
src/test/java/org/apache/commons/net/ntp/TestTimeInfo.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/net/ntp/TestTimeInfo.java
b/src/test/java/org/apache/commons/net/ntp/TestTimeInfo.java
index 9a075fbc..14c06d06 100644
--- a/src/test/java/org/apache/commons/net/ntp/TestTimeInfo.java
+++ b/src/test/java/org/apache/commons/net/ntp/TestTimeInfo.java
@@ -23,6 +23,9 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.function.Executable;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
public class TestTimeInfo {
@@ -86,10 +89,11 @@ public class TestTimeInfo {
Assert.assertEquals(info, another);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test
public void testException() {
final NtpV3Packet packet = null;
- new TimeInfo(packet, 1L);
+ final Executable testMethod = () -> new TimeInfo(packet, 1L);
+ assertThrows(IllegalArgumentException.class, testMethod);
}
@Test