You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2015/05/07 22:14:45 UTC

[8/8] [lang] Merge branch 'LANG-1127'

Merge branch 'LANG-1127'

LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/cfe63bee
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/cfe63bee
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/cfe63bee

Branch: refs/heads/master
Commit: cfe63beeacf30e78c0fccb89132d6e50f650fa2f
Parents: 9604c85 9efa153
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu May 7 22:13:32 2015 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu May 7 22:13:32 2015 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                         |   2 +-
 .../lang3/StringUtilsEqualsIndexOfTest.java     |  34 +++--
 .../commons/lang3/test/DefaultLocale.java       |  43 ------
 .../commons/lang3/test/DefaultTimeZone.java     |  43 ------
 .../lang3/test/DefaultTimeZoneAndLocale.java    |  45 ------
 .../commons/lang3/test/SystemDefaults.java      |  40 +++++
 .../lang3/test/SystemDefaultsSwitch.java        | 113 ++++++++++++++
 .../lang3/test/SystemDefaultsSwitchTest.java    |  88 +++++++++++
 .../commons/lang3/time/DateFormatUtilsTest.java |  46 +++---
 .../commons/lang3/time/DateUtilsTest.java       |  53 +++----
 .../commons/lang3/time/FastDateFormatTest.java  | 150 +++++++++----------
 .../commons/lang3/time/FastDatePrinterTest.java |  99 ++++++------
 12 files changed, 418 insertions(+), 338 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index 4b694b8,e82989b..aa45533
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -22,16 -22,8 +22,16 @@@
    <body>
  
    <release version="3.5" date="tba" description="tba">
 +    <action issue="LANG-1135" type="add" dev="britter" due-to="Eduardo Martins">Add method containsAllWords to WordUtils</action>
 +    <action issue="LANG-1132" type="add" dev="britter" due-to="Jack Tan">ReflectionToStringBuilder doesn't throw IllegalArgumentException when the constructor's object param is null</action>
 +    <action issue="LANG-1122" type="fix" dev="britter" due-to="Adrian Ber">Inconsistent behavior of swap for malformed inputs</action>
 +    <action issue="LANG-701" type="add" dev="britter" due-to="James Sawle">StringUtils join with var args</action>
 +    <action issue="LANG-1130" type="fix" dev="britter">Fix critical issues reported by SonarQube</action>
 +    <action issue="LANG-1131" type="fix" dev="britter">StrBuilder.equals(StrBuilder) doesn't check for null inputs</action>
 +    <action issue="LANG-1105" type="add" dev="britter" due-to="Hendrik Saly">Add ThreadUtils - A utility class which provides helper methods related to java.lang.Thread</action>
 +    <action issue="LANG-1031" type="add" dev="britter" due-to="Felipe Adorno">Add annotations to exclude fields from ReflectionEqualsBuilder, ReflectionToStringBuilder and ReflectionHashCodeBuilder</action>
-     <action issue="LANG-1127" type="add" dev="chas">Unit test helpers which set and reset default Locale and TimeZone</action>
+     <action issue="LANG-1127" type="add" dev="chas, britter">Use JUnit rules to set and reset the default Locale and TimeZone</action>
 -    <action issue="LANG-1128" type="fix" dev="britter" due-to="jacktan1991">JsonToStringStyle doesn't handle chars and objects correctly</action>
 +    <action issue="LANG-1128" type="fix" dev="britter" due-to="Jack Tan">JsonToStringStyle doesn't handle chars and objects correctly</action>
      <action issue="LANG-456" type="fix" dev="britter" due-to="Bob Fields, Woosan Ko, Bruno P. Kinoshita">HashCodeBuilder throws StackOverflowError in bidirectional navigable association</action>
      <action issue="LANG-1126" type="fix" dev="britter">DateFormatUtilsTest.testSMTP depends on the default Locale</action>
      <action issue="LANG-1123" type="fix" dev="chas" due-to="Christian P. Momon">Unit test FastDatePrinterTimeZonesTest needs a timezone set</action>

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --cc src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 3a739c1,a50229e..dc8a513
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@@ -29,8 -31,14 +31,12 @@@ import org.junit.Test
  
  /**
   * Unit tests {@link org.apache.commons.lang3.StringUtils} - Substring methods
 - *
 - * @version $Id$
   */
  public class StringUtilsEqualsIndexOfTest  {
+ 
+     @Rule
+     public SystemDefaultsSwitch defaults = new SystemDefaultsSwitch();
+ 
      private static final String BAR = "bar";
      /**
       * Supplementary character U+20000
@@@ -225,13 -231,12 +231,14 @@@
          assertFalse(StringUtils.containsAny("", new String[] { "hello" }));
          assertFalse(StringUtils.containsAny("hello, goodbye", (String[]) null));
          assertFalse(StringUtils.containsAny("hello, goodbye", new String[0]));
 -        assertTrue(StringUtils.containsAny("hello, goodbye", new String[] { "hello", "goodbye" }));
 -        assertTrue(StringUtils.containsAny("hello, goodbye", new String[] { "hello", "Goodbye" }));
 -        assertFalse(StringUtils.containsAny("hello, goodbye", new String[] { "Hello", "Goodbye" }));
 +        assertTrue(StringUtils.containsAny("hello, goodbye", new String[]{"hello", "goodbye"}));
 +        assertTrue(StringUtils.containsAny("hello, goodbye", new String[]{"hello", "Goodbye"}));
 +        assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", "Goodbye"}));
 +        assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", null}));
 +        assertFalse(StringUtils.containsAny("hello, null", new String[] { "Hello", null }));
      }
  
+     @SystemDefaults(locale="de_DE")
      @Test
      public void testContainsIgnoreCase_LocaleIndependence() {
          final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cfe63bee/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
----------------------------------------------------------------------