[GitHub] commons-lang pull request #392: LANG-1410: eliminate one unnecessary local i...
Github user rosti-il commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/392#discussion_r241744790 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -338,15 +338,17 @@ public static boolean isAllEmpty(final CharSequence... css) { * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) */ public static boolean isBlank(final CharSequence cs) { -int strLen; --- End diff -- Maybe, however 'strLen' sounds like something unchangeable, since String is immutable in Java. I've chosen this variable name to be the same to name of the similar 'sz' variable in isWhitespace() method. The 'sz' name stands for "size", I think. If we decide to change it we should change names of they both. ---
[GitHub] commons-lang pull request #392: LANG-1410: eliminate one unnecessary local i...
Github user asciborek commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/392#discussion_r241740720 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -338,15 +338,17 @@ public static boolean isAllEmpty(final CharSequence... css) { * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) */ public static boolean isBlank(final CharSequence cs) { -int strLen; --- End diff -- I think that name strLen is more informative ---
[GitHub] commons-lang pull request #392: LANG-1410: eliminate one unnecessary local i...
GitHub user rosti-il opened a pull request: https://github.com/apache/commons-lang/pull/392 LANG-1410: eliminate one unnecessary local int variable and add more tests You can merge this pull request into a Git repository by running: $ git pull https://github.com/rosti-il/commons-lang LANG-1410 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/392.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #392 commit 85ad50c5ed73d257c465bdbbd3da792768db3993 Author: Rostislav Krasny Date: 2018-12-08T00:14:35Z LANG-1410: eliminate one unnecessary local int variable and add more tests ---
[GitHub] commons-lang pull request #391: Adding junits for JsonToStringStyle
GitHub user RahulNagekar reopened a pull request: https://github.com/apache/commons-lang/pull/391 Adding junits for JsonToStringStyle You can merge this pull request into a Git repository by running: $ git pull https://github.com/RahulNagekar/commons-lang JsonToStringStyle_Junits Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/391.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #391 commit 45c096440785e00ade613aee2d7a2fef6f17ca8c Author: RahulNagekar Date: 2018-11-28T19:54:43Z Add additional tests for StandardToStringStyle (closes #390) commit 77bd11f0d69608829e26b2a6420561620df83941 Author: RahulNagekar Date: 2018-12-02T20:15:54Z Adding junits for JsonToStringStyle ---
[GitHub] commons-lang pull request #391: Adding junits for JsonToStringStyle
Github user RahulNagekar closed the pull request at: https://github.com/apache/commons-lang/pull/391 ---
[GitHub] commons-lang pull request #391: Adding junits for JsonToStringStyle
GitHub user RahulNagekar opened a pull request: https://github.com/apache/commons-lang/pull/391 Adding junits for JsonToStringStyle You can merge this pull request into a Git repository by running: $ git pull https://github.com/RahulNagekar/commons-lang JsonToStringStyle_Junits Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/391.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #391 commit 211a7c2031d70612ac859a3d046d819f1f9211bc Author: RahulNagekar Date: 2018-12-02T20:15:54Z Adding junits for JsonToStringStyle ---
[GitHub] commons-lang pull request #390: Adding junits for StandardToStringStyle
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/390 ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238078898 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = " " + * StringUtils.appendIfNotBlank(" ", "-post") = " -post" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc " + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not empty. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotEmpty(final String str, final String suffix) { +return isEmpty(str) ? EMPTY : str + defaultString(suffix); +} + +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = "" + * StringUtils.appendIfNotBlank(" ", "-post") = "" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc" --- End diff -- Needs correction ```suggestion * StringUtils.appendIfNotBlank("abc", " ") = "abc " ``` ---
[GitHub] commons-lang pull request #385: WIP: CheckedFunction utils
Github user asciborek closed the pull request at: https://github.com/apache/commons-lang/pull/385 ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055353 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = " " + * StringUtils.appendIfNotBlank(" ", "-post") = " -post" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc " + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not empty. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotEmpty(final String str, final String suffix) { +return isEmpty(str) ? EMPTY : str + defaultString(suffix); --- End diff -- ```suggestion return isEmpty(str) ? str : str + defaultString(suffix); ``` ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055373 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = " " + * StringUtils.appendIfNotBlank(" ", "-post") = " -post" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc " + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not empty. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotEmpty(final String str, final String suffix) { +return isEmpty(str) ? EMPTY : str + defaultString(suffix); +} + +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = "" + * StringUtils.appendIfNotBlank(" ", "-post") = "" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc" + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not blank. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotBlank(final String str, final String suffix) { +return isBlank(str) ? EMPTY : str + defaultString(suffix); --- End diff -- ```suggestion return isBlank(str) ? str : str + defaultString(suffix); ``` ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055284 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9109,6 +9162,56 @@ public static String prependIfMissingIgnoreCase(final String str, final CharSequ return prependIfMissing(str, prefix, true, prefixes); } +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotEmpty(null, " ") = "" --- End diff -- Shouldn't this be returning null instead as the name doesn't say anything about making the original string empty? ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055291 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9109,6 +9162,56 @@ public static String prependIfMissingIgnoreCase(final String str, final CharSequ return prependIfMissing(str, prefix, true, prefixes); } +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotEmpty(null, " ") = "" + * StringUtils.prependIfNotEmpty(null, "pre-") = "" + * StringUtils.prependIfNotEmpty("", "pre-")= "" + * StringUtils.prependIfNotEmpty(" ", " ") = " " + * StringUtils.prependIfNotEmpty(" ", "pre-") = "pre- " + * StringUtils.prependIfNotEmpty("abc", null) = "abc" + * StringUtils.prependIfNotEmpty("abc", "") = "abc" + * StringUtils.prependIfNotEmpty("abc", " ")= " abc" + * StringUtils.prependIfNotEmpty("abc", "pre-") = "pre-abc" + * + * @param str the String to check, may be null + * @param prefix the string to prepend if 'str' is not blank. Null will be converted to empty string. + * @return the passed in String with prefix added, or empty string + */ +public static String prependIfNotEmpty(final String str, final String prefix) { +return isEmpty(str) ? EMPTY : defaultString(prefix) + str; +} + +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotBlank(null, " ") = "" --- End diff -- Shouldn't this be returning null instead as the name doesn't say anything about making the original string empty? ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238054600 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = " " + * StringUtils.appendIfNotBlank(" ", "-post") = " -post" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc " + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not empty. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotEmpty(final String str, final String suffix) { +return isEmpty(str) ? EMPTY : str + defaultString(suffix); +} + +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" --- End diff -- Shouldn't this be returning null instead as the name doesn't say anything about making the original string empty? ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055393 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9109,6 +9162,56 @@ public static String prependIfMissingIgnoreCase(final String str, final CharSequ return prependIfMissing(str, prefix, true, prefixes); } +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotEmpty(null, " ") = "" + * StringUtils.prependIfNotEmpty(null, "pre-") = "" + * StringUtils.prependIfNotEmpty("", "pre-")= "" + * StringUtils.prependIfNotEmpty(" ", " ") = " " + * StringUtils.prependIfNotEmpty(" ", "pre-") = "pre- " + * StringUtils.prependIfNotEmpty("abc", null) = "abc" + * StringUtils.prependIfNotEmpty("abc", "") = "abc" + * StringUtils.prependIfNotEmpty("abc", " ")= " abc" + * StringUtils.prependIfNotEmpty("abc", "pre-") = "pre-abc" + * + * @param str the String to check, may be null + * @param prefix the string to prepend if 'str' is not blank. Null will be converted to empty string. + * @return the passed in String with prefix added, or empty string + */ +public static String prependIfNotEmpty(final String str, final String prefix) { +return isEmpty(str) ? EMPTY : defaultString(prefix) + str; +} + +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotBlank(null, " ") = "" + * StringUtils.prependIfNotBlank(null, "pre-") = "" + * StringUtils.prependIfNotBlank("", "pre-")= "" + * StringUtils.prependIfNotBlank(" ", " ") = "" + * StringUtils.prependIfNotBlank(" ", "pre-") = "" + * StringUtils.prependIfNotBlank("abc", null) = "abc" + * StringUtils.prependIfNotBlank("abc", "") = "abc" + * StringUtils.prependIfNotBlank("abc", " ")= "abc" + * StringUtils.prependIfNotBlank("abc", "pre-") = "pre-abc" + * + * @param str the String to check, may be null + * @param prefix the string to prepend if 'str' is not blank. Null will be converted to empty string. + * @return the passed in String with prefix added, or empty string + */ +public static String prependIfNotBlank(final String str, final String prefix) { +return isBlank(str) ? EMPTY : defaultString(prefix) + str; --- End diff -- ```suggestion return isBlank(str) ? str : defaultString(prefix) + str; ``` ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238054555 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = " " + * StringUtils.appendIfNotBlank(" ", "-post") = " -post" + * StringUtils.appendIfNotBlank("abc", null)= "abc" + * StringUtils.appendIfNotBlank("abc", "") = "abc" + * StringUtils.appendIfNotBlank("abc", " ") = "abc " + * StringUtils.appendIfNotBlank("abc", "-post") = "abc-post" + * + * @param str the String to check, may be null + * @param suffix the string to append if 'str' is not empty. Null will be converted to empty string. + * @return the passed in String with suffix added, or empty string + */ +public static String appendIfNotEmpty(final String str, final String suffix) { +return isEmpty(str) ? EMPTY : str + defaultString(suffix); +} + +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" + * StringUtils.appendIfNotBlank(null, "-post") = "" + * StringUtils.appendIfNotBlank("", "-post")= "" + * StringUtils.appendIfNotBlank(" ", " ") = "" --- End diff -- 9050 : The method behavior doesn't seem to be in sync with its name for this test case. Current behaviour : StringUtils.appendIfNotBlank(" ", "-post") = "" Behavior as per the name: StringUtils.appendIfNotBlank(" ", "-post") = " " May be should preserve the original string although if its blank. ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238055382 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9109,6 +9162,56 @@ public static String prependIfMissingIgnoreCase(final String str, final CharSequ return prependIfMissing(str, prefix, true, prefixes); } +/** + * Returns either the passed in String with the specified prefix attached, + * or if the String is whitespace/empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.prependIfNotEmpty(null, " ") = "" + * StringUtils.prependIfNotEmpty(null, "pre-") = "" + * StringUtils.prependIfNotEmpty("", "pre-")= "" + * StringUtils.prependIfNotEmpty(" ", " ") = " " + * StringUtils.prependIfNotEmpty(" ", "pre-") = "pre- " + * StringUtils.prependIfNotEmpty("abc", null) = "abc" + * StringUtils.prependIfNotEmpty("abc", "") = "abc" + * StringUtils.prependIfNotEmpty("abc", " ")= " abc" + * StringUtils.prependIfNotEmpty("abc", "pre-") = "pre-abc" + * + * @param str the String to check, may be null + * @param prefix the string to prepend if 'str' is not blank. Null will be converted to empty string. + * @return the passed in String with prefix added, or empty string + */ +public static String prependIfNotEmpty(final String str, final String prefix) { +return isEmpty(str) ? EMPTY : defaultString(prefix) + str; --- End diff -- ```suggestion return isEmpty(str) ? str : defaultString(prefix) + str; ``` ---
[GitHub] commons-lang pull request #278: Lang-1345 Enhance non-empty strings
Github user RahulNagekar commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/278#discussion_r238054315 --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java --- @@ -9008,6 +9011,56 @@ public static String appendIfMissingIgnoreCase(final String str, final CharSeque return appendIfMissing(str, suffix, true, suffixes); } +/** + * Returns either the passed in String with the specified suffix attached, + * or if the String is empty ("")/{@code null}, an empty string. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.appendIfNotBlank(null, " ") = "" --- End diff -- The javadoc needs an update to be in sync with the method name. ---
[GitHub] commons-lang pull request #390: Adding junits for StandardToStringStyle
GitHub user RahulNagekar opened a pull request: https://github.com/apache/commons-lang/pull/390 Adding junits for StandardToStringStyle You can merge this pull request into a Git repository by running: $ git pull https://github.com/RahulNagekar/commons-lang StandardToStringStyle_Junits Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/390.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #390 commit 727cf95fd218a00b8a27927a38ab5d6c2952840e Author: RahulNagekar Date: 2018-11-28T19:54:43Z Adding junits for StandardToStringStyle ---
[GitHub] commons-lang pull request #389: (doc) StandardToStringStyle removing unneces...
Github user RahulNagekar closed the pull request at: https://github.com/apache/commons-lang/pull/389 ---
[GitHub] commons-lang pull request #389: (doc) StandardToStringStyle removing unneces...
GitHub user RahulNagekar opened a pull request: https://github.com/apache/commons-lang/pull/389 (doc) StandardToStringStyle removing unnecessary method overrides You can merge this pull request into a Git repository by running: $ git pull https://github.com/RahulNagekar/commons-lang StandardToStringStyleCleanup Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/389.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #389 commit d030249259e122662e417133a67903c38babde87 Author: RahulNagekar Date: 2018-11-27T20:55:28Z (doc) StandardToStringStyle removing unnecessary method overrides ---
[GitHub] commons-lang pull request #385: WIP: CheckedFunction utils
Github user ajs6f commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/385#discussion_r236042692 --- Diff: src/test/java/org/apache/commons/lang3/function/CheckedFunctionTest.java --- @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.function.Function; + +public class CheckedFunctionTest { + +@DisplayName("unchecked should return a correctly working function") --- End diff -- This doesn't seem to test the interesting behavior of the code. There is no exception rethrown as a `RuntimeException`. Shouldn't that be happening? ---
[GitHub] commons-lang pull request #384: Travis: Stop building with Java 9 and 10, as...
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/384 ---
[GitHub] commons-lang pull request #385: WIP: CheckedFunction utils
GitHub user asciborek opened a pull request: https://github.com/apache/commons-lang/pull/385 WIP: CheckedFunction utils This is an example of utils which I would like to create. Purpose of interfaces like this is to simplify usage of java streams You can merge this pull request into a Git repository by running: $ git pull https://github.com/asciborek/commons-lang LANG_1424 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/385.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #385 commit e5c3f15b0505f3aec7e735932707afb084118695 Author: Aleksander Sciborek Date: 2018-11-18T21:25:52Z [LANG_1424] implement CheckedFunction - a counterpat of java.util.function.Function which throws a checked exception in apply method ---
[GitHub] commons-lang pull request #384: Travis: Stop building with Java 9 and 10, as...
GitHub user PascalSchumacher opened a pull request: https://github.com/apache/commons-lang/pull/384 Travis: Stop building with Java 9 and 10, as these are superseded by ⦠â¦Java 11 and not supported anymore. You can merge this pull request into a Git repository by running: $ git pull https://github.com/PascalSchumacher/commons-lang travis_drop_java9_and_10 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/384.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #384 commit c035de97504a9ba721e5617584e08f1b1f66d455 Author: pascalschumacher Date: 2018-11-20T17:42:57Z Travis: Stop building with Java 9 and 10, as these are superseded by Java 11 and not supported anymore. ---
[GitHub] commons-lang pull request #383: Make whitespace use consistent and add check...
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/383 ---
[GitHub] commons-lang pull request #345: add jvmLaunchers
Github user harbby closed the pull request at: https://github.com/apache/commons-lang/pull/345 ---
[GitHub] commons-lang pull request #383: Make whitespace use after tokens consistent ...
GitHub user PascalSchumacher opened a pull request: https://github.com/apache/commons-lang/pull/383 Make whitespace use after tokens consistent and add checkstyle rule t⦠â¦o enforce it. You can merge this pull request into a Git repository by running: $ git pull https://github.com/PascalSchumacher/commons-lang consistent_whitespace_after_formatting Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/383.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #383 commit 869a26c5e71256e16b51727e717150ba4c5e8dfb Author: pascalschumacher Date: 2018-11-18T10:59:34Z Make whitespace use after tokens consistent and add checkstyle rule to enforce it. ---
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
Github user Turan91 commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/362#discussion_r234053572 --- Diff: src/test/java/org/apache/commons/lang3/StringUtilsTest.java --- @@ -1592,6 +1592,12 @@ public void testRepeat_StringInt() { final String str = StringUtils.repeat("a", 1); // bigger than pad limit assertEquals(1, str.length()); assertTrue(StringUtils.containsOnly(str, 'a')); +try { +StringUtils.repeat("aaa",Integer.MAX_VALUE); --- End diff -- Good spot. Thanks ---
[GitHub] commons-lang pull request #382: Proposal: Duration Utils - round value of th...
GitHub user asciborek opened a pull request: https://github.com/apache/commons-lang/pull/382 Proposal: Duration Utils - round value of the duration in a given unit For instance, in case of duration equals 90 minuts, the method roundHoursQuantity should return 2 (hours), and in case of duration 60 minutes and 1 second roundUpHoursQuantity should return also 2 (hours) You can merge this pull request into a Git repository by running: $ git pull https://github.com/asciborek/commons-lang LANG_1407 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/382.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #382 commit 386a432b6df51a953161c38c4c50e5cd8d9c86b4 Author: Aleksander Sciborek Date: 2018-11-15T20:21:19Z [LANG-1407] implement DurationUtils with methods for rounding value of Duration in a given unit of time ---
[GitHub] commons-lang pull request #377: LANG_1407 add DurationUtils
Github user asciborek closed the pull request at: https://github.com/apache/commons-lang/pull/377 ---
[GitHub] commons-lang pull request #381: LANG-1406 StringIndexOutOfBoundsException in...
GitHub user drajakumar opened a pull request: https://github.com/apache/commons-lang/pull/381 LANG-1406 StringIndexOutOfBoundsException in StringUtils.replaceIgnor⦠â¦eCase You can merge this pull request into a Git repository by running: $ git pull https://github.com/drajakumar/commons-lang master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/381.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #381 commit 77ad336da790dc522216300bfb20d74b779a9d62 Author: Don Jeba Date: 2018-11-15T19:31:23Z LANG-1406 StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase ---
[GitHub] commons-lang pull request #380: fix javadoc typo
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/380 ---
[GitHub] commons-lang pull request #380: fix javadoc typo
GitHub user oorijsonar opened a pull request: https://github.com/apache/commons-lang/pull/380 fix javadoc typo You can merge this pull request into a Git repository by running: $ git pull https://github.com/oorijsonar/commons-lang fix_javadoc_typo Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/380.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #380 commit e1618fa2327967562c6af0848c8d5873e0040542 Author: Uri Date: 2018-11-02T23:48:04Z fix javadoc typo ---
[GitHub] commons-lang pull request #378: add more test cases to use ImmutablePair cla...
Github user apirom9 closed the pull request at: https://github.com/apache/commons-lang/pull/378 ---
[GitHub] commons-lang pull request #379: add tests for use ImmutableTriple as key in ...
GitHub user apirom9 opened a pull request: https://github.com/apache/commons-lang/pull/379 add tests for use ImmutableTriple as key in java.util.HashMap and java.util.TreeMap add tests for use ImmutableTriple as key in java.util.HashMap and java.util.TreeMap You can merge this pull request into a Git repository by running: $ git pull https://github.com/apirom9/commons-lang tasks/add-tests-for-immutable-triple Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/379.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #379 commit e4e92570188763170f9291f62cd388e7e5b9d119 Author: Apirom Na Nakorn Date: 2018-10-30T15:28:31Z add test use ImmutablePair class with java.util.HashMap and java.util.TreeMap commit 093fcf5eb346f0c02410fe2cd14d3c5aa494c3a0 Author: Apirom Na Nakorn Date: 2018-10-30T15:41:40Z format code correctly based on error from Travis CI commit 14f09339452883d0ceb70e8b1b2c82fe80660fe6 Author: Apirom Na Nakorn Date: 2018-10-30T15:42:41Z Remove unused space commit ae30de532507099132911e3952ad8e2568d3b219 Author: Apirom Na Nakorn Date: 2018-10-30T15:53:53Z add test use ImmutableTriple class with java.util.HashMap and java.util.TreeMap commit 29937f04c6de046ca3456305cdaece81a913b73b Author: Apirom Na Nakorn Date: 2018-10-30T15:56:06Z Remove unused space ---
[GitHub] commons-lang pull request #378: add more test cases to use ImmutablePair cla...
GitHub user apirom9 opened a pull request: https://github.com/apache/commons-lang/pull/378 add more test cases to use ImmutablePair class as key for java.util.HashMap and java.util⦠â¦.TreeMap You can merge this pull request into a Git repository by running: $ git pull https://github.com/apirom9/commons-lang master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/378.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #378 commit e4e92570188763170f9291f62cd388e7e5b9d119 Author: Apirom Na Nakorn Date: 2018-10-30T15:28:31Z add test use ImmutablePair class with java.util.HashMap and java.util.TreeMap ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r228178951 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package --- End diff -- I have committed changes for this ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r228178841 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor --- End diff -- I have committed changes for this ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r228178901 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package --- End diff -- I have committed changes for this ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r228140306 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws NullPointerException if desiredBase or url are null + * @throws URISyntaxException if the generated url can't be converted to a URI + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws IllegalArgumentException, IOException, NullPointerException, URISyntaxException { + +Objects.requireNonNull(desiredBase, "desiredBase must not be null"); + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +Objects.requireNonNull(url, "supplied package not found"); + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() +try { +Object obj = Class.forName(fullClassName).newInstance(); --- End diff -- To confirm that the class can actually be instantiated via the default constructor. Notice the Exception comment and the comment above "try {" ---
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
Github user aaabramov commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/362#discussion_r226915778 --- Diff: src/test/java/org/apache/commons/lang3/StringUtilsTest.java --- @@ -1592,6 +1592,12 @@ public void testRepeat_StringInt() { final String str = StringUtils.repeat("a", 1); // bigger than pad limit assertEquals(1, str.length()); assertTrue(StringUtils.containsOnly(str, 'a')); +try { +StringUtils.repeat("aaa",Integer.MAX_VALUE); --- End diff -- Missing space between parameters ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user aaabramov commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r226900275 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package --- End diff -- I believe it would be better with dots in the end of sentence. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user aaabramov commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r226900283 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor --- End diff -- This line could be improved. At least, interfaces has no constructors. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user aaabramov commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r226899975 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package --- End diff -- I believe it would be better with dots in the end of sentence. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user aaabramov commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r226900323 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1067,62 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws NullPointerException if desiredBase or url are null + * @throws URISyntaxException if the generated url can't be converted to a URI + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws IllegalArgumentException, IOException, NullPointerException, URISyntaxException { + +Objects.requireNonNull(desiredBase, "desiredBase must not be null"); + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +Objects.requireNonNull(url, "supplied package not found"); + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() +try { +Object obj = Class.forName(fullClassName).newInstance(); --- End diff -- Why do we need to call `newInstance()` on `Class` if we return just `List>`? ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225537457 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); --- End diff -- This is a good idea but the Objects under test are hard to verify...I believe the getBaseClasses() will fail if the Objects returned are invalid. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225537382 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); +} + +@Test +public void testGetBaseClassesAbstract() throws Exception { +List classes = ClassUtils.getBaseClasses(AbstractConcurrentInitializerTest.class, "org.apache.commons.lang3.concurrent"); +assertTrue(classes.size() > 0); --- End diff -- This is a good idea but the Objects under test are hard to verify...I believe the getBaseClasses() will fail if the Objects returned are invalid. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225522003 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { --- End diff -- On 2nd thoughts, think I'll just take out "packageName.contains('/')". The packageName will be checked below that call. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225509052 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { --- End diff -- Will do ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225508989 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { --- End diff -- Will do ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225508754 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); --- End diff -- This is a good idea ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225508801 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); +} + +@Test +public void testGetBaseClassesAbstract() throws Exception { +List classes = ClassUtils.getBaseClasses(AbstractConcurrentInitializerTest.class, "org.apache.commons.lang3.concurrent"); +assertTrue(classes.size() > 0); --- End diff -- This is a good idea ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user grimreaper commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225309090 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { --- End diff -- Prefer Objects.requireNonNull instead of explicit `if` checks. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225283052 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { +throw new IllegalArgumentException("packageName is not properly formatted (i.e. 'java.lang.String')"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +if (url == null) { +throw new URISyntaxException(packageName, "Supplied package not found"); +} + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() +try { +Object obj = Class.forName(fullClassName).newInstance(); +if (desiredBase.isInstance(obj)) { --- End diff -- instanceof and isInstance() are the same. You use instanceof when you know the actual class type which, in this case, is unknown. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user zmacomber commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225282462 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { +throw new IllegalArgumentException("packageName is not properly formatted (i.e. 'java.lang.String')"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +if (url == null) { +throw new URISyntaxException(packageName, "Supplied package not found"); +} + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() --- End diff -- The JavaDoc explicitly states that only classes that can be instantiated via a default ctor can be used: "This method only retrieves base classes/interfaces that have children that can be instantiated via a no-args constructor" If the class can't be instantiated, an Exception is thrown and it won't be added to the list of returned classes: ``` catch (Exception e) { // Class was not instantiable via newInstance() } ``` ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user sudeendra-nadager commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225264987 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); +} + +@Test +public void testGetBaseClassesAbstract() throws Exception { +List classes = ClassUtils.getBaseClasses(AbstractConcurrentInitializerTest.class, "org.apache.commons.lang3.concurrent"); +assertTrue(classes.size() > 0); --- End diff -- should validate each element of the container for better accuracy. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user sudeendra-nadager commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225264946 --- Diff: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java --- @@ -1202,6 +1206,56 @@ public void testGetInnerClass() throws ClassNotFoundException { assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) ); } +@Test +public void testGetBaseClassesExtends() throws Exception { +List classes = ClassUtils.getBaseClasses(AnotherParent.class, "org.apache.commons.lang3.reflect.testbed"); +assertTrue(classes.size() > 0); --- End diff -- should validate each element of the container for better accuracy. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user sudeendra-nadager commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225264152 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { +throw new IllegalArgumentException("packageName is not properly formatted (i.e. 'java.lang.String')"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +if (url == null) { +throw new URISyntaxException(packageName, "Supplied package not found"); +} + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() +try { +Object obj = Class.forName(fullClassName).newInstance(); +if (desiredBase.isInstance(obj)) { --- End diff -- IMO - use of instanceof operator is preferred over method call. ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user sudeendra-nadager commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225263720 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { +throw new IllegalArgumentException("packageName is not properly formatted (i.e. 'java.lang.String')"); +} + +ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); +if (url == null) { +throw new URISyntaxException(packageName, "Supplied package not found"); +} + +Path classesPath = Paths.get(url.toURI()); + +List classes = new ArrayList<>(); + +try (DirectoryStream stream = Files.newDirectoryStream(classesPath)) { +for (Path file: stream) { +Path pathFileName = file.getFileName(); +if (( ! Files.isDirectory(file)) && (pathFileName != null)) { +String fullClassName = packageName + "." + + pathFileName.toString().replace(".class", ""); + +// Only add classes that can be instantiated via newInstance() --- End diff -- what if the derived class does not provide default ctor? ---
[GitHub] commons-lang pull request #358: ClassUtils.getBaseClasses(desiredBase, packa...
Github user sudeendra-nadager commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/358#discussion_r225263101 --- Diff: src/main/java/org/apache/commons/lang3/ClassUtils.java --- @@ -1059,6 +1066,69 @@ public static boolean isInnerClass(final Class cls) { return getClass(loader, className, initialize); } +/** + * Returns a list of base classes/interfaces underneath the supplied package + * This method only retrieves base classes/interfaces that have children that can be instantiated + * via a no-args constructor + * The class loader is retrieved via Thread.currentThread().getContextClassLoader() + * This only retrieves base classes/interfaces directly underneath the supplied package + * + * @param desiredBase the desired base class/interface to retrieve + * @param packageName the package name in the standard import format (i.e. "java.lang.String") + * @param The desired base class or interface type to retrieve + * @return a list of base classes/interfaces that match the supplied type underneath the supplied package + * @throws URISyntaxException if the packageName is not found in the class loader + * @throws IOException if an I/O error occurs in getting a new directory stream + * @throws IllegalArgumentException if the desiredBase or packageName are invalid + */ +public static List getBaseClasses(final Class desiredBase, final String packageName) +throws URISyntaxException, IOException, IllegalArgumentException { + +if (desiredBase == null) { +throw new IllegalArgumentException("desiredBase must not be null"); +} + +if (StringUtils.isBlank(packageName)) { +throw new IllegalArgumentException("packageName must not be blank"); +} + +if (packageName.contains("/")) { --- End diff -- might be better to validate against a regex. ---
[GitHub] commons-lang pull request #377: LANG_1407 add DurationUtils
GitHub user asciborek opened a pull request: https://github.com/apache/commons-lang/pull/377 LANG_1407 add DurationUtils I've added an util class with methods for rounding duration You can merge this pull request into a Git repository by running: $ git pull https://github.com/asciborek/commons-lang LANG_1407 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/377.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #377 commit ad8d7b5b1d95ce66a4604bb7d8d3ee9ce1d8aa02 Author: Aleksander Sciborek Date: 2018-10-06T14:23:43Z [LANG_1407] Add methods to round quantitity of days from Duration commit 4972d816402cd31cb3e5ea850e7880b9f51ee614 Author: Aleksander Sciborek Date: 2018-10-07T14:52:50Z [LANG_1407] add methods to round quantity of hours from Duration instance commit cd2ca5c5e50efa12e03beb07f79cab31aa4fd6ce Author: Aleksander Sciborek Date: 2018-10-08T16:27:32Z [LANG_1407] add methods to round quantity of minutes from Duration instance commit 8363fd7a2b0233dd1e2f686be30b7983c9fedc55 Author: Aleksander Sciborek Date: 2018-10-10T10:54:41Z [LANG_1407] implement methods to round the quantity of seconds from the given duration commit 607cc3a68e4ac529848f2f80741800bcc30e199f Author: Aleksander Sciborek Date: 2018-10-11T21:23:16Z [LANG_1407] add methods to round the quantity of millisecon from the Duration instance commit 8b43fb4de1cfd35cc576807533536a8a7465d666 Author: Aleksander Sciborek Date: 2018-10-14T17:05:51Z [LANG_1407] add the license headers to DurationUtils and DurationUtilsTests ---
[GitHub] commons-lang pull request #376: Test cleanup
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/376 ---
[GitHub] commons-lang pull request #376: Test cleanup
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/376 Test cleanup Following up after the migration of the test suite to JUnit Jupiter, some test code could be cleaned up to make it clearer and easier to maintain. This PR contains several patches around that area: General fixes: - In order to test an expected exception, `assertThrows` was used instead of a cumbersome `if`-`fail`-`catch` construct. - In order to fail a test on an unexpected exception, the exception is thrown outside the method, instead of the cumbersome construct of catching it and calling `fail` - Redundant `throws` clauses were removed - `assertEquals`, `assertNotEquals`, `assertSame`, `assertNotSame`, `assertNull` and `assertNotNull` were used instead of reimplementing them with conditions in `if` statements or `assertTrue`s. Specific improvements: - `ConverstionTest#assertBinaryEquals` was removed in favor of the built-in `Assertions#assertArraysEquals(boolean[], boolean[])`. - `LocaleUtilsTest#parseAllLocales` was rewritten as a parameterized test instead of implementing it manually with a loop. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang test-cleanup Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/376.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #376 commit c9ee985fce7d14d673d9b6bace824560eb4d40fc Author: Allon Mureinik Date: 2018-10-12T15:12:34Z Remove ConversionTest#assertBinaryEquals JUnit Jupiter's Assertions has an assertArraysEuqals(boolean[], boolean[]) method, so there's no longer a need for the assertBinaryEquals method. commit cf44c603b105f154b6b57604fe9abd589b7dbd2b Author: Allon Mureinik Date: 2018-10-12T16:14:01Z Make LocaleUtilsTest#parseAllLocales parameterized This patch converts testParseAllLocales to a @ParameterizedTest instead of iterating over the locales inside the method's body. This changes allows using standard asserts for each case individually instead of having to count failures and print the problematic locales to System.out. commit 15daf92088ad6d8868cd157ca9666721a59ce705 Author: Allon Mureinik Date: 2018-10-13T14:16:54Z Remove double stop() test in StopWatchTest StopWatchTest#testBadStates has the same block of code testing StopWatch#stop copy-pasted. This patch cleans it up by removing one of those blocks. commit 8507e5c81a8d3fedc655c02c93d4cf9dd4418ff6 Author: Allon Mureinik Date: 2018-10-13T14:08:48Z Clean up testing of exceptions Now that the entire project is ported to JUnit Jupiter, there are more elegant ways to test for exceptions, which this patch applies throughtout the code base. If throwing an exception is supposed to fail a test, just throwing it outside of the method cleans up the code and makes it more elegant, instead of catching it and calling Assertions#fail. If an exception is supposed to be thrown, calling Assertions#assertThrows is a more elegant option than calling Assertions#fail in the try block and then catching and ignoring the expected exception. Note that assertThrows uses a lambda block, so the variables inside it should be final or effectively final. Reusing variables is a common practice in the tests, so where needed new final variables were introduced, or the variables used were inlined. commit 3c6141d401233176d2e424640bffe0369592349e Author: Allon Mureinik Date: 2018-10-13T16:38:01Z Use assertTrue/assertFalse instead of reimplementing them Use assertTrue and assertFalse instead of reimplemeting their logic by having an if statement conditionalling call fail. commit 8ee1a558b821f28313b8b538b5d4b0de1b0e7044 Author: Allon Mureinik Date: 2018-10-13T16:49:52Z Clean up redundant throws clauses commit 591bebc111bca4f0681560b70fcc3d20cda40577 Author: Allon Mureinik Date: 2018-10-13T17:05:40Z Clean up assertions Use built-in assertion methods provides by org.junit.jupiter.api.Assertions instead of reimplementing the same logic with assertTrue and assertFalse. Note that JUnit Jupiter 5.3.1 does not support deltas of 0 for assertEquals(double, double, double) and assertEquals(float, float, float), so these usages of assertTrue were left untouched, and will be addressed when JUnit Jupiter 5.4, that addresses this isssue, will be available (see https://github.com/junit-team/junit5/pull/1613 for details). ---
[GitHub] commons-lang pull request #375: JUnit Jupiter migration completion
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/375 ---
[GitHub] commons-lang pull request #375: JUnit Jupiter migration completion
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/375 JUnit Jupiter migration completion This patch finalizes the upgrade of commons-lang's tests to use JUnit Jupiter and removes the Vintage Engine dependency entirely. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Assert.assertEquals(double, double, double)`, `org.junit.jupiter.api.Assertions.assertEquals(double, double, double)` does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, `assertTrue(expected==actual)` was used, and `TODO` comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have a `timeout` argument either. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertTimeoutPreemptively` is used. JUnit Jupiter also no longer has the concept of Rules. Usages of the `SystemDefaultsSwitch` rule and its accompanying annotates were replaced with the `@DefaultLocale` annotation that @britter contributed to JUnit Pioneer, the semi-official JUnit extension project, or simply removed entirely where they had no use (i.e., from `StringUtilsEqulasIndexOfTest`). Following the removal of their usages, the `@SystemDefaults` annotation, the `SystemDefaultsSwitch` rule and the `SystemDefaultsSwitchTest` class that tests them had no more use, and they were removed entirely. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/375.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #375 commit 57fbe7e96eec45507dcbe030c3d9ea975f33342f Author: Allon Mureinik Date: 2018-10-11T13:21:52Z StringUtilsEqulasIndexOfTest @Rules Commit 0223a4 removed all the usages of @SystemDefaults annotations from this test, but left behind a pointless SystemDefaultsSwitch rule. This patch finishes the job and removes this unused rule. commit 9a3e1d743bc4c8563cf71c521b4d392e302dfbc6 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update tests to JUnit Jupiter This patch finalizes the upgrade of commons-lang's tests to use JUnit Jupiter and remove the Vintage Engine dependency entirely. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Assert.assertEquals(double, double, double), org.junit.jupiter.api.Assertions.assertEquals(double, double, double) does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, assertTrue(expected==actual) was used, and TODO comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have a "timeout" argument either. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertTimeoutPreemptively is used. JUnit Jupiter also no longer has the concept of Rules. Usages of the SystemDefaultsSwitch rule and its accompanying annotates were replaced with the @DefaultLocale annotation that Benedikt Ritter contributed to JUnit Pioneer, the semi-official JUnit extension project. Following the removal of their usages, the SystemDefaults annotation, the SystemDefaultsSwitch rule and the SystemDefaultsSwitchTest class that tests them had no more use, and they were removed entirely. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches.
[GitHub] commons-lang pull request #374: Update time tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/374 ---
[GitHub] commons-lang pull request #374: Update time tests to JUnit Jupiter
Github user mureinik commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/374#discussion_r224144394 --- Diff: pom.xml --- @@ -543,6 +543,11 @@ junit-vintage-engine test + + org.junit-pioneer + junit-pioneer + 0.2.0 --- End diff -- Good catch, thanks. ---
[GitHub] commons-lang pull request #374: Update time tests to JUnit Jupiter
Github user PascalSchumacher commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/374#discussion_r224137193 --- Diff: pom.xml --- @@ -543,6 +543,11 @@ junit-vintage-engine test + + org.junit-pioneer + junit-pioneer + 0.2.0 --- End diff -- This dependency should have `test` scope. ---
[GitHub] commons-lang pull request #374: Update time tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/374 Update time tests to JUnit Jupiter Upgrade the tests in the `time` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. JUnit Jupiter no longer has a concept of runners. Tests previously run with the `org.junit.runners.Parameterized` runner were rewritten to use `@ParameterizedTest` and a `@MethodSource`. JUnit Jupiter also no longer has the concept of Rules. Usages of the `SystemDefaultsSwitch` rule and its accompanying annotates were replaced with the `@DefaultLocale` and `@DefaultTimezone` annotations that @britter contributed to [JUnit Pioneer](https://github.com/junit-pioneer/junit-pioneer), the semi-official JUnit extension project. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-time Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/374.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #374 commit 74a18ce4c6ff7e7f5db9ed788d5f4999f7213cfe Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update time tests to JUnit Jupiter Upgrade the tests in the time package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. JUnit Jupiter no longer has a concept of runners. Tests previously run with the org.junit.runners.Parameterized runner were rewritten to use @ParameterizedTest and a @MethodSource. JUnit Jupiter also no longer has the concept of Rules. Usages of the SystemDefaultsSwitch rule and its accompanying annotates were replaced with the @DefaultLocale and @DefaultTimezone annotations that Benedikt Ritter contributed to JUnit Pioneer, the semi-official JUnit extension project. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #373: Update mutable tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/373 ---
[GitHub] commons-lang pull request #373: Update mutable tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/373 Update mutable tests to JUnit Jupiter Upgrade the tests in the `mutable` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. Unlike `org.junit.Assert.assertEquals(double, double, double)`, `org.junit.jupiter.api.Assertions.assertEquals(double, double, double)` does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, `assertTrue(expected==actual)` was used, and `TODO` comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-mutable Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/373.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #373 commit 94beded83960af2a15992f6cec8f1f59d1f3c051 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update mutable tests to JUnit Jupiter Upgrade the tests in the mutable package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. Unlike org.junit.Assert.assertEquals(double, double, double), org.junit.jupiter.api.Assertions.assertEquals(double, double, double) does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, assertTrue(expected==actual) was used, and TODO comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #372: Update math tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/372 ---
[GitHub] commons-lang pull request #372: Update math tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/372 Update math tests to JUnit Jupiter Upgrade the tests in the `math` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. Unlike `org.junit.Assert.assertEquals(double, double, double)`, `org.junit.jupiter.api.Assertions.assertEquals(double, double, double)` does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, `assertTrue(expected==actual)` was used, and `TODO` comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-math Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/372.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #372 commit 47a9ea7c828772625b9e26c0c7a6db494ea626a3 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update math tests to JUnit Jupiter Upgrade the tests in the math package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. Unlike org.junit.Assert.assertEquals(double, double, double), org.junit.jupiter.api.Assertions.assertEquals(double, double, double) does not support deltas of zero, only strictly positive deltas. This issue will be addressed in JUnit Jupiter 5.4 (see https://github.com/junit-team/junit5/pull/1613 for details). In the meanwhile, assertTrue(expected==actual) was used, and TODO comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #371: Update tuple tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/371 ---
[GitHub] commons-lang pull request #371: Update tuple tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/371 Update tuple tests to JUnit Jupiter Upgrade the tests in the text package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-tuple Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/371.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #371 commit f110da945a8af0914f348cfe576b5a8257159fd9 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update tuple tests to JUnit Jupiter Upgrade the tests in the text package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. ---
[GitHub] commons-lang pull request #370: Update text tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/370 ---
[GitHub] commons-lang pull request #370: Update text tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/370 Update text tests to JUnit Jupiter Upgrade the tests in the `text` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-text Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/370.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #370 commit 182e335432fe4634d770c5861be40dacf1816f0c Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update text tests to JUnit Jupiter Upgrade the tests in the text package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #369: Update reflect tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/369 ---
[GitHub] commons-lang pull request #369: Update reflect tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/369 Update reflect tests to JUnit Jupiter Upgrade the tests in the `reflect` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. Unlike `org.junit.Assume`, `org.junit.jupiter.api.Assumptions` does not have an `assumeNotNull` method. Instead, `assumeTrue` was used with an explicit condition of a variable being different than `null`. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-reflect Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/369.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #369 commit cbc8e0b2952164f97779c9a5fadca6acd2600ae2 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update reflect tests to JUnit Jupiter Upgrade the tests in the reflect package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. Unlike org.junit.Assume, org.junit.jupiter.api.Assumptions does not have an assumtNotNull method. Instead, assumeTrue was used with an explicit condition of a variable being different than null. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #368: Update exception tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/368 ---
[GitHub] commons-lang pull request #368: Update exception tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/368 Update exception tests to JUnit Jupiter Upgrade the tests in the `exception` package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. Another non-obvious change was performed in `ContextedRuntimeExceptionTest`. Unlike JUnit Vintage's `@Before`, JUnit Jupiter's `@BeforeEach` does not apply if a parent's method is annotated with it and the overriding method is not, so an explicit `@BeforeEach` annotation had to be added to `ContexedTuntimeExceptionTest#setUp()`. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-exception Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/368.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #368 commit 884d273f4207095f881167b3398fc2a55617ee9a Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update exception tests to JUnit Jupiter Upgrade the tests in the exception package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. Another non-obvious change was performed in ContextedRuntimeExceptionTest. Unlike JUnit Vintages's @Before, JUnit Jupiter's @BeforeEach does not apply if a parent's method is annotated with it and the overriding method is not, so an explicit @BeforeEach annotation had to be added to ContexedTuntimeExceptionTest#setUp(). It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #367: Update event tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/367 ---
[GitHub] commons-lang pull request #367: Update event tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/367 Update event tests to JUnit Jupiter Upgrade the tests in the event package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, it is worth noting the tests that test thrown exceptions. Prior to this patch, this package tested for exceptions in two ways, neither of which are supported in JUnit Jupiter: 1. With the `expected` argument of the `org.junit.Test` annotation. 2. With the `org.junit.rules.ExpectedException` `@Rule` Both of these usages were replaced with calls to `org.junit.jupiter.api.Assertions#assertThrows`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-event Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/367.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #367 commit 762641dcdbae9456aa2b72ec8fa1baa0acab942f Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update event tests to JUnit Jupiter Upgrade the tests in the event package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, it is worth noting the tests that test thrown excetpions. Prior to this patch, this package tested for exceptions in two ways, neither of which are supported in JUnit Jupiter: 1. With the "expected" argument of the org.junit.Test annotation. 2. With the org.junit.rules.ExpectedException @Rule Both of these usages were replaced with calls to org.junit.jupiter.api.Assertions#assertThrows. ---
[GitHub] commons-lang pull request #366: Update concurrent tests to JUnit Jupiter
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/366 ---
[GitHub] commons-lang pull request #366: Update concurrent tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/366 Update concurrent tests to JUnit Jupiter Upgrade the tests in the concurrent package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. This call allows the test to pinpoint the exact statement that is expected to throw the exception and allows making the tests a bit stricter by preventing false-positives that could occur if the setup code would throw the expected exception instead of the statement that was supposed to throw it. Another notable change was performed in `MemoizerTest`. JUnit Jupiter does not support JUnit 4's runners, and EasyMock has no equivalent `@Extension`, so a setup method was added and the mock was explicitly initialized. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter-concurrent Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/366.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #366 commit dd761382d3cfdc11b5de0cb1246de4567cdf2fc2 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update concurrent tests to JUnit Jupiter Upgrade the tests in the concurrent package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. This call allows the test to pinpoint the exact statement that is expected to throw the exception and allows making the tests a bit stricter by preventing false-positives that could occur if the setup code would throw the expected exception instead of the statement that was supposed to throw it. Another notable change was performed in MemoizerTest. JUnit Jupiter does not support JUnit 4's runners, and EasyMock has no equivalent @Extension, so a setup method was added and the mock was explicitly initialized. It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made made more elegant with Jupiter's new features, but that work is left for subsequent patches. ---
[GitHub] commons-lang pull request #365: Travis: Also build with openjdk-ea
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/365 ---
[GitHub] commons-lang pull request #365: Travis: Also build with openjdk-ea
GitHub user PascalSchumacher opened a pull request: https://github.com/apache/commons-lang/pull/365 Travis: Also build with openjdk-ea You can merge this pull request into a Git repository by running: $ git pull https://github.com/PascalSchumacher/commons-lang travis_openjdk_ea Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/365.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #365 commit a3a1904e5964a97a20d5132569beb2901d2cd919 Author: pascalschumacher Date: 2018-10-06T08:30:32Z Travis: Also build with openjdk-ea ---
[GitHub] commons-lang pull request #363: Update builder tests to JUnit Jupiter
Github user mureinik closed the pull request at: https://github.com/apache/commons-lang/pull/363 ---
[GitHub] commons-lang pull request #359: these 2 links seem to be broken
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/359 ---
[GitHub] commons-lang pull request #364: LANG_1407 Duration Utils
Github user asciborek closed the pull request at: https://github.com/apache/commons-lang/pull/364 ---
[GitHub] commons-lang pull request #364: Lang 1407
GitHub user asciborek opened a pull request: https://github.com/apache/commons-lang/pull/364 Lang 1407 You can merge this pull request into a Git repository by running: $ git pull https://github.com/asciborek/commons-lang LANG_1407 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/364.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #364 commit 2ccdca97268df1b9d4cd78f4331eafab2952618b Author: Aleksander Sciborek Date: 2018-09-25T20:06:29Z [LANG_1407] implement methods to round quantity of hours of duration instance commit 443d8a85ee8d5a023e49bdef59519c677b979298 Author: Aleksander Sciborek Date: 2018-09-26T15:22:00Z [LANG_1407] implement methods to round the quantity of minutes of duration instance commit 8cadd675f718a11bfb988ae3e20dd625d07d6bf3 Author: Aleksander Sciborek Date: 2018-09-27T00:25:21Z [LANG_1407] implement methods to round the quantity of seconds of duration instance commit c21c5a107b912635436861b7be6763dc1a82b42f Author: Aleksander Sciborek Date: 2018-09-27T15:50:33Z [LANG_1407] implements methods to round the quantity of days of duration instance ---
[GitHub] commons-lang pull request #360: Lang 1407
Github user asciborek closed the pull request at: https://github.com/apache/commons-lang/pull/360 ---
[GitHub] commons-lang pull request #363: Update builder tests to JUnit Jupiter
GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/363 Update builder tests to JUnit Jupiter Upgrade the tests in the builder package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, it is worth mentioning the change to how expected exceptions are tested. Unlike `org.junit.Test`, `org.junit.jupiter.api.Test` does not have an `expected` argument. Instead, an explicit call to `org.junit.jupiter.api.Assertions.assertThrows` is used. This call allows the test to pinpoint the exact statement that is expected to throw the exception and allows making the tests a bit stricter by preventing false-positives that could occur if the setup code would throw the expected exception instead of the statement that was supposed to throw it. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang junit-jupiter Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/363.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #363 commit 0c320dfc356b78145107a4b121d674dbccb84437 Author: Allon Mureinik Date: 2018-10-02T03:41:37Z Update builder tests to JUnit Jupiter Upgrade the tests in the builder package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine. While most of these changes are drop-in replacements with no functional benefit, it is worth mentioning the change to how expected exceptions are tested. Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an "expected" argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used. This call allows the test to pinpoint the exact statement that is expected to throw the expcetion and allows making the tests a bit stricter by preventing false-positives that could occur if the setup code would throw the expected exception instead of the statement that was supposed to throw it. ---
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
GitHub user Turan91 opened a pull request: https://github.com/apache/commons-lang/pull/362 Add a check to StringUtils.repeat() for large length repeat value I have added a check to ensure that the resultant String from the repeat is not larger than the maximum allowed length. You can merge this pull request into a Git repository by running: $ git pull https://github.com/Turan91/commons-lang master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/362.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #362 commit cc0ea0cf47fcb27f2da6e48770a770274825b32d Author: Turan Suleyman Date: 2018-10-01T23:34:47Z Added changes for StringUtils.repeat() commit 3acb09d40d3c2be99ae8049f60d2b66bb46b7fef Author: Turan Suleyman Date: 2018-10-01T23:36:48Z Added changes for StringUtils.repeat() ---
[GitHub] commons-lang pull request #361: Add check to StringUtils.repeat() for large ...
Github user Turan91 closed the pull request at: https://github.com/apache/commons-lang/pull/361 ---
[GitHub] commons-lang pull request #361: Add check to StringUtils.repeat() for large ...
GitHub user Turan91 opened a pull request: https://github.com/apache/commons-lang/pull/361 Add check to StringUtils.repeat() for large length results I have added a check to ensure that the resultant String is not larger than the maximum allowed length. You can merge this pull request into a Git repository by running: $ git pull https://github.com/Turan91/commons-lang master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/361.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #361 commit 4b8f68422040115b70e90f1fe40ba7962fc25664 Author: Turan Suleyman Date: 2018-10-01T23:07:32Z Added changes for StringUtils.repeat() commit fa9c8b76dbe4264d0474c09288539e2e8c31f40f Author: Turan Suleyman Date: 2018-10-01T23:08:42Z Added changes for StringUtils.repeat() ---
[GitHub] commons-lang pull request #360: Lang 1407
GitHub user asciborek opened a pull request: https://github.com/apache/commons-lang/pull/360 Lang 1407 I've added an utils class with methods to rounding Duration You can merge this pull request into a Git repository by running: $ git pull https://github.com/asciborek/commons-lang LANG_1407 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/360.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #360 commit 2ccdca97268df1b9d4cd78f4331eafab2952618b Author: Aleksander Sciborek Date: 2018-09-25T20:06:29Z [LANG_1407] implement methods to round quantity of hours of duration instance commit 443d8a85ee8d5a023e49bdef59519c677b979298 Author: Aleksander Sciborek Date: 2018-09-26T15:22:00Z [LANG_1407] implement methods to round the quantity of minutes of duration instance commit 8cadd675f718a11bfb988ae3e20dd625d07d6bf3 Author: Aleksander Sciborek Date: 2018-09-27T00:25:21Z [LANG_1407] implement methods to round the quantity of seconds of duration instance commit c21c5a107b912635436861b7be6763dc1a82b42f Author: Aleksander Sciborek Date: 2018-09-27T15:50:33Z [LANG_1407] implements methods to round the quantity of days of duration instance ---
[GitHub] commons-lang pull request #299: Add module-info for Java 9
Github user lploom commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/299#discussion_r221431119 --- Diff: src/main/java/module-info.java --- @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Apache Commons Lang provides utility classes for the core of Java. + */ +module org.apache.commons.lang3 { + +// see AbstractCircuitBreaker +requires static java.desktop; --- End diff -- Isn't the best option to refactor the concurrent package to separate project? Doesn't seem like a great fit here anyhow. ---
[GitHub] commons-lang pull request #359: these 2 links seem to be broken
GitHub user fanofxiaofeng opened a pull request: https://github.com/apache/commons-lang/pull/359 these 2 links seem to be broken These 2 links seem to be broken, just fix them~ ![image](https://user-images.githubusercontent.com/3983683/46245493-044e3800-c421-11e8-8cb7-bba1b3a2c2d6.png) ![image](https://user-images.githubusercontent.com/3983683/46245489-f26c9500-c420-11e8-902f-3c53c9597454.png) You can merge this pull request into a Git repository by running: $ git pull https://github.com/fanofxiaofeng/commons-lang patch-1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/359.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #359 commit 3035e12e557559297deef2b8501f5a0ba88c448d Author: é³é³ <260893248@...> Date: 2018-09-29T11:49:03Z these 2 links seem to be broken These 2 links seem to be broken, just fix them~ ---