You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 02:45:41 UTC

[commons-lang] 03/03: No need to initialize to default value.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit d5196e7fe47b3121c4d18f90164ca66979d5fd80
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 21:45:32 2020 -0500

    No need to initialize to default value.
---
 .../java/org/apache/commons/lang3/CharSetTest.java |  2 +-
 .../apache/commons/lang3/math/FractionTest.java    | 62 +++++++++++-----------
 .../lang3/text/ExtendedMessageFormatTest.java      |  4 +-
 .../lang3/time/DurationFormatUtilsTest.java        |  4 +-
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/CharSetTest.java b/src/test/java/org/apache/commons/lang3/CharSetTest.java
index a3c25c6..966cc20 100644
--- a/src/test/java/org/apache/commons/lang3/CharSetTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSetTest.java
@@ -294,7 +294,7 @@ public class CharSetTest  {
     @Test
     public void testConstructor_String_oddCombinations() {
         CharSet set;
-        CharRange[] array = null;
+        CharRange[] array;
 
         set = CharSet.getInstance("a-^c");
         array = set.getCharRanges();
diff --git a/src/test/java/org/apache/commons/lang3/math/FractionTest.java b/src/test/java/org/apache/commons/lang3/math/FractionTest.java
index ff953cf..28d94b2 100644
--- a/src/test/java/org/apache/commons/lang3/math/FractionTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/FractionTest.java
@@ -75,7 +75,7 @@ public class FractionTest  {
 
     @Test
     public void testFactory_int_int() {
-        Fraction f = null;
+        Fraction f;
 
         // zero
         f = Fraction.getFraction(0, 1);
@@ -129,7 +129,7 @@ public class FractionTest  {
 
     @Test
     public void testFactory_int_int_int() {
-        Fraction f = null;
+        Fraction f;
 
         // zero
         f = Fraction.getFraction(0, 0, 2);
@@ -183,7 +183,7 @@ public class FractionTest  {
 
     @Test
     public void testReducedFactory_int_int() {
-        Fraction f = null;
+        Fraction f;
 
         // zero
         f = Fraction.getReducedFraction(0, 1);
@@ -330,7 +330,7 @@ public class FractionTest  {
 
     @Test
     public void testFactory_String_double() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction("0.0");
         assertEquals(0, f.getNumerator());
@@ -355,7 +355,7 @@ public class FractionTest  {
 
     @Test
     public void testFactory_String_proper() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction("0 0/1");
         assertEquals(0, f.getNumerator());
@@ -391,7 +391,7 @@ public class FractionTest  {
 
     @Test
     public void testFactory_String_improper() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction("0/1");
         assertEquals(0, f.getNumerator());
@@ -425,7 +425,7 @@ public class FractionTest  {
 
     @Test
     public void testGets() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(3, 5, 6);
         assertEquals(23, f.getNumerator());
@@ -448,7 +448,7 @@ public class FractionTest  {
 
     @Test
     public void testConversions() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(3, 7, 8);
         assertEquals(3, f.intValue());
@@ -459,7 +459,7 @@ public class FractionTest  {
 
     @Test
     public void testReduce() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(50, 75);
         Fraction result = f.reduce();
@@ -508,7 +508,7 @@ public class FractionTest  {
 
     @Test
     public void testInvert() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(50, 75);
         f = f.invert();
@@ -536,7 +536,7 @@ public class FractionTest  {
 
     @Test
     public void testNegate() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(50, 75);
         f = f.negate();
@@ -559,7 +559,7 @@ public class FractionTest  {
 
     @Test
     public void testAbs() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(50, 75);
         f = f.abs();
@@ -586,7 +586,7 @@ public class FractionTest  {
 
     @Test
     public void testPow() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(3, 5);
         assertEquals(Fraction.ONE, f.pow(0));
@@ -682,9 +682,9 @@ public class FractionTest  {
 
     @Test
     public void testAdd() {
-        Fraction f = null;
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         f2 = Fraction.getFraction(1, 5);
@@ -784,9 +784,9 @@ public class FractionTest  {
 
     @Test
     public void testSubtract() {
-        Fraction f = null;
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         f2 = Fraction.getFraction(1, 5);
@@ -884,9 +884,9 @@ public class FractionTest  {
 
     @Test
     public void testMultiply() {
-        Fraction f = null;
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         f2 = Fraction.getFraction(2, 5);
@@ -945,9 +945,9 @@ public class FractionTest  {
 
     @Test
     public void testDivide() {
-        Fraction f = null;
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         f2 = Fraction.getFraction(2, 5);
@@ -990,8 +990,8 @@ public class FractionTest  {
 
     @Test
     public void testEquals() {
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         assertNotEquals(null, f1);
@@ -1027,8 +1027,8 @@ public class FractionTest  {
 
     @Test
     public void testCompareTo() {
-        Fraction f1 = null;
-        Fraction f2 = null;
+        Fraction f1;
+        Fraction f2;
 
         f1 = Fraction.getFraction(3, 5);
         assertEquals(0, f1.compareTo(f1));
@@ -1060,7 +1060,7 @@ public class FractionTest  {
 
     @Test
     public void testToString() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(3, 5);
         final String str = f.toString();
@@ -1088,7 +1088,7 @@ public class FractionTest  {
 
     @Test
     public void testToProperString() {
-        Fraction f = null;
+        Fraction f;
 
         f = Fraction.getFraction(3, 5);
         final String str = f.toProperString();
diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
index 7aa3c20..2bb1375 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -207,7 +207,7 @@ public class ExtendedMessageFormatTest {
     @Test
     public void testBuiltInChoiceFormat() {
         final Object[] values = new Number[] {Integer.valueOf(1), Double.valueOf("2.2"), Double.valueOf("1234.5")};
-        String choicePattern = null;
+        String choicePattern;
         final Locale[] availableLocales = NumberFormat.getAvailableLocales();
 
         choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}";
@@ -296,7 +296,7 @@ public class ExtendedMessageFormatTest {
         final String pattern = "Pattern: {0,testfmt}";
         final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
 
-        ExtendedMessageFormat other = null;
+        ExtendedMessageFormat other;
 
         // Same object
         assertEquals(emf, emf, "same, equals()");
diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
index 7db6bbe..6c1b2f1 100644
--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
@@ -51,7 +51,7 @@ public class DurationFormatUtilsTest {
     // -----------------------------------------------------------------------
     @Test
     public void testFormatDurationWords() {
-        String text = null;
+        String text;
 
         text = DurationFormatUtils.formatDurationWords(50 * 1000, true, false);
         assertEquals("50 seconds", text);
@@ -121,7 +121,7 @@ public class DurationFormatUtilsTest {
         final long oneMinute = oneSecond * 60;
         final long oneHour = oneMinute * 60;
         final long oneDay = oneHour * 24;
-        String text = null;
+        String text;
 
         text = DurationFormatUtils.formatDurationWords(oneSecond, false, false);
         assertEquals("0 days 0 hours 0 minutes 1 second", text);