Commit Graph

5121 Commits

Author SHA1 Message Date
pascalschumacher 1f0dfc31b5 Always use static imports for assertion methods to be consistent with other tests classes. 2017-10-15 15:57:44 +02:00
pascalschumacher 729bcc46b5 use assertTrue and assertFalse 2017-10-15 11:00:04 +02:00
pascalschumacher ae924788d9 use assertNull where possible 2017-10-15 10:40:07 +02:00
pascalschumacher 66226ec1c2 remove unused bcel test dependency 2017-10-14 15:27:27 +02:00
pascalschumacher 2a8187fdf9 update easymock test dependency to version 3.5 2017-10-14 15:25:05 +02:00
pascalschumacher 0dc5b94a0d fix typos in comments 2017-10-12 20:38:14 +02:00
pascalschumacher 713c77ceda use StringBuilder#append(CharSequence, int, int) were possible to improve performance
(similar to LANG-1358, thanks to Stephane Landelle for the suggestion)
2017-10-12 19:53:14 +02:00
pascalschumacher 04ca0852b9 LANG-1358: Improve StringUtils#replace throughput
Add changes.xml entry
2017-10-12 19:35:15 +02:00
Stephane Landelle 5cb9883341 LANG-1358: Improve StringUtils#replace throughput (closes #300)
Motivation:

`StringUtils#replace` uses `substring` to append a String region into a
StringBuilder. This causes useless copies, as `StringBuilder#append`
can take start and end indexes.

Modification:

