No need to initialize to default value.

This commit is contained in:
Gary Gregory 2020-11-20 21:45:32 -05:00
parent f3346dd067
commit d5196e7fe4
4 changed files with 36 additions and 36 deletions

View File

@ -294,7 +294,7 @@ public class CharSetTest {
@Test @Test
public void testConstructor_String_oddCombinations() { public void testConstructor_String_oddCombinations() {
CharSet set; CharSet set;
CharRange[] array = null; CharRange[] array;
set = CharSet.getInstance("a-^c"); set = CharSet.getInstance("a-^c");
array = set.getCharRanges(); array = set.getCharRanges();

View File

@ -75,7 +75,7 @@ public class FractionTest {
@Test @Test
public void testFactory_int_int() { public void testFactory_int_int() {
Fraction f = null; Fraction f;
// zero // zero
f = Fraction.getFraction(0, 1); f = Fraction.getFraction(0, 1);
@ -129,7 +129,7 @@ public class FractionTest {
@Test @Test
public void testFactory_int_int_int() { public void testFactory_int_int_int() {
Fraction f = null; Fraction f;
// zero // zero
f = Fraction.getFraction(0, 0, 2); f = Fraction.getFraction(0, 0, 2);
@ -183,7 +183,7 @@ public class FractionTest {
@Test @Test
public void testReducedFactory_int_int() { public void testReducedFactory_int_int() {
Fraction f = null; Fraction f;
// zero // zero
f = Fraction.getReducedFraction(0, 1); f = Fraction.getReducedFraction(0, 1);
@ -330,7 +330,7 @@ public class FractionTest {
@Test @Test
public void testFactory_String_double() { public void testFactory_String_double() {
Fraction f = null; Fraction f;
f = Fraction.getFraction("0.0"); f = Fraction.getFraction("0.0");
assertEquals(0, f.getNumerator()); assertEquals(0, f.getNumerator());
@ -355,7 +355,7 @@ public class FractionTest {
@Test @Test
public void testFactory_String_proper() { public void testFactory_String_proper() {
Fraction f = null; Fraction f;
f = Fraction.getFraction("0 0/1"); f = Fraction.getFraction("0 0/1");
assertEquals(0, f.getNumerator()); assertEquals(0, f.getNumerator());
@ -391,7 +391,7 @@ public class FractionTest {
@Test @Test
public void testFactory_String_improper() { public void testFactory_String_improper() {
Fraction f = null; Fraction f;
f = Fraction.getFraction("0/1"); f = Fraction.getFraction("0/1");
assertEquals(0, f.getNumerator()); assertEquals(0, f.getNumerator());
@ -425,7 +425,7 @@ public class FractionTest {
@Test @Test
public void testGets() { public void testGets() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(3, 5, 6); f = Fraction.getFraction(3, 5, 6);
assertEquals(23, f.getNumerator()); assertEquals(23, f.getNumerator());
@ -448,7 +448,7 @@ public class FractionTest {
@Test @Test
public void testConversions() { public void testConversions() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(3, 7, 8); f = Fraction.getFraction(3, 7, 8);
assertEquals(3, f.intValue()); assertEquals(3, f.intValue());
@ -459,7 +459,7 @@ public class FractionTest {
@Test @Test
public void testReduce() { public void testReduce() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(50, 75); f = Fraction.getFraction(50, 75);
Fraction result = f.reduce(); Fraction result = f.reduce();
@ -508,7 +508,7 @@ public class FractionTest {
@Test @Test
public void testInvert() { public void testInvert() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(50, 75); f = Fraction.getFraction(50, 75);
f = f.invert(); f = f.invert();
@ -536,7 +536,7 @@ public class FractionTest {
@Test @Test
public void testNegate() { public void testNegate() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(50, 75); f = Fraction.getFraction(50, 75);
f = f.negate(); f = f.negate();
@ -559,7 +559,7 @@ public class FractionTest {
@Test @Test
public void testAbs() { public void testAbs() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(50, 75); f = Fraction.getFraction(50, 75);
f = f.abs(); f = f.abs();
@ -586,7 +586,7 @@ public class FractionTest {
@Test @Test
public void testPow() { public void testPow() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(3, 5); f = Fraction.getFraction(3, 5);
assertEquals(Fraction.ONE, f.pow(0)); assertEquals(Fraction.ONE, f.pow(0));
@ -682,9 +682,9 @@ public class FractionTest {
@Test @Test
public void testAdd() { public void testAdd() {
Fraction f = null; Fraction f;
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 5); f2 = Fraction.getFraction(1, 5);
@ -784,9 +784,9 @@ public class FractionTest {
@Test @Test
public void testSubtract() { public void testSubtract() {
Fraction f = null; Fraction f;
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 5); f2 = Fraction.getFraction(1, 5);
@ -884,9 +884,9 @@ public class FractionTest {
@Test @Test
public void testMultiply() { public void testMultiply() {
Fraction f = null; Fraction f;
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5); f2 = Fraction.getFraction(2, 5);
@ -945,9 +945,9 @@ public class FractionTest {
@Test @Test
public void testDivide() { public void testDivide() {
Fraction f = null; Fraction f;
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5); f2 = Fraction.getFraction(2, 5);
@ -990,8 +990,8 @@ public class FractionTest {
@Test @Test
public void testEquals() { public void testEquals() {
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
assertNotEquals(null, f1); assertNotEquals(null, f1);
@ -1027,8 +1027,8 @@ public class FractionTest {
@Test @Test
public void testCompareTo() { public void testCompareTo() {
Fraction f1 = null; Fraction f1;
Fraction f2 = null; Fraction f2;
f1 = Fraction.getFraction(3, 5); f1 = Fraction.getFraction(3, 5);
assertEquals(0, f1.compareTo(f1)); assertEquals(0, f1.compareTo(f1));
@ -1060,7 +1060,7 @@ public class FractionTest {
@Test @Test
public void testToString() { public void testToString() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(3, 5); f = Fraction.getFraction(3, 5);
final String str = f.toString(); final String str = f.toString();
@ -1088,7 +1088,7 @@ public class FractionTest {
@Test @Test
public void testToProperString() { public void testToProperString() {
Fraction f = null; Fraction f;
f = Fraction.getFraction(3, 5); f = Fraction.getFraction(3, 5);
final String str = f.toProperString(); final String str = f.toProperString();

View File

@ -207,7 +207,7 @@ public class ExtendedMessageFormatTest {
@Test @Test
public void testBuiltInChoiceFormat() { public void testBuiltInChoiceFormat() {
final Object[] values = new Number[] {Integer.valueOf(1), Double.valueOf("2.2"), Double.valueOf("1234.5")}; 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(); final Locale[] availableLocales = NumberFormat.getAvailableLocales();
choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}"; 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 String pattern = "Pattern: {0,testfmt}";
final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry); final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
ExtendedMessageFormat other = null; ExtendedMessageFormat other;
// Same object // Same object
assertEquals(emf, emf, "same, equals()"); assertEquals(emf, emf, "same, equals()");

View File

@ -51,7 +51,7 @@ public class DurationFormatUtilsTest {
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@Test @Test
public void testFormatDurationWords() { public void testFormatDurationWords() {
String text = null; String text;
text = DurationFormatUtils.formatDurationWords(50 * 1000, true, false); text = DurationFormatUtils.formatDurationWords(50 * 1000, true, false);
assertEquals("50 seconds", text); assertEquals("50 seconds", text);
@ -121,7 +121,7 @@ public class DurationFormatUtilsTest {
final long oneMinute = oneSecond * 60; final long oneMinute = oneSecond * 60;
final long oneHour = oneMinute * 60; final long oneHour = oneMinute * 60;
final long oneDay = oneHour * 24; final long oneDay = oneHour * 24;
String text = null; String text;
text = DurationFormatUtils.formatDurationWords(oneSecond, false, false); text = DurationFormatUtils.formatDurationWords(oneSecond, false, false);
assertEquals("0 days 0 hours 0 minutes 1 second", text); assertEquals("0 days 0 hours 0 minutes 1 second", text);