Skip to content

Commit 8e36214

Browse files
committed
In-line single use test local variables
1 parent 9bd67e7 commit 8e36214

3 files changed

Lines changed: 11 additions & 17 deletions

File tree

src/test/java/org/apache/commons/codec/language/Caverphone1Test.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ void testCaverphoneRevisitedCommonCodeAT1111() throws EncoderException {
6565

6666
@Test
6767
void testEndMb() throws EncoderException {
68-
final String[][] data = {{"mb", "M11111"}, {"mbmb", "MPM111"}};
69-
checkEncodings(data);
68+
checkEncodings(new String[][] {{"mb", "M11111"}, {"mbmb", "MPM111"}});
7069
}
7170

7271
/**
@@ -88,8 +87,7 @@ void testIsCaverphoneEquals() throws EncoderException {
8887
*/
8988
@Test
9089
void testSpecificationV1Examples() throws EncoderException {
91-
final String[][] data = {{"David", "TFT111"}, {"Whittle", "WTL111"}};
92-
checkEncodings(data);
90+
checkEncodings(new String[][] {{"David", "TFT111"}, {"Whittle", "WTL111"}});
9391
}
9492

9593
/**
@@ -99,8 +97,7 @@ void testSpecificationV1Examples() throws EncoderException {
9997
*/
10098
@Test
10199
void testWikipediaExamples() throws EncoderException {
102-
final String[][] data = {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}};
103-
checkEncodings(data);
100+
checkEncodings(new String[][] {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}});
104101
}
105102

106103
}

src/test/java/org/apache/commons/codec/language/Caverphone2Test.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ void testCaverphoneRevisitedCommonCodeAT11111111() throws EncoderException {
6868
* @throws EncoderException for some failure scenarios */
6969
@Test
7070
void testCaverphoneRevisitedExamples() throws EncoderException {
71-
final String[][] data = {{"Stevenson", "STFNSN1111"}, {"Peter", "PTA1111111"}};
72-
checkEncodings(data);
71+
checkEncodings(new String[][] {{"Stevenson", "STFNSN1111"}, {"Peter", "PTA1111111"}});
7372
}
7473

7574
/**
@@ -330,15 +329,14 @@ void testCaverphoneRevisitedRandomNameTTA1111111() throws EncoderException {
330329
* @throws EncoderException for some failure scenarios */
331330
@Test
332331
void testCaverphoneRevisitedRandomWords() throws EncoderException {
333-
checkEncodingVariations("RTA1111111", new String[]{"rather", "ready", "writer"});
332+
checkEncodingVariations("RTA1111111", "rather", "ready", "writer");
334333
checkEncoding("SSA1111111", "social");
335-
checkEncodingVariations("APA1111111", new String[]{"able", "appear"});
334+
checkEncodingVariations("APA1111111", "able", "appear");
336335
}
337336

338337
@Test
339338
void testEndMb() throws EncoderException {
340-
final String[][] data = {{"mb", "M111111111"}, {"mbmb", "MPM1111111"}};
341-
checkEncodings(data);
339+
checkEncodings(new String[][] {{"mb", "M111111111"}, {"mbmb", "MPM1111111"}});
342340
}
343341

344342
// Caverphone Revisited
@@ -351,15 +349,14 @@ void testIsCaverphoneEquals() throws EncoderException {
351349

352350
@Test
353351
void testSpecificationExamples() throws EncoderException {
354-
final String[][] data = {
352+
checkEncodings(new String[][] {
355353
{"Peter", "PTA1111111"},
356354
{"ready", "RTA1111111"},
357355
{"social", "SSA1111111"},
358356
{"able", "APA1111111"},
359357
{"Tedder", "TTA1111111"},
360358
{"Karleen", "KLN1111111"},
361-
{"Dyun", "TN11111111"}};
362-
checkEncodings(data);
359+
{"Dyun", "TN11111111"}});
363360
}
364361

365362
}

src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ void testExamples(final String source, final String expected) throws EncoderExce
246246

247247
@Test
248248
void testHyphen() throws EncoderException {
249-
final String[][] data = { { "bergisch-gladbach", "174845214" }, { "M\u00fcller-L\u00fcdenscheidt", "65752682" } }; // Müller-Lüdenscheidt
250-
checkEncodings(data);
249+
// Müller-Lüdenscheidt
250+
checkEncodings(new String[][] { { "bergisch-gladbach", "174845214" }, { "M\u00fcller-L\u00fcdenscheidt", "65752682" } });
251251
}
252252

253253
@ParameterizedTest

0 commit comments

Comments
 (0)