Skip to content

Commit d17683d

Browse files
committed
Use JUnit 5 convention for @test method visibility
1 parent 44720fd commit d17683d

File tree

116 files changed

+959
-959
lines changed

Some content is hidden

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

116 files changed

+959
-959
lines changed

src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTest.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void tearDown() {
135135
* Corner cases on getDynaProperty invalid arguments.
136136
*/
137137
@Test
138-
public void testGetDescriptorArguments() {
138+
void testGetDescriptorArguments() {
139139
assertNull(bean.getDynaClass().getDynaProperty("unknown"));
140140
assertThrows(NullPointerException.class, () -> bean.getDynaClass().getDynaProperty(null));
141141
}
@@ -156,47 +156,47 @@ protected void testGetDescriptorBase(final String name, final Class<?> type) {
156156
* Positive getDynaProperty on property {@code booleanProperty}.
157157
*/
158158
@Test
159-
public void testGetDescriptorBoolean() {
159+
void testGetDescriptorBoolean() {
160160
testGetDescriptorBase("booleanProperty", Boolean.TYPE);
161161
}
162162

163163
/**
164164
* Positive getDynaProperty on property {@code doubleProperty}.
165165
*/
166166
@Test
167-
public void testGetDescriptorDouble() {
167+
void testGetDescriptorDouble() {
168168
testGetDescriptorBase("doubleProperty", Double.TYPE);
169169
}
170170

171171
/**
172172
* Positive getDynaProperty on property {@code floatProperty}.
173173
*/
174174
@Test
175-
public void testGetDescriptorFloat() {
175+
void testGetDescriptorFloat() {
176176
testGetDescriptorBase("floatProperty", Float.TYPE);
177177
}
178178

179179
/**
180180
* Positive getDynaProperty on property {@code intProperty}.
181181
*/
182182
@Test
183-
public void testGetDescriptorInt() {
183+
void testGetDescriptorInt() {
184184
testGetDescriptorBase("intProperty", Integer.TYPE);
185185
}
186186

187187
/**
188188
* Positive getDynaProperty on property {@code longProperty}.
189189
*/
190190
@Test
191-
public void testGetDescriptorLong() {
191+
void testGetDescriptorLong() {
192192
testGetDescriptorBase("longProperty", Long.TYPE);
193193
}
194194

195195
/**
196196
* Positive test for getDynaProperties(). Each property name listed in {@code properties} should be returned exactly once.
197197
*/
198198
@Test
199-
public void testGetDescriptors() {
199+
void testGetDescriptors() {
200200
final DynaProperty[] pd = bean.getDynaClass().getDynaProperties();
201201
assertNotNull(pd, "Got descriptors");
202202
final int[] count = new int[properties.length];
@@ -221,39 +221,39 @@ public void testGetDescriptors() {
221221
* Positive getDynaProperty on property {@code booleanSecond} that uses an "is" method as the getter.
222222
*/
223223
@Test
224-
public void testGetDescriptorSecond() {
224+
void testGetDescriptorSecond() {
225225
testGetDescriptorBase("booleanSecond", Boolean.TYPE);
226226
}
227227

228228
/**
229229
* Positive getDynaProperty on property {@code shortProperty}.
230230
*/
231231
@Test
232-
public void testGetDescriptorShort() {
232+
void testGetDescriptorShort() {
233233
testGetDescriptorBase("shortProperty", Short.TYPE);
234234
}
235235

236236
/**
237237
* Positive getDynaProperty on property {@code stringProperty}.
238238
*/
239239
@Test
240-
public void testGetDescriptorString() {
240+
void testGetDescriptorString() {
241241
testGetDescriptorBase("stringProperty", String.class);
242242
}
243243

244244
/**
245245
* Corner cases on getIndexedProperty invalid arguments.
246246
*/
247247
@Test
248-
public void testGetIndexedArguments() {
248+
void testGetIndexedArguments() {
249249
assertThrows(IndexOutOfBoundsException.class, () -> bean.get("intArray", -1));
250250
}
251251

252252
/**
253253
* Positive and negative tests on getIndexedProperty valid arguments.
254254
*/
255255
@Test
256-
public void testGetIndexedValues() {
256+
void testGetIndexedValues() {
257257
Object value = null;
258258
for (int i = 0; i < 5; i++) {
259259
value = bean.get("intArray", i);
@@ -283,7 +283,7 @@ public void testGetIndexedValues() {
283283
* Corner cases on getMappedProperty invalid arguments.
284284
*/
285285
@Test
286-
public void testGetMappedArguments() {
286+
void testGetMappedArguments() {
287287
final Object value = bean.get("mappedProperty", "unknown");
288288
assertNull(value, "Should not return a value");
289289
}
@@ -292,7 +292,7 @@ public void testGetMappedArguments() {
292292
* Positive and negative tests on getMappedProperty valid arguments.
293293
*/
294294
@Test
295-
public void testGetMappedValues() {
295+
void testGetMappedValues() {
296296
Object value = null;
297297
value = bean.get("mappedProperty", "First Key");
298298
assertEquals("First Value", value, "Can find first value");
@@ -306,15 +306,15 @@ public void testGetMappedValues() {
306306
* Corner cases on getSimpleProperty invalid arguments.
307307
*/
308308
@Test
309-
public void testGetSimpleArguments() {
309+
void testGetSimpleArguments() {
310310
assertThrows(NullPointerException.class, () -> bean.get(null));
311311
}
312312

313313
/**
314314
* Test getSimpleProperty on a boolean property.
315315
*/
316316
@Test
317-
public void testGetSimpleBoolean() {
317+
void testGetSimpleBoolean() {
318318
final Object value = bean.get("booleanProperty");
319319
assertNotNull(value, "Got a value");
320320
assertInstanceOf(Boolean.class, value, "Got correct type");
@@ -325,7 +325,7 @@ public void testGetSimpleBoolean() {
325325
* Test getSimpleProperty on a double property.
326326
*/
327327
@Test
328-
public void testGetSimpleDouble() {
328+
void testGetSimpleDouble() {
329329
final Object value = bean.get("doubleProperty");
330330
assertNotNull(value, "Got a value");
331331
assertInstanceOf(Double.class, value, "Got correct type");
@@ -336,7 +336,7 @@ public void testGetSimpleDouble() {
336336
* Test getSimpleProperty on a float property.
337337
*/
338338
@Test
339-
public void testGetSimpleFloat() {
339+
void testGetSimpleFloat() {
340340
final Object value = bean.get("floatProperty");
341341
assertNotNull(value, "Got a value");
342342
assertInstanceOf(Float.class, value, "Got correct type");
@@ -347,7 +347,7 @@ public void testGetSimpleFloat() {
347347
* Test getSimpleProperty on a int property.
348348
*/
349349
@Test
350-
public void testGetSimpleInt() {
350+
void testGetSimpleInt() {
351351
final Object value = bean.get("intProperty");
352352
assertNotNull(value, "Got a value");
353353
assertInstanceOf(Integer.class, value, "Got correct type");
@@ -358,7 +358,7 @@ public void testGetSimpleInt() {
358358
* Test getSimpleProperty on a long property.
359359
*/
360360
@Test
361-
public void testGetSimpleLong() {
361+
void testGetSimpleLong() {
362362
final Object value = bean.get("longProperty");
363363
assertNotNull(value, "Got a value");
364364
assertInstanceOf(Long.class, value, "Got correct type");
@@ -369,7 +369,7 @@ public void testGetSimpleLong() {
369369
* Test getSimpleProperty on a short property.
370370
*/
371371
@Test
372-
public void testGetSimpleShort() {
372+
void testGetSimpleShort() {
373373
final Object value = bean.get("shortProperty");
374374
assertNotNull(value, "Got a value");
375375
assertInstanceOf(Short.class, value, "Got correct type");
@@ -380,7 +380,7 @@ public void testGetSimpleShort() {
380380
* Test getSimpleProperty on a String property.
381381
*/
382382
@Test
383-
public void testGetSimpleString() {
383+
void testGetSimpleString() {
384384
final Object value = bean.get("stringProperty");
385385
assertNotNull(value, "Got a value");
386386
assertInstanceOf(String.class, value, "Got correct type");
@@ -391,7 +391,7 @@ public void testGetSimpleString() {
391391
* Test {@code contains()} method for mapped properties.
392392
*/
393393
@Test
394-
public void testMappedContains() {
394+
void testMappedContains() {
395395
assertTrue(bean.contains("mappedProperty", "First Key"), "Can see first key");
396396
assertFalse(bean.contains("mappedProperty", "Unknown Key"), "Can not see unknown key");
397397
}
@@ -400,7 +400,7 @@ public void testMappedContains() {
400400
* Test {@code remove()} method for mapped properties.
401401
*/
402402
@Test
403-
public void testMappedRemove() {
403+
void testMappedRemove() {
404404
assertTrue(bean.contains("mappedProperty", "First Key"), "Can see first key");
405405
bean.remove("mappedProperty", "First Key");
406406
assertFalse(bean.contains("mappedProperty", "First Key"), "Can not see first key");
@@ -413,7 +413,7 @@ public void testMappedRemove() {
413413
* Test serialization and deserialization.
414414
*/
415415
@Test
416-
public void testNotSerializableException() throws Exception {
416+
void testNotSerializableException() throws Exception {
417417
// Serialize the test bean
418418
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
419419
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
@@ -433,15 +433,15 @@ public void testNotSerializableException() throws Exception {
433433
* Corner cases on setIndexedProperty invalid arguments.
434434
*/
435435
@Test
436-
public void testSetIndexedArguments() {
436+
void testSetIndexedArguments() {
437437
assertThrows(IndexOutOfBoundsException.class, () -> bean.set("intArray", -1, Integer.valueOf(0)));
438438
}
439439

440440
/**
441441
* Positive and negative tests on setIndexedProperty valid arguments.
442442
*/
443443
@Test
444-
public void testSetIndexedValues() {
444+
void testSetIndexedValues() {
445445
Object value = null;
446446
bean.set("intArray", 0, Integer.valueOf(1));
447447
value = bean.get("intArray", 0);
@@ -474,7 +474,7 @@ public void testSetIndexedValues() {
474474
* Positive and negative tests on setMappedProperty valid arguments.
475475
*/
476476
@Test
477-
public void testSetMappedValues() {
477+
void testSetMappedValues() {
478478
bean.set("mappedProperty", "First Key", "New First Value");
479479
assertEquals("New First Value", (String) bean.get("mappedProperty", "First Key"), "Can replace old value");
480480
bean.set("mappedProperty", "Fourth Key", "Fourth Value");
@@ -485,7 +485,7 @@ public void testSetMappedValues() {
485485
* Test setSimpleProperty on a boolean property.
486486
*/
487487
@Test
488-
public void testSetSimpleBoolean() {
488+
void testSetSimpleBoolean() {
489489
final boolean oldValue = ((Boolean) bean.get("booleanProperty")).booleanValue();
490490
final boolean newValue = !oldValue;
491491
bean.set("booleanProperty", Boolean.valueOf(newValue));
@@ -496,7 +496,7 @@ public void testSetSimpleBoolean() {
496496
* Test setSimpleProperty on a double property.
497497
*/
498498
@Test
499-
public void testSetSimpleDouble() {
499+
void testSetSimpleDouble() {
500500
final double oldValue = ((Double) bean.get("doubleProperty")).doubleValue();
501501
final double newValue = oldValue + 1.0;
502502
bean.set("doubleProperty", Double.valueOf(newValue));
@@ -507,7 +507,7 @@ public void testSetSimpleDouble() {
507507
* Test setSimpleProperty on a float property.
508508
*/
509509
@Test
510-
public void testSetSimpleFloat() {
510+
void testSetSimpleFloat() {
511511
final float oldValue = ((Float) bean.get("floatProperty")).floatValue();
512512
final float newValue = oldValue + (float) 1.0;
513513
bean.set("floatProperty", Float.valueOf(newValue));
@@ -518,7 +518,7 @@ public void testSetSimpleFloat() {
518518
* Test setSimpleProperty on a int property.
519519
*/
520520
@Test
521-
public void testSetSimpleInt() {
521+
void testSetSimpleInt() {
522522
final int oldValue = ((Integer) bean.get("intProperty")).intValue();
523523
final int newValue = oldValue + 1;
524524
bean.set("intProperty", Integer.valueOf(newValue));
@@ -529,7 +529,7 @@ public void testSetSimpleInt() {
529529
* Test setSimpleProperty on a long property.
530530
*/
531531
@Test
532-
public void testSetSimpleLong() {
532+
void testSetSimpleLong() {
533533
final long oldValue = ((Long) bean.get("longProperty")).longValue();
534534
final long newValue = oldValue + 1;
535535
bean.set("longProperty", Long.valueOf(newValue));
@@ -540,7 +540,7 @@ public void testSetSimpleLong() {
540540
* Test setSimpleProperty on a short property.
541541
*/
542542
@Test
543-
public void testSetSimpleShort() {
543+
void testSetSimpleShort() {
544544
final short oldValue = ((Short) bean.get("shortProperty")).shortValue();
545545
final short newValue = (short) (oldValue + 1);
546546
bean.set("shortProperty", Short.valueOf(newValue));
@@ -551,7 +551,7 @@ public void testSetSimpleShort() {
551551
* Test setSimpleProperty on a String property.
552552
*/
553553
@Test
554-
public void testSetSimpleString() {
554+
void testSetSimpleString() {
555555
final String oldValue = (String) bean.get("stringProperty");
556556
final String newValue = oldValue + " Extra Value";
557557
bean.set("stringProperty", newValue);

src/test/java/org/apache/commons/beanutils2/BeanComparatorTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void tearDown() {
6262
* Tests comparing one bean against itself.
6363
*/
6464
@Test
65-
public void testCompareBeanAgainstSelf() {
65+
void testCompareBeanAgainstSelf() {
6666
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("name");
6767
final int result = beanComparator.compare(alphaBean1, alphaBean1);
6868
assertEquals(0, result, () -> "Comparator did not sort properly. Result:" + result);
@@ -72,7 +72,7 @@ public void testCompareBeanAgainstSelf() {
7272
* Tests comparing two beans via their name using the default Comparator where they have the same value.
7373
*/
7474
@Test
75-
public void testCompareIdentical() {
75+
void testCompareIdentical() {
7676
alphaBean1 = new AlphaBean("alphabean");
7777
alphaBean2 = new AlphaBean("alphabean");
7878
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("name");
@@ -84,7 +84,7 @@ public void testCompareIdentical() {
8484
* Tests comparing two beans on a boolean property, which is not possible.
8585
*/
8686
@Test
87-
public void testCompareOnBooleanProperty() {
87+
void testCompareOnBooleanProperty() {
8888
try {
8989
final TestBean testBeanA = new TestBean();
9090
final TestBean testBeanB = new TestBean();
@@ -108,7 +108,7 @@ public void testCompareOnBooleanProperty() {
108108
* Tests comparing two beans who don't have a property
109109
*/
110110
@Test
111-
public void testCompareOnMissingProperty() {
111+
void testCompareOnMissingProperty() {
112112
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("bogusName");
113113
final Exception e = assertThrows(RuntimeException.class, () -> beanComparator.compare(alphaBean2, alphaBean1));
114114
assertTrue(e.toString().contains("Unknown property"), () -> "Wrong exception was thrown: " + e);
@@ -118,7 +118,7 @@ public void testCompareOnMissingProperty() {
118118
* Tests comparing two beans via their name using the default Comparator, but with one of the beans being null.
119119
*/
120120
@Test
121-
public void testCompareWithNulls() {
121+
void testCompareWithNulls() {
122122
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("name");
123123
assertThrows(NullPointerException.class, () -> beanComparator.compare(alphaBean2, null));
124124
}
@@ -127,7 +127,7 @@ public void testCompareWithNulls() {
127127
* Tests comparing two beans on a boolean property, then changing the property and testing/
128128
*/
129129
@Test
130-
public void testSetProperty() {
130+
void testSetProperty() {
131131
final TestBean testBeanA = new TestBean();
132132
final TestBean testBeanB = new TestBean();
133133

@@ -153,7 +153,7 @@ public void testSetProperty() {
153153
* Tests comparing two beans via their name using the default Comparator
154154
*/
155155
@Test
156-
public void testSimpleCompare() {
156+
void testSimpleCompare() {
157157
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("name");
158158
final int result = beanComparator.compare(alphaBean1, alphaBean2);
159159
assertEquals(-1, result, () -> "Comparator did not sort properly. Result:" + result);
@@ -163,7 +163,7 @@ public void testSimpleCompare() {
163163
* Tests comparing two beans via their name using the default Comparator, but the inverse
164164
*/
165165
@Test
166-
public void testSimpleCompareInverse() {
166+
void testSimpleCompareInverse() {
167167
final BeanComparator<AlphaBean, String> beanComparator = new BeanComparator<>("name");
168168
final int result = beanComparator.compare(alphaBean2, alphaBean1);
169169
assertEquals(1, result, () -> "Comparator did not sort properly. Result:" + result);

0 commit comments

Comments
 (0)