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-beanutils.git
The following commit(s) were added to refs/heads/master by this push: new 2bd480de Test can reuse StringUtils.join(Iterable, String) new 21673137 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-beanutils.git 2bd480de is described below commit 2bd480de2c6e5dfecf7886d9b478ca3c70b22a61 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Dec 7 17:49:35 2024 -0500 Test can reuse StringUtils.join(Iterable, String) --- .../org/apache/commons/beanutils2/PropertyUtilsTest.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTest.java b/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTest.java index 298f9771..05471f52 100644 --- a/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTest.java +++ b/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTest.java @@ -36,10 +36,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeSet; import org.apache.commons.beanutils2.priv.PrivateBeanFactory; import org.apache.commons.beanutils2.priv.PrivateDirect; import org.apache.commons.beanutils2.priv.PublicSubBean; +import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -156,17 +158,8 @@ public class PropertyUtilsTest { * <p> * If there are no keys, an empty string is returned. */ - private String keysToString(final Map<?, ?> map) { - final Object[] mapKeys = map.keySet().toArray(); - Arrays.sort(mapKeys); - final StringBuilder buf = new StringBuilder(); - for (int i = 0; i < mapKeys.length; ++i) { - if (i != 0) { - buf.append(", "); - } - buf.append(mapKeys[i]); - } - return buf.toString(); + private String keysToString(final Map<String, ?> map) { + return StringUtils.join(new TreeSet<>(map.keySet()), ", "); } /**