Skip to content

Commit 8cc5244

Browse files
committed
Use JUnit 5 convention for test method visibility
1 parent 83f3986 commit 8cc5244

File tree

92 files changed

+1165
-1165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1165
-1165
lines changed

src/test/java/org/apache/commons/text/AlphabetConverterTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ private void test(final Character[] originalChars, final Character[] encodingCha
106106
}
107107

108108
@Test
109-
public void testBinaryTest() throws UnsupportedEncodingException {
109+
void testBinaryTest() throws UnsupportedEncodingException {
110110
test(BINARY, NUMBERS, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "0", "1", "10", "11");
111111
test(NUMBERS, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "12345", "0");
112112
test(LOWER_CASE_ENGLISH, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "abc", "a");
113113
}
114114

115115
@Test
116-
public void testCreateConverterFromCharsAndEquals() {
116+
void testCreateConverterFromCharsAndEquals() {
117117
final Character[] characterArray = new Character[2];
118118
final char charOne = '+';
119119
final char character = '+';
@@ -125,7 +125,7 @@ public void testCreateConverterFromCharsAndEquals() {
125125
}
126126

127127
@Test
128-
public void testCreateConverterFromCharsOne() {
128+
void testCreateConverterFromCharsOne() {
129129
final Character[] characterArray = new Character[2];
130130
characterArray[0] = '5';
131131
characterArray[1] = characterArray[0];
@@ -135,7 +135,7 @@ public void testCreateConverterFromCharsOne() {
135135
}
136136

137137
@Test
138-
public void testCreateConverterFromCharsWithNullAndNull() {
138+
void testCreateConverterFromCharsWithNullAndNull() {
139139
assertThrows(IllegalArgumentException.class, () -> {
140140
final Character[] characterArray = new Character[2];
141141
characterArray[0] = '$';
@@ -145,7 +145,7 @@ public void testCreateConverterFromCharsWithNullAndNull() {
145145
}
146146

147147
@Test
148-
public void testCreateConverterFromMapAndEquals() {
148+
void testCreateConverterFromMapAndEquals() {
149149
final Map<Integer, String> hashMap = new HashMap<>();
150150
final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(hashMap);
151151
hashMap.put(0, "CtDs");
@@ -155,27 +155,27 @@ public void testCreateConverterFromMapAndEquals() {
155155
}
156156

157157
@Test
158-
public void testDecodeReturningNull() throws UnsupportedEncodingException {
158+
void testDecodeReturningNull() throws UnsupportedEncodingException {
159159
final Map<Integer, String> map = new HashMap<>();
160160
final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(map);
161161
alphabetConverter.decode(null);
162162
assertEquals(1, alphabetConverter.getEncodedCharLength());
163163
}
164164

165165
@Test
166-
public void testDoNotEncodeTest() throws UnsupportedEncodingException {
166+
void testDoNotEncodeTest() throws UnsupportedEncodingException {
167167
test(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH, "1", "456", "abc", "ABC", "this will not be converted but THIS WILL");
168168
test(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH_AND_NUMBERS, NUMBERS, "1", "456", "abc", "ABC", "this will be converted but 12345 and this will be");
169169
}
170170

171171
@Test
172-
public void testEncodeFailureTest() {
172+
void testEncodeFailureTest() {
173173
assertEquals("Couldn't find encoding for '3' in 3",
174174
assertThrows(UnsupportedEncodingException.class, () -> test(BINARY, NUMBERS, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "3")).getMessage());
175175
}
176176

177177
@Test
178-
public void testEquals() {
178+
void testEquals() {
179179
final Character[] characterArray = new Character[2];
180180
final char character = 'R';
181181
characterArray[0] = character;
@@ -189,15 +189,15 @@ public void testEquals() {
189189
}
190190

191191
@Test
192-
public void testEqualsWithNull() {
192+
void testEqualsWithNull() {
193193
final Character[] characterArray = ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY;
194194
final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, null, null);
195195

196196
assertFalse(alphabetConverter.equals(null));
197197
}
198198

199199
@Test
200-
public void testEqualsWithSameObject() {
200+
void testEqualsWithSameObject() {
201201
final Character[] characterArray = new Character[2];
202202
final char character = 'R';
203203
characterArray[0] = character;
@@ -208,7 +208,7 @@ public void testEqualsWithSameObject() {
208208
}
209209

210210
@Test
211-
public void testHebrewTest() throws UnsupportedEncodingException {
211+
void testHebrewTest() throws UnsupportedEncodingException {
212212
test(HEBREW, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "\u05d0", "\u05e2",
213213
"\u05d0\u05dc\u05e3_\u05d0\u05d5\u05d4\u05d1\u05dc_\u05d1\u05d9\u05ea_\u05d6\u05d4_\u05d1\u05d9\u05ea_"
214214
+ "\u05d2\u05d9\u05de\u05dc_\u05d6\u05d4_\u05db\u05de\u05dc_\u05d2\u05d3\u05d5\u05dc");
@@ -223,7 +223,7 @@ public void testHebrewTest() throws UnsupportedEncodingException {
223223
* Test example in javadocs for consistency
224224
*/
225225
@Test
226-
public void testJavadocExampleTest() throws UnsupportedEncodingException {
226+
void testJavadocExampleTest() throws UnsupportedEncodingException {
227227
final AlphabetConverter ac = createJavadocExample();
228228

229229
assertEquals("00", ac.encode("a"));
@@ -234,28 +234,28 @@ public void testJavadocExampleTest() throws UnsupportedEncodingException {
234234
}
235235

236236
@Test
237-
public void testMissingDoNotEncodeLettersFromEncodingTest() {
237+
void testMissingDoNotEncodeLettersFromEncodingTest() {
238238
assertEquals("Can not use 'do not encode' list because encoding alphabet does not contain '0'",
239239
assertThrows(IllegalArgumentException.class, () -> AlphabetConverter.createConverterFromChars(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH, NUMBERS))
240240
.getMessage());
241241
}
242242

243243
@Test
244-
public void testMissingDoNotEncodeLettersFromOriginalTest() {
244+
void testMissingDoNotEncodeLettersFromOriginalTest() {
245245
assertEquals("Can not use 'do not encode' list because original alphabet does not contain '0'",
246246
assertThrows(IllegalArgumentException.class, () -> AlphabetConverter.createConverterFromChars(LOWER_CASE_ENGLISH, ENGLISH_AND_NUMBERS, NUMBERS))
247247
.getMessage());
248248
}
249249

250250
@Test
251-
public void testNoEncodingLettersTest() {
251+
void testNoEncodingLettersTest() {
252252
assertEquals("Must have at least two encoding characters (excluding those in the 'do not encode' list), but has 0",
253253
assertThrows(IllegalArgumentException.class, () -> AlphabetConverter.createConverterFromChars(ENGLISH_AND_NUMBERS, NUMBERS, NUMBERS))
254254
.getMessage());
255255
}
256256

257257
@Test
258-
public void testOnlyOneEncodingLettersTest() {
258+
void testOnlyOneEncodingLettersTest() {
259259
assertEquals("Must have at least two encoding characters (excluding those in the 'do not encode' list), but has 1",
260260
assertThrows(IllegalArgumentException.class, () -> {
261261
final Character[] numbersPlusUnderscore = Arrays.copyOf(NUMBERS, NUMBERS.length + 1);
@@ -266,14 +266,14 @@ public void testOnlyOneEncodingLettersTest() {
266266
}
267267

268268
@Test
269-
public void testUnexpectedEndWhileDecodingTest() {
269+
void testUnexpectedEndWhileDecodingTest() {
270270
final String toDecode = "00d01d0";
271271
assertEquals("Unexpected end of string while decoding " + toDecode,
272272
assertThrows(UnsupportedEncodingException.class, () -> createJavadocExample().decode(toDecode)).getMessage());
273273
}
274274

275275
@Test
276-
public void testUnexpectedStringWhileDecodingTest() {
276+
void testUnexpectedStringWhileDecodingTest() {
277277
final String toDecode = "00XX";
278278
assertEquals("Unexpected string without decoding (XX) in " + toDecode,
279279
assertThrows(UnsupportedEncodingException.class, () -> createJavadocExample().decode(toDecode)).getMessage());
@@ -283,7 +283,7 @@ public void testUnexpectedStringWhileDecodingTest() {
283283
* Test constructor from code points
284284
*/
285285
@Test
286-
public void testUnicodeTest() throws UnsupportedEncodingException {
286+
void testUnicodeTest() throws UnsupportedEncodingException {
287287
final AlphabetConverter ac = AlphabetConverter.createConverter(UNICODE, LOWER_CASE_ENGLISH_CODEPOINTS, DO_NOT_ENCODE_CODEPOINTS);
288288
assertEquals(2, ac.getEncodedCharLength());
289289
final String original = "\u8a43\u8a45 \u8dce ab \u8dc3 c \u8983";

src/test/java/org/apache/commons/text/CaseUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public class CaseUtilsTest {
3434

3535
@Test
36-
public void testConstructor() {
36+
void testConstructor() {
3737
assertNotNull(new CaseUtils());
3838
final Constructor<?>[] cons = CaseUtils.class.getDeclaredConstructors();
3939
assertEquals(1, cons.length);
@@ -43,7 +43,7 @@ public void testConstructor() {
4343
}
4444

4545
@Test
46-
public void testToCamelCase() {
46+
void testToCamelCase() {
4747
assertNull(CaseUtils.toCamelCase(null, false, null));
4848
assertEquals("", CaseUtils.toCamelCase("", true, null));
4949
assertEquals("", CaseUtils.toCamelCase(" ", false, null));

src/test/java/org/apache/commons/text/CharacterPredicatesTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class CharacterPredicatesTest {
2828

2929
@Test
30-
public void testArabicNumerals() {
30+
void testArabicNumerals() {
3131
assertTrue(CharacterPredicates.ARABIC_NUMERALS.test('0'));
3232
assertTrue(CharacterPredicates.ARABIC_NUMERALS.test('1'));
3333
assertTrue(CharacterPredicates.ARABIC_NUMERALS.test('9'));
@@ -38,7 +38,7 @@ public void testArabicNumerals() {
3838
}
3939

4040
@Test
41-
public void testAsciiAlphaNumerals() {
41+
void testAsciiAlphaNumerals() {
4242
assertTrue(CharacterPredicates.ASCII_ALPHA_NUMERALS.test('a'));
4343
assertTrue(CharacterPredicates.ASCII_ALPHA_NUMERALS.test('z'));
4444
assertTrue(CharacterPredicates.ASCII_ALPHA_NUMERALS.test('A'));
@@ -55,7 +55,7 @@ public void testAsciiAlphaNumerals() {
5555
}
5656

5757
@Test
58-
public void testAsciiLetters() {
58+
void testAsciiLetters() {
5959
assertTrue(CharacterPredicates.ASCII_LETTERS.test('a'));
6060
assertTrue(CharacterPredicates.ASCII_LETTERS.test('z'));
6161
assertTrue(CharacterPredicates.ASCII_LETTERS.test('A'));
@@ -69,7 +69,7 @@ public void testAsciiLetters() {
6969
}
7070

7171
@Test
72-
public void testAsciiLowercaseLetters() {
72+
void testAsciiLowercaseLetters() {
7373
assertTrue(CharacterPredicates.ASCII_LOWERCASE_LETTERS.test('a'));
7474
assertTrue(CharacterPredicates.ASCII_LOWERCASE_LETTERS.test('z'));
7575

@@ -81,7 +81,7 @@ public void testAsciiLowercaseLetters() {
8181
}
8282

8383
@Test
84-
public void testAsciiUppercaseLetters() {
84+
void testAsciiUppercaseLetters() {
8585
assertTrue(CharacterPredicates.ASCII_UPPERCASE_LETTERS.test('A'));
8686
assertTrue(CharacterPredicates.ASCII_UPPERCASE_LETTERS.test('Z'));
8787

@@ -93,7 +93,7 @@ public void testAsciiUppercaseLetters() {
9393
}
9494

9595
@Test
96-
public void testDigits() {
96+
void testDigits() {
9797
assertTrue(CharacterPredicates.DIGITS.test('0'));
9898
assertTrue(CharacterPredicates.DIGITS.test('9'));
9999

@@ -103,7 +103,7 @@ public void testDigits() {
103103
}
104104

105105
@Test
106-
public void testLetters() {
106+
void testLetters() {
107107
assertTrue(CharacterPredicates.LETTERS.test('a'));
108108
assertTrue(CharacterPredicates.LETTERS.test('Z'));
109109

src/test/java/org/apache/commons/text/CompositeFormatTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class CompositeFormatTest {
3636
* Ensures that the parse/format separation is correctly maintained.
3737
*/
3838
@Test
39-
public void testCompositeFormat() {
39+
void testCompositeFormat() {
4040

4141
final Format parser = new Format() {
4242
private static final long serialVersionUID = 1L;
@@ -75,7 +75,7 @@ public Object parseObject(final String source, final ParsePosition pos) {
7575
}
7676

7777
@Test
78-
public void testUsage() throws Exception {
78+
void testUsage() throws Exception {
7979
final Format f1 = new SimpleDateFormat("MMddyyyy", Locale.ENGLISH);
8080
final Format f2 = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
8181
final CompositeFormat c = new CompositeFormat(f1, f2);

0 commit comments

Comments
 (0)