Use proper `StringBuilder#append` [overload](https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html#append-java.lang.CharSequence-int-int-).

Result:

Based on benchmark from [JOOQ’s post](https://blog.jooq.org/2017/10/11/benchmarking-jdk-string-replace-vs-apache-commons-stringutils-replace):

Benchmark Mode Cnt Score Error Units
StringReplaceBenchmark.testFastStringReplaceLongStringOneMatch thrpt 21
7546534,219 ± 145523,962 ops/s
StringReplaceBenchmark.testStringUtilsReplaceLongStringOneMatch thrpt
21 7353512,552 ± 124498,228 ops/s

StringReplaceBenchmark.testFastStringReplaceLongStringSeveralMatches
thrpt 21 5077255,810 ± 62358,937 ops/s
StringReplaceBenchmark.testStringUtilsReplaceLongStringSeveralMatches
thrpt 21 4108357,612 ± 92909,038 ops/s

StringReplaceBenchmark.testFastStringReplaceShortStringOneMatch thrpt
21 15911221,949 ± 541064,693 ops/s
StringReplaceBenchmark.testStringUtilsReplaceShortStringOneMatch thrpt
21 10677897,475 ± 491091,973 ops/s

StringReplaceBenchmark.testFastStringReplaceShortStringSeveralMatches
thrpt 21 9271742,251 ± 220150,121 ops/s
StringReplaceBenchmark.testStringUtilsReplaceShortStringSeveralMatches
thrpt 21 6158829,188 ± 99637,607 ops/s
2017-10-12 19:31:25 +02:00
pascalschumacher 274dbfe81f pom.xml: remove jacoco configuration from reporting section, so that c56b87d6ef is completely reverted 2017-10-11 18:54:14 +02:00
Chas Honton 862a0d1ff5 revert change.xml note 2017-10-11 08:54:23 -07:00
Chas Honton 07f3694a5c revert LANG-1354; java7 has synthetic fields on Integer, jacoco does not yet work with java9 2017-10-11 08:50:01 -07:00
Chas Honton 0f32b292c2 remove checkstyle error 2017-10-11 08:15:21 -07:00
Chas Honton e7b3e1d20f update travis to use jacoco coverage report 2017-10-11 08:03:59 -07:00
Chas Honton c56b87d6ef LANG-1354: FieldUtils should ignore any synthetic fields 2017-10-10 20:52:50 -07:00
Gary Gregory 1e9e36640f Make private fields final. 2017-10-10 16:28:59 -06:00
Gary Gregory 9a7de3974d Sort members. 2017-10-10 12:03:07 -06:00
Gary Gregory 060e66bf99 No need to nest. 2017-10-10 12:02:06 -06:00
Gary Gregory 33a1f82a13 [LANG-1355] TimeZone.getTimeZone() in FastDateParser causes resource
contention</action>. Javadoc: Use the active voice.
2017-10-10 12:01:31 -06:00
Chas Honton 1dbfaeecbd [LANG-1355] TimeZone.getTimeZone() in FastDateParser causes resource
contention</action>. This closes #296.
2017-10-10 11:58:29 -06:00
Gary Gregory 15d5503215 Checkstyle: Remove trailing white spaces on all lines. 2017-10-09 15:44:17 -06:00
Gary Gregory d848328a7a Set date template and description. 2017-10-09 14:58:35 -06:00
Gary Gregory 09d70ce73d Make tests a little more bullet-proof. 2017-10-09 14:54:31 -06:00
Gary Gregory 732ea5e94f Make tests a little more bullet-proof. 2017-10-09 14:53:32 -06:00
Gary Gregory 87eff4c78f Make tests a little more bullet-proof. 2017-10-09 14:52:43 -06:00
Gary Gregory 0726ffe1e9 Minor formatting. 2017-10-09 14:48:10 -06:00
Gary Gregory ed94e5a5cc UTC and GMT are the same, so simplify. 2017-10-09 14:47:33 -06:00
Gary Gregory 3b6867fc25 Refactor "GMT" magic string. 2017-10-09 14:44:35 -06:00
Gary Gregory f4bfd9c71f Refactor "GMT" magic string. 2017-10-09 14:41:46 -06:00
Gary Gregory fd60085a2a Refactor "GMT" magic string. 2017-10-09 14:40:43 -06:00
Gary Gregory 4485491219 [LANG-1357] org.apache.commons.lang3.time.FastDateParser should use
toUpperCase(Locale)
2017-10-09 14:30:07 -06:00
pascalschumacher 00feb98f80 LANG-1348: StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf
add changes.xml entry
2017-10-07 11:54:38 +02:00
mbusso cc6beb2d05 LANG-1348 - StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf (closes #292) 2017-10-07 11:50:15 +02:00
Allon Mureinik 36217ee164 ExtendedMessageFormatTest integers (#295)
Use the decimal "5" instead of the octal notation "05" to make the
code more straight forward and easier to read.
2017-10-07 11:47:30 +02:00
pascalschumacher cc748d35e5 travis: remove travis profile from pom and use travis-cobertura profile commons-parent 2017-10-01 16:19:50 +02:00
pascalschumacher f3df2590df .travis.yml: trusty is now the default distribution, so remove it from explicit configuration 2017-10-01 15:47:59 +02:00
Allon Mureinik d65b9d2bed Improve tests for CharUtils illegal usages (closes #293)
CharUtilsTest has several instances of the following pattern:

    try {
        CharUtils.someMethod("illegal input");
    } catch (final IllegalArgumentException ex) {}

This pattern is not very useful for testing, as the test would pass
whether an IllegalArgumentException is thrown or not. This patch
enhances the test by explicitly failing it if the exception is not
thrown:

    try {
        CharUtils.someMethod("illegal input");
        fail("An IllegalArgumentException should have been thrown");
    } catch (final IllegalArgumentException ex) {}
2017-10-01 14:33:21 +02:00
Allon Mureinik ae862ae116 CharUtilsTest#testIsAscii_char loop
The loop currently loops only up to 128, thus testing just positive
return values of CharUtils#isAscii(char). This patch increase the loop
to go over all the possible values of an unsigned byte, thus testing
also negative return values.
2017-10-01 14:33:16 +02:00
Allon Mureinik c7554151d3 Clean up if in CharUtilsTest#testIsAscii_char
The if statement calls assertTrue on the if branch and assertFalse on
the else branch on the same expression. This can easily be simplified
to assertEquals with a boolean expression to make the code clean and
easier to read.
2017-10-01 14:33:16 +02:00
Allon Mureinik 7076b7408f Boolean comparisons in CharRange (closes #289)
Cleaned up comparisons to false to just use the boolean negation
operator (!).
2017-09-29 17:05:31 +02:00
Benedikt Ritter 1406f2a4f2
Correct link to JavaDoc badge image 2017-09-25 20:30:04 +02:00
Benedikt Ritter e1a6e08417
Add JavaDoc badge 2017-09-25 20:27:59 +02:00
Allon Mureinik be31b6eb24 Fix typo stateme->statement
This closes #288
2017-09-21 22:48:03 +12:00
Allon Mureinik 466244ce3d Clean up findbugs exclusions for old XYZRange classes (closes #287)
Commit 56e830a removed all the old XYZRange classes from
org.apache.lang3.math, and left only the generic Range<T> class.

This patch removes the left-over findbugs exclusions for those
classes.
2017-09-20 22:10:16 +02:00
Bruno P. Kinoshita ff4967536b Merge branch 'pr/285'
This closes #285
2017-09-09 19:10:57 +12:00
Oliver Siegmar 67830fe249 make checkstyle config more portable (no maven coupling) 2017-09-09 08:51:49 +02:00
pascalschumacher fdf05fa29b LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug
Modify test to clean-up registry at the end.
2017-09-08 18:43:16 +02:00
pascalschumacher a2dce32cda LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug
Add a test and a changes.xml entry.
2017-09-08 18:23:03 +02:00
namannigam 3e08af573f LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug (closes #282)
SwappedPair constructed as Pair.of(rhs,lhs)
2017-09-08 18:19:04 +02:00
Oliver Siegmar d6ad3f0157 remove redundant modifiers (support recent checkstyle versions) (closes #284) 2017-09-08 17:12:51 +02:00