@@ -233,42 +233,62 @@ public void testEqualsHash() throws Exception {
233233 if (name .startsWith ("with" )) {
234234 for (final Class <?> cls : method .getParameterTypes ()) {
235235 final String type = cls .getCanonicalName ();
236- if ("boolean" .equals (type )) {
236+ switch (type ) {
237+ case "boolean" : {
237238 final Object defTrue = method .invoke (CSVFormat .DEFAULT , Boolean .TRUE );
238239 final Object defFalse = method .invoke (CSVFormat .DEFAULT , Boolean .FALSE );
239240 assertNotEquals (name , type , defTrue , defFalse );
240- } else if ("char" .equals (type )) {
241+ break ;
242+ }
243+ case "char" : {
241244 final Object a = method .invoke (CSVFormat .DEFAULT , 'a' );
242245 final Object b = method .invoke (CSVFormat .DEFAULT , 'b' );
243246 assertNotEquals (name , type , a , b );
244- } else if ("java.lang.Character" .equals (type )) {
247+ break ;
248+ }
249+ case "java.lang.Character" : {
245250 final Object a = method .invoke (CSVFormat .DEFAULT , new Object [] { null });
246251 final Object b = method .invoke (CSVFormat .DEFAULT , Character .valueOf ('d' ));
247252 assertNotEquals (name , type , a , b );
248- } else if ("java.lang.String" .equals (type )) {
253+ break ;
254+ }
255+ case "java.lang.String" : {
249256 final Object a = method .invoke (CSVFormat .DEFAULT , new Object [] { null });
250257 final Object b = method .invoke (CSVFormat .DEFAULT , "e" );
251258 assertNotEquals (name , type , a , b );
252- } else if ("java.lang.String[]" .equals (type )) {
259+ break ;
260+ }
261+ case "java.lang.String[]" : {
253262 final Object a = method .invoke (CSVFormat .DEFAULT , new Object [] { new String [] { null , null } });
254263 final Object b = method .invoke (CSVFormat .DEFAULT , new Object [] { new String [] { "f" , "g" } });
255264 assertNotEquals (name , type , a , b );
256- } else if ("org.apache.commons.csv.QuoteMode" .equals (type )) {
265+ break ;
266+ }
267+ case "org.apache.commons.csv.QuoteMode" : {
257268 final Object a = method .invoke (CSVFormat .DEFAULT , QuoteMode .MINIMAL );
258269 final Object b = method .invoke (CSVFormat .DEFAULT , QuoteMode .ALL );
259270 assertNotEquals (name , type , a , b );
260- } else if ("org.apache.commons.csv.DuplicateHeaderMode" .equals (type )) {
271+ break ;
272+ }
273+ case "org.apache.commons.csv.DuplicateHeaderMode" : {
261274 final Object a = method .invoke (CSVFormat .DEFAULT , DuplicateHeaderMode .ALLOW_ALL );
262275 final Object b = method .invoke (CSVFormat .DEFAULT , DuplicateHeaderMode .DISALLOW );
263276 assertNotEquals (name , type , a , b );
264- } else if ("java.lang.Object[]" .equals (type )) {
277+ break ;
278+ }
279+ case "java.lang.Object[]" : {
265280 final Object a = method .invoke (CSVFormat .DEFAULT , new Object [] { new Object [] { null , null } });
266281 final Object b = method .invoke (CSVFormat .DEFAULT , new Object [] { new Object [] { new Object (), new Object () } });
267282 assertNotEquals (name , type , a , b );
268- } else if ("withHeader" .equals (name )) { // covered above by String[]
269- // ignored
270- } else {
271- fail ("Unhandled method: " + name + "(" + type + ")" );
283+ break ;
284+ }
285+ default :
286+ if ("withHeader" .equals (name )) { // covered above by String[]
287+ // ignored
288+ } else {
289+ fail ("Unhandled method: " + name + "(" + type + ")" );
290+ }
291+ break ;
272292 }
273293 }
274294 }
0 commit comments