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 2026/01/21 12:45:26 UTC

(commons-lang) branch master updated: Improve test coverage for TypeUtils.isAssignable (#1574)

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


The following commit(s) were added to refs/heads/master by this push:
     new 505acb8d1 Improve test coverage for TypeUtils.isAssignable (#1574)
505acb8d1 is described below

commit 505acb8d15c599b0da1500daa772fb2932df30a2
Author: Dhaneesh.M <85...@users.noreply.github.com>
AuthorDate: Wed Jan 21 18:15:21 2026 +0530

    Improve test coverage for TypeUtils.isAssignable (#1574)
    
    * [LANG-1812] Test: Expose and test TypeUtils.isAssignable to improve coverage
    
    * Refactor: Revert method visibility to private and test via public API
    
    * Fix: Checkstyle violations (final keywords and whitespace)
    
    * Clean up tests
    
    ---------
    
    Co-authored-by: Dhaneesh <dh...@gmail.com>
    Co-authored-by: Gary Gregory <ga...@users.noreply.github.com>
---
 .../apache/commons/lang3/reflect/TypeUtilsTest.java  | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index 5725f324a..ec62b70ff 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -1226,4 +1226,24 @@ void testWrap() {
         assertTrue(TypeUtils.equals(t, TypeUtils.wrap(t).getType()));
         assertEquals(String.class, TypeUtils.wrap(String.class).getType());
     }
+
+    @Test
+    public void testIsAssignable_Type_TypeVariable_Map_Public() throws Exception {
+        class Container<T> {
+        }
+        final TypeVariable<?> typeVarT = Container.class.getTypeParameters()[0];
+        final boolean result = TypeUtils.isAssignable(Integer.class, typeVarT);
+        assertFalse(result);
+    }
+
+    @Test
+    public void testIsAssignable_HiddenMapLogic() {
+        class Container<T> {
+        }
+        class StringContainer extends Container<String> {
+        }
+        final Type stringContainerType = StringContainer.class.getGenericSuperclass();
+        assertTrue(TypeUtils.isAssignable(StringContainer.class, Container.class));
+    }
+
 }