4537 Commits

Author SHA1 Message Date
Tompkins
ddb759d67a (docs) remove SecureRandom 2019-04-04 08:11:56 -04:00
Rob Tompkins
ff05d661dc (docs) updates to documentation about SecureRandom 2019-04-03 20:43:17 -04:00
Gary Gregory
064b9d8a2f Update Apache Commons Parent from 47 to 48. 2019-03-26 20:22:19 -04:00
Mariano de Achaval
2e1a1d4536
Fix javadoc in wrapIfMissing
wrapIfMissing function was referencing warp function in the javadoc
2019-03-12 09:40:44 -03:00
Gary Gregory
82b69a4dd6 [LANG-1436] (doc) Fix javadoc for 'startIndex' parameter of
StringUtils.join() methods. GitHub PR #412.
2019-03-04 17:44:26 -05:00
Andrei Troie
353e06a8ac (doc) Fix javadoc for 'startIndex' parameter of StringUtils.join() methods (#412) 2019-03-04 17:41:38 -05:00
Alex Herbert
fa9f1aae19 Consolidate the StringUtils.equals and equalsIgnoreCase methods. (#409)
* Consolidate the StringUtils.equals and equalsIgnoreCase methods.

Implement the same edge case logic for null. Use the same parameter
names. Use the same Javadoc wording. Change the equals method to use a
step-wise charAt comparison.

* LANG-1436: Added Jira to changes.xml.
2019-03-03 08:43:23 -05:00
Rob Tompkins
589ce59307
Merge pull request #391 from RahulNagekar/JsonToStringStyle_Junits
Adding junits for JsonToStringStyle
2019-02-18 18:34:22 -05:00
Benedikt Ritter
75768ba272
Simplify test code by using lambda expressions 2019-02-09 16:56:09 +01:00
Allon Mureinik
c01fa9aa42 Simplify assertions (closes #404)
Use JUnit methods to clean up the test and simplify the assertions:
- assertArraysEqual(x, y) replaces assertTrue(Arrays.equals(x, y))
- assertEquals(x, y) replaces assertTrue(x == y)
- assertNotEquals(x, y) replaces assertFalse(x == y)
2019-02-09 12:44:42 +01:00
Allon Mureinik
a4adb41259 Use assertThrows in FunctionsTest (closes #404)
Use JUnit Jupiter's elegant assertThrows method instead of the
boilerplate pattern of try-fail-catch to assert an exception was
thrown.
2019-02-09 12:44:06 +01:00
Eitan Adler
6b7a848010 [ToStringBuilderTest] clean up after some old issues
- Remove code to handle old JDK 6 bugs
- Fix a mis-ordered assertEquals
- Remove a deprecated call to Character's constructor
2019-02-09 02:08:32 -08:00
Allon Mureinik
bfa50b3edf Clean up floating point assertions (closes #402)
JUnit Jupiter 5.4.0 supports deltas of 0 when asserting double and
float equalities.
This patch utilizes these new assertEquals methods and removes the
hack of using assertTrue with an == statement that was needed in older
JUnit versions.
2019-02-08 19:54:17 +01:00
Allon Mureinik
fc6a392b7c Fix javadoc errors in Functions.java 2019-02-08 20:08:56 +02:00
Allon Mureinik
f12cfc8d4e FunctionsTest whitespaces
Use four spaces instead of a tab as per the projcet's Checkstyle
rules.
2019-02-08 19:39:01 +02:00
Allon Mureinik
19a5a09b09 FunctionsTest whitespace after comma
Add a space after the comma as per the project's Checkstyle rules
2019-02-08 19:37:38 +02:00
Allon Mureinik
5e315d1ac9 FunctionsTest method references
Use method references instead of lambda expression to clean up the
code and comply to the project's Checkstyle rules.
2019-02-08 19:36:29 +02:00
Allon Mureinik
76a243c587 FunctionTest redundant constructor modifier
Remove redundant public modifiers from inner classes constructors as
per the project's Checkstyle rules.
2019-02-08 19:34:40 +02:00
Allon Mureinik
95926eb5d9 FunctionsTest imports
Clean up FunctionsTest's imports as per the project's Checkstyle
rules.
2019-02-08 19:32:39 +02:00
Allon Mureinik
c5eadb1c6d Functions.java whitspaces
Replace tabs with four spaces, as per the project's Checkstyle rules.
2019-02-08 19:30:35 +02:00
Allon Mureinik
962e529984 Add spaces after commas in Functions.java
Add spaces after commas as per the project's Checkstyle rules.
2019-02-08 19:29:06 +02:00
Allon Mureinik
028c9ec70c Remove unused generic argument from Functions#tryWithResources 2019-02-08 19:25:27 +02:00
Allon Mureinik
b08c92e75d Fix Javadoc issues in Functions 2019-02-08 19:23:40 +02:00
Allon Mureinik
f7fae53aec Functions' interfaces modifiers
Remove the redundant public modifier from the inner interfaces in
Functions, as per the Checkstyle policy of the project.
2019-02-08 18:18:40 +02:00
Allon Mureinik
1c48eb0d8b Add license to FunctionsTest.java
Add a license header to FunctionsTest.java to make the rat maven task
pass.
2019-02-08 17:47:29 +02:00
Jochen Wiedmann (jwi)
2ebc17ba3f Added Functions.tryWithResources. 2019-01-29 11:42:07 +01:00
Jochen Wiedmann (jwi)
11d9eb47a4 Adding the Functions class as a helper for dealing with Java 8 Lambdas. 2019-01-23 14:59:25 +01:00
Bruno P. Kinoshita
b00e65686e Fix checkstyle issues in new test code 2019-01-08 20:01:56 +13:00
Apirom Na Nakorn
bf77678673 add test use ImmutablePair class with java.util.HashMap and java.util.TreeMap 2019-01-08 19:48:22 +13:00
RahulNagekar
cee7cc6b64 Refactoring junits of JsonToStringStyle 2018-12-21 01:05:50 +05:30
RahulNagekar
92e63fb3c8 Adding junits for JsonToStringStyle
Signed-off-by: RahulNagekar <rahul.nagekar1@gmail.com>
2018-12-21 00:42:34 +05:30
pascalschumacher
a48d045709 LANG-1427: Add SystemUtils.isJavaVersionAtMost(JavaVersion)
Fix checkstyle violations.
2018-12-20 14:26:28 +01:00
Gary Gregory
e21cb463c0 Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-lang.git 2018-12-10 17:48:30 -07:00
Gary Gregory
a410aab651 [LANG-1427] Add API
org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost(JavaVersion)
2018-12-10 17:48:06 -07:00
RahulNagekar
c368955343 Add additional tests for StandardToStringStyle (closes #390) 2018-12-02 19:59:59 +01:00
pascalschumacher
5cdac9cfd5 Make whitespace use around generic tokens consistent and add a checkstyle rule to enforce it. 2018-11-19 22:05:18 +01:00
pascalschumacher
07f537120f Make whitespace use before tokens consistent and add a checkstyle rule to enforce it. 2018-11-19 22:05:11 +01:00
pascalschumacher
89cbfa54b0 Make whitespace use after tokens consistent and add a checkstyle rule to enforce it. 2018-11-19 22:04:35 +01:00
Uri
e1618fa232 fix javadoc typo 2018-11-02 16:48:04 -07:00
pascalschumacher
b278ac8c39 Remove unused test code 2018-10-26 19:49:58 +02:00
pascalschumacher
5afe35c024 LANG-1422: Add null-safe StringUtils.valueOf(char[]) to delegate to String.valueOf(char[])
Fix checkstyle violations
2018-10-26 19:48:28 +02:00
Gary Gregory
c70e05ae41 [LANG-1422] Add null-safe StringUtils.valueOf(char[]) to delegate to
String.valueOf(char[])
2018-10-25 08:52:48 -06:00
Allon Mureinik
3609993fb5 Clean up assertions (closes #376)
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).
2018-10-13 21:10:54 +02:00
Allon Mureinik
b3d86ca08a Clean up redundant throws clauses 2018-10-13 21:09:37 +02:00
Allon Mureinik
e00e871d1d Use assertTrue/assertFalse instead of reimplementing them
Use assertTrue and assertFalse instead of reimplemeting their logic by
having an if statement conditionalling call fail.
2018-10-13 21:09:37 +02:00
Allon Mureinik
3387734b4f 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.
2018-10-13 21:09:36 +02:00
Allon Mureinik
0fa0bfd8bb 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.
2018-10-13 21:09:36 +02:00
Allon Mureinik
fde19e79d5 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.
2018-10-13 21:09:35 +02:00
Allon Mureinik
369d0616ce Remove ConversionTest#assertBinaryEquals
JUnit Jupiter's Assertions has an
assertArraysEuqals(boolean[], boolean[]) method, so there's no longer a
need for the assertBinaryEquals method.
2018-10-13 21:09:35 +02:00
pascalschumacher
46ea7e5e96 Update checkstyle to version 8.13 2018-10-13 20:22:23 +02:00