garydgregory commented on code in PR #49:
URL: https://github.com/apache/commons-beanutils/pull/49#discussion_r1478322429


##########
src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java:
##########
@@ -16,112 +16,107 @@
  */
 package org.apache.commons.beanutils2.converters;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.Converter;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test Case for the CharacterConverter class.
  */
-public class CharacterConverterTestCase extends TestCase {
-
-    /**
-     * Create Test Suite
-     *
-     * @return test suite
-     */
-    public static TestSuite suite() {
-        return new TestSuite(CharacterConverterTestCase.class);
-    }
+class CharacterConverterTestCase {
 
-    /**
-     * Constructs a new Character Converter test case.
-     *
-     * @param name Test Name
-     */
-    public CharacterConverterTestCase(final String name) {
-        super(name);
-    }
+    private Converter<Character> converter;
 
-    /** Sets Up */
-    @Override
+    @BeforeEach
     public void setUp() throws Exception {
+        converter = new CharacterConverter();
     }
 
-    /** Tear Down */
-    @Override
+    @AfterEach
     public void tearDown() throws Exception {
+        converter = null;
     }
 
     /**
      * Tests whether the primitive char class can be passed as target type.
      */
-    public void testConvertToChar() {
-        final Converter<Character> converter = new CharacterConverter();
-        assertEquals("Wrong result", Character.valueOf('F'), 
converter.convert(Character.TYPE, "FOO"));
+    @Test
+    void testConvertToChar() {
+        assertEquals(Character.valueOf('F'), converter.convert(Character.TYPE, 
"FOO"), "Wrong result");
     }
 
     /**
      * Test Conversion to Character
      */
-    public void testConvertToCharacter() {
-        final Converter<Character> converter = new CharacterConverter();
-        assertEquals("Character Test", Character.valueOf('N'), 
converter.convert(Character.class, Character.valueOf('N')));
-        assertEquals("String Test", Character.valueOf('F'), 
converter.convert(Character.class, "FOO"));
-        assertEquals("Integer Test", Character.valueOf('3'), 
converter.convert(Character.class, Integer.valueOf(321)));
+    @Test
+    void testConvertToCharacter() {
+        assertEquals(Character.valueOf('N'), 
converter.convert(Character.class, Character.valueOf('N')), "Character Test");
+        assertEquals(Character.valueOf('F'), 
converter.convert(Character.class, "FOO"), "String Test");
+        assertEquals(Character.valueOf('3'), 
converter.convert(Character.class, Integer.valueOf(321)), "Integer Test");
     }
 
     /**
      * Tests a conversion to character for null input if no default value is 
provided.
      */
-    public void testConvertToCharacterNullNoDefault() {
-        final Converter<Character> converter = new CharacterConverter();
-        try {
-            converter.convert(Character.class, null);
-            fail("Expected a ConversionException for null value");
-        } catch (final Exception e) {
-            // expected result
-        }
+    @Test
+    void testConvertToCharacterNullNoDefault() {
+        assertThrows(ConversionException.class, () -> 
converter.convert(Character.class, null));
     }
 
     /**
      * Test Conversion to String
      */
+    @Test
     @SuppressWarnings("unchecked") // testing raw conversion
-    public void testConvertToString() {
+    void testConvertToString() {

Review Comment:
   Hello @SethFalco 
   
   I am well aware of JUnit 5's style recommendations, but it does not change 
my mind. Think about it this way: JUnit 3, JUnit 4, now JUnit 5, each with its 
own quirks. In this case, the stability and consistency of our code base is 
more important that the musings of a third party library. This is an overreach 
IMO on JUnit's part. My view is that tests should use public as an obvious 
marker for "Yes, I am a test" (on top of `@Test` I know, sure). I think of it 
like a "main" method (run _me_). This leaves us with using package private in 
the _standard_ manner Java designed it, which in this case makes it obvious 
what is meant to be not accessible from another package. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to