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 2024/09/26 12:14:15 UTC

(commons-lang) branch master updated (5a9d81b0a -> 4a8aa9e72)

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

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


    from 5a9d81b0a Use try-with-resources
     new fc3f9c790 Rename test method
     new 9e4a50d4e Refactor map test in PairTest
     new 4a8aa9e72 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-lang.git

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/lang3/tuple/PairTest.java   | 27 +++++++++++++++-------
 1 file changed, 19 insertions(+), 8 deletions(-)


(commons-lang) 03/03: Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-lang.git

Posted by gg...@apache.org.
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-lang.git

commit 4a8aa9e7243e7df4e5ebca91b85209bd69c875fb
Merge: 9e4a50d4e 5a9d81b0a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 26 08:13:55 2024 -0400

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-lang.git

 pom.xml                                            |  4 +-
 .../java/org/apache/commons/lang3/Strings.java     |  7 +++
 .../apache/commons/lang3/text/StrBuilderTest.java  | 63 +++++++++++-----------
 3 files changed, 41 insertions(+), 33 deletions(-)


(commons-lang) 01/03: Rename test method

Posted by gg...@apache.org.
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-lang.git

commit fc3f9c790f968f716d0ad2eb58dd178f448726b9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 26 07:23:48 2024 -0400

    Rename test method
---
 .../org/apache/commons/lang3/tuple/PairTest.java     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
index ad368a287..75e96550a 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
@@ -103,11 +103,6 @@ public class PairTest extends AbstractLangTest {
         assertNotEquals(pair.hashCode(), pair2.hashCode());
     }
 
-    @Test
-    public void testConcurrentHashMapEntry() {
-        testMapEntry(new ConcurrentHashMap<>());
-    }
-
     @Test
     public void testEmptyArrayGenerics() {
         final Pair<Integer, String>[] empty = Pair.emptyArray();
@@ -133,11 +128,6 @@ public class PairTest extends AbstractLangTest {
         assertEquals("(Key,Value)", String.format("%1$s", pair));
     }
 
-    @Test
-    public void testHashMapEntry() {
-        testMapEntry(new HashMap<>());
-    }
-
     private void testMapEntry(final Map<Integer, String> map) {
         map.put(0, "foo");
         final Entry<Integer, String> entry = map.entrySet().iterator().next();
@@ -155,6 +145,16 @@ public class PairTest extends AbstractLangTest {
         });
     }
 
+    @Test
+    public void testMapEntryConcurrentHashMap() {
+        testMapEntry(new ConcurrentHashMap<>());
+    }
+
+    @Test
+    public void testMapEntryHashMap() {
+        testMapEntry(new HashMap<>());
+    }
+
     @Test
     public void testOfNonNull() {
         assertThrows(NullPointerException.class, () -> Pair.ofNonNull(null, null));


(commons-lang) 02/03: Refactor map test in PairTest

Posted by gg...@apache.org.
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-lang.git

commit 9e4a50d4e4d5a8819cf0f2686b9d21d608948943
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 26 08:13:46 2024 -0400

    Refactor map test in PairTest
---
 .../org/apache/commons/lang3/tuple/PairTest.java   | 31 +++++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
index 75e96550a..ec7e22cbe 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
@@ -26,18 +26,29 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.TreeMap;
+import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.stream.Stream;
 
 import org.apache.commons.lang3.AbstractLangTest;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /**
  * Test the Pair class.
  */
 public class PairTest extends AbstractLangTest {
 
+    public static Stream<Class<? extends Map>> mapClassFactory() {
+        return Stream.of(ConcurrentHashMap.class, ConcurrentSkipListMap.class, HashMap.class, TreeMap.class, WeakHashMap.class, LinkedHashMap.class);
+    }
+
     @Test
     public void testAccept() {
         final Pair<String, String> pair1 = Pair.of("A", "D");
@@ -128,6 +139,16 @@ public class PairTest extends AbstractLangTest {
         assertEquals("(Key,Value)", String.format("%1$s", pair));
     }
 
+    @ParameterizedTest()
+    @MethodSource("org.apache.commons.lang3.tuple.PairTest#mapClassFactory()")
+    public <K, V> void testMapEntries(final Class<Map<Integer, String>> clazz) throws InstantiationException, IllegalAccessException {
+        testMapEntry(clazz.newInstance());
+    }
+
+    public <K, V> void testMapEntries(final Map<Integer, String> map) {
+        testMapEntry(map);
+    }
+
     private void testMapEntry(final Map<Integer, String> map) {
         map.put(0, "foo");
         final Entry<Integer, String> entry = map.entrySet().iterator().next();
@@ -145,16 +166,6 @@ public class PairTest extends AbstractLangTest {
         });
     }
 
-    @Test
-    public void testMapEntryConcurrentHashMap() {
-        testMapEntry(new ConcurrentHashMap<>());
-    }
-
-    @Test
-    public void testMapEntryHashMap() {
-        testMapEntry(new HashMap<>());
-    }
-
     @Test
     public void testOfNonNull() {
         assertThrows(NullPointerException.class, () -> Pair.ofNonNull(null, null));