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 2021/08/13 20:10:46 UTC

[commons-pool] 04/04: Use 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-pool.git

commit 84d1a37bdff45771dd1b3cc26227d2b00d870f8d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 13 16:05:30 2021 -0400

    Use assertThrows.
---
 .../org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java  | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
index 4c584b8..5800273 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
@@ -2048,12 +2048,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         gkoPool.setMaxTotal(0);
         gkoPool.setBlockWhenExhausted(false);
 
-        try {
-            gkoPool.borrowObject("a");
-            fail("Expected NoSuchElementException");
-        } catch(final NoSuchElementException e) {
-            // expected
-        }
+        assertThrows(NoSuchElementException.class, () -> gkoPool.borrowObject("a"));
     }