This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


The following commit(s) were added to refs/heads/master by this push:
     new 7bad6190 Convert cascading if-else to switch
7bad6190 is described below

commit 7bad6190729b84216dc5ca7cc3e63814e7518a5a
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Sep 12 11:00:55 2024 -0400

    Convert cascading if-else to switch
---
 .../commons/validator/routines/IBANValidatorTest.java     | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
index d83900cc..c2098355 100644
--- a/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
@@ -207,14 +207,21 @@ public class IBANValidatorTest {
             CSVRecord length = null;
             for (final CSVRecord o : p) {
                 final String item = o.get(0);
-                if ("Name of country".equals(item)) {
+                switch (item) {
+                case "Name of country":
                     country = o;
-                } else if ("IBAN prefix country code (ISO 3166)".equals(item)) 
{
+                    break;
+                case "IBAN prefix country code (ISO 3166)":
                     cc = o;
-                } else if ("IBAN structure".equals(item)) {
+                    break;
+                case "IBAN structure":
                     structure = o;
-                } else if ("IBAN length".equals(item)) {
+                    break;
+                case "IBAN length":
                     length = o;
+                    break;
+                default:
+                    break;
                 }
             }
             assertNotNull(country);

Reply via email to