From cff5c0b5521586f2183d49c238d853448b88bf19 Mon Sep 17 00:00:00 2001 From: ptorres-prowide Date: Fri, 23 Aug 2024 21:08:34 -0300 Subject: [PATCH] CU-86b1g1mye_SRU2024_Generar-un-enum-de-FieldNames-para-validar-que-el-Field-exista --- .../swift/model/field/FieldEnum.java | 740 +++++++++++++++++ .../swift/model/field/SRU2024FieldEnum.java | 746 ------------------ .../swift/model/field/FieldEnumTest.java | 48 ++ 3 files changed, 788 insertions(+), 746 deletions(-) create mode 100644 src/generated/java/com/prowidesoftware/swift/model/field/FieldEnum.java delete mode 100644 src/generated/java/com/prowidesoftware/swift/model/field/SRU2024FieldEnum.java create mode 100644 src/test/java/com/prowidesoftware/swift/model/field/FieldEnumTest.java diff --git a/src/generated/java/com/prowidesoftware/swift/model/field/FieldEnum.java b/src/generated/java/com/prowidesoftware/swift/model/field/FieldEnum.java new file mode 100644 index 000000000..68a1116e0 --- /dev/null +++ b/src/generated/java/com/prowidesoftware/swift/model/field/FieldEnum.java @@ -0,0 +1,740 @@ +/* +* Copyright 2006-2024 Prowide +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.prowidesoftware.swift.model.field; + +/** +* Enumeration of fields for SRU 2024 +* +* @since 9.5.2 +*/ +public enum FieldEnum { + + F11A, + F11R, + F11S, + F11T, + F12A, + F12B, + F12C, + F12D, + F12E, + F12F, + F12G, + F12H, + F12K, + F12L, + F12R, + F12S, + F12, + F13A, + F13B, + F13C, + F13D, + F13E, + F13J, + F13K, + F14A, + F14B, + F14C, + F14D, + F14E, + F14F, + F14G, + F14H, + F14K, + F14L, + F14M, + F14N, + F14O, + F14J, + F14P, + F14Q, + F14R, + F14S, + F15A, + F15B, + F15C, + F15D, + F15E, + F15F, + F15G, + F15H, + F15I, + F15J, + F15K, + F15L, + F15M, + F15N, + F15O, + F15P, + F16A, + F16C, + F16D, + F16R, + F16S, + F16W, + F17A, + F17B, + F17C, + F17E, + F17F, + F17G, + F17H, + F17I, + F17L, + F17M, + F17N, + F17O, + F17P, + F17Q, + F17R, + F17S, + F17T, + F17U, + F17V, + F17W, + F17X, + F17Y, + F17Z, + F18A, + F18B, + F18C, + F18D, + F19A, + F19B, + F19C, + F19Y, + F19Z, + F19, + F20C, + F20D, + F20E, + F20U, + F20, + F21A, + F21B, + F21C, + F21D, + F21E, + F21F, + F21G, + F21H, + F21N, + F21P, + F21R, + F21S, + F21T, + F21, + F22A, + F22B, + F22C, + F22D, + F22E, + F22F, + F22G, + F22H, + F22K, + F22L, + F22M, + F22N, + F22P, + F22Q, + F22R, + F22S, + F22T, + F22U, + F22V, + F22W, + F22X, + F22Y, + F22Z, + F22, + F23A, + F23B, + F23C, + F23D, + F23E, + F23F, + F23G, + F23H, + F23R, + F23S, + F23X, + F23, + F24B, + F24D, + F24E, + F24G, + F25A, + F25D, + F25F, + F25G, + F25P, + F25, + F26A, + F26B, + F26C, + F26D, + F26E, + F26F, + F26H, + F26K, + F26T, + F27, + F27A, + F28C, + F28D, + F28E, + F28, + F29A, + F29B, + F29D, + F29E, + F29F, + F29H, + F29I, + F29J, + F29L, + F29M, + F29N, + F29O, + F29P, + F29S, + F29T, + F29U, + F29Q, + F29W, + F30F, + F30G, + F30H, + F30I, + F30J, + F30K, + F30M, + F30N, + F30P, + F30Q, + F30S, + F30T, + F30U, + F30V, + F30X, + F30Y, + F30Z, + F30, + F31C, + F31D, + F31E, + F31F, + F31G, + F31J, + F31K, + F31L, + F31M, + F31N, + F31P, + F31R, + F31S, + F31T, + F31X, + F32A, + F32B, + F32C, + F32D, + F32E, + F32F, + F32G, + F32H, + F32K, + F32M, + F32Q, + F32R, + F32U, + F33A, + F33B, + F33C, + F33D, + F33E, + F33F, + F33G, + F33H, + F33J, + F33K, + F33S, + F33T, + F33Z, + F34A, + F34B, + F34C, + F34D, + F34E, + F34F, + F34J, + F34K, + F34L, + F34M, + F34O, + F34P, + F34R, + F34S, + F34T, + F34U, + F34V, + F34W, + F34X, + F34Y, + F35A, + F35B, + F35C, + F35D, + F35E, + F35G, + F35H, + F35L, + F35N, + F35S, + F35U, + F36B, + F36C, + F36D, + F36E, + F36, + F37A, + F37B, + F37C, + F37D, + F37E, + F37F, + F37G, + F37H, + F37J, + F37K, + F37L, + F37M, + F37N, + F37R, + F37V, + F38A, + F38D, + F38E, + F38G, + F38H, + F38J, + F39A, + F39B, + F39C, + F39E, + F39F, + F39M, + F40A, + F40B, + F40C, + F40D, + F40E, + F40F, + F41A, + F41D, + F41F, + F41G, + F42A, + F42C, + F42D, + F42M, + F42P, + F43P, + F43T, + F44A, + F44B, + F44C, + F44D, + F44E, + F44F, + F44J, + F45A, + F45B, + F45C, + F45D, + F45L, + F46A, + F46B, + F47A, + F47B, + F47E, + F48B, + F48D, + F48, + F49A, + F49D, + F49F, + F49G, + F49H, + F49J, + F49K, + F49L, + F49M, + F49N, + F49Y, + F49Z, + F49, + F50A, + F50B, + F50C, + F50D, + F50F, + F50G, + F50H, + F50K, + F50L, + F50, + F51A, + F51C, + F51D, + F51, + F52A, + F52B, + F52C, + F52D, + F53A, + F53B, + F53C, + F53D, + F53J, + F54A, + F54B, + F54D, + F55A, + F55B, + F55D, + F56A, + F56B, + F56C, + F56D, + F56J, + F57A, + F57B, + F57C, + F57D, + F57J, + F58A, + F58B, + F58D, + F58J, + F59A, + F59F, + F59K, + F59, + F60F, + F60M, + F61, + F62F, + F62M, + F64, + F65, + F68A, + F69A, + F69B, + F69C, + F69D, + F69E, + F69F, + F69J, + F70C, + F70D, + F70E, + F70F, + F70G, + F70H, + F70, + F71A, + F71B, + F71C, + F71D, + F71E, + F71F, + F71G, + F71M, + F71N, + F72Z, + F72, + F73A, + F73R, + F73S, + F73, + F74, + F75, + F76, + F77A, + F77B, + F77C, + F77D, + F77E, + F77F, + F77H, + F77J, + F77L, + F77T, + F77U, + F77, + F78B, + F78, + F78D, + F79Z, + F79, + F80C, + F81A, + F81D, + F81J, + F82A, + F82B, + F82D, + F82J, + F83A, + F83C, + F83D, + F83J, + F84A, + F84B, + F84D, + F84J, + F85A, + F85B, + F85D, + F85J, + F86A, + F86B, + F86D, + F86J, + F86, + F87A, + F87B, + F87D, + F87J, + F88A, + F88B, + F88D, + F88J, + F89A, + F89D, + F89J, + F90A, + F90B, + F90C, + F90D, + F90E, + F90F, + F90J, + F90K, + F90L, + F91A, + F91D, + F91J, + F92A, + F92B, + F92C, + F92D, + F92F, + F92H, + F92J, + F92K, + F92L, + F92M, + F92N, + F92P, + F92R, + F93A, + F93B, + F93C, + F93D, + F93E, + F93F, + F94A, + F94B, + F94C, + F94D, + F94E, + F94F, + F94G, + F94H, + F94L, + F95C, + F95L, + F95P, + F95Q, + F95R, + F95S, + F95U, + F95V, + F96A, + F96D, + F96J, + F97A, + F97B, + F97C, + F97D, + F97E, + F98A, + F98B, + F98C, + F98D, + F98E, + F98F, + F98G, + F98H, + F98J, + F98K, + F99A, + F99B, + F99C, + F101, + F102, + F103, + F104, + F105, + F106, + F107, + F108, + F109, + F110, + F111, + F113, + F114, + F115, + F116, + F117, + F118, + F119, + F120, + F121, + F122, + F123, + F124, + F125, + F126, + F127, + F128, + F129, + F130, + F132, + F133, + F134, + F135, + F136, + F137, + F140, + F141, + F142, + F143, + F144, + F151, + F152, + F153, + F165, + F171, + F172, + F173, + F174, + F175, + F177, + F179, + F199, + F202, + F203, + F204, + F206, + F208, + F209, + F242, + F243, + F251, + F252, + F253, + F254, + F255, + F256, + F257, + F258, + F259, + F260, + F263, + F264, + F270, + F271, + F272, + F280, + F281, + F301, + F302, + F303, + F304, + F305, + F307, + F311, + F312, + F313, + F329, + F330, + F331, + F332, + F333, + F334, + F335, + F336, + F337, + F338, + F339, + F340, + F341, + F342, + F343, + F344, + F345, + F346, + F347, + F348, + F349, + F401, + F405, + F421, + F422, + F423, + F424, + F425, + F431, + F432, + F433, + F434, + F443, + F451, + F461, + F503, + F533, + F619, + F999; + + public String getFieldName() { + return name().substring(1); // Skips the first character 'F' and returns the rest of the name + } + + public static FieldEnum fromCode(String code) { + for (FieldEnum field : FieldEnum.values()) { + if (field.getFieldName().equals(code)) { + return field; + } + } + return null; + } +} diff --git a/src/generated/java/com/prowidesoftware/swift/model/field/SRU2024FieldEnum.java b/src/generated/java/com/prowidesoftware/swift/model/field/SRU2024FieldEnum.java deleted file mode 100644 index 51859baca..000000000 --- a/src/generated/java/com/prowidesoftware/swift/model/field/SRU2024FieldEnum.java +++ /dev/null @@ -1,746 +0,0 @@ -/* -* Copyright 2006-2024 Prowide -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.prowidesoftware.swift.model.field; - -/** -* Enumeration of fields for SRU 2024 -* -* @since 9.5.2 -*/ -public enum FieldEnum { - - FIELD_11A("11A"), - FIELD_11R("11R"), - FIELD_11S("11S"), - FIELD_11T("11T"), - FIELD_12A("12A"), - FIELD_12B("12B"), - FIELD_12C("12C"), - FIELD_12D("12D"), - FIELD_12E("12E"), - FIELD_12F("12F"), - FIELD_12G("12G"), - FIELD_12H("12H"), - FIELD_12K("12K"), - FIELD_12L("12L"), - FIELD_12R("12R"), - FIELD_12S("12S"), - FIELD_12("12"), - FIELD_13A("13A"), - FIELD_13B("13B"), - FIELD_13C("13C"), - FIELD_13D("13D"), - FIELD_13E("13E"), - FIELD_13J("13J"), - FIELD_13K("13K"), - FIELD_14A("14A"), - FIELD_14B("14B"), - FIELD_14C("14C"), - FIELD_14D("14D"), - FIELD_14E("14E"), - FIELD_14F("14F"), - FIELD_14G("14G"), - FIELD_14H("14H"), - FIELD_14K("14K"), - FIELD_14L("14L"), - FIELD_14M("14M"), - FIELD_14N("14N"), - FIELD_14O("14O"), - FIELD_14J("14J"), - FIELD_14P("14P"), - FIELD_14Q("14Q"), - FIELD_14R("14R"), - FIELD_14S("14S"), - FIELD_15A("15A"), - FIELD_15B("15B"), - FIELD_15C("15C"), - FIELD_15D("15D"), - FIELD_15E("15E"), - FIELD_15F("15F"), - FIELD_15G("15G"), - FIELD_15H("15H"), - FIELD_15I("15I"), - FIELD_15J("15J"), - FIELD_15K("15K"), - FIELD_15L("15L"), - FIELD_15M("15M"), - FIELD_15N("15N"), - FIELD_15O("15O"), - FIELD_15P("15P"), - FIELD_16A("16A"), - FIELD_16C("16C"), - FIELD_16D("16D"), - FIELD_16R("16R"), - FIELD_16S("16S"), - FIELD_16W("16W"), - FIELD_17A("17A"), - FIELD_17B("17B"), - FIELD_17C("17C"), - FIELD_17E("17E"), - FIELD_17F("17F"), - FIELD_17G("17G"), - FIELD_17H("17H"), - FIELD_17I("17I"), - FIELD_17L("17L"), - FIELD_17M("17M"), - FIELD_17N("17N"), - FIELD_17O("17O"), - FIELD_17P("17P"), - FIELD_17Q("17Q"), - FIELD_17R("17R"), - FIELD_17S("17S"), - FIELD_17T("17T"), - FIELD_17U("17U"), - FIELD_17V("17V"), - FIELD_17W("17W"), - FIELD_17X("17X"), - FIELD_17Y("17Y"), - FIELD_17Z("17Z"), - FIELD_18A("18A"), - FIELD_18B("18B"), - FIELD_18C("18C"), - FIELD_18D("18D"), - FIELD_19A("19A"), - FIELD_19B("19B"), - FIELD_19C("19C"), - FIELD_19Y("19Y"), - FIELD_19Z("19Z"), - FIELD_19("19"), - FIELD_20C("20C"), - FIELD_20D("20D"), - FIELD_20E("20E"), - FIELD_20U("20U"), - FIELD_20("20"), - FIELD_21A("21A"), - FIELD_21B("21B"), - FIELD_21C("21C"), - FIELD_21D("21D"), - FIELD_21E("21E"), - FIELD_21F("21F"), - FIELD_21G("21G"), - FIELD_21H("21H"), - FIELD_21N("21N"), - FIELD_21P("21P"), - FIELD_21R("21R"), - FIELD_21S("21S"), - FIELD_21T("21T"), - FIELD_21("21"), - FIELD_22A("22A"), - FIELD_22B("22B"), - FIELD_22C("22C"), - FIELD_22D("22D"), - FIELD_22E("22E"), - FIELD_22F("22F"), - FIELD_22G("22G"), - FIELD_22H("22H"), - FIELD_22K("22K"), - FIELD_22L("22L"), - FIELD_22M("22M"), - FIELD_22N("22N"), - FIELD_22P("22P"), - FIELD_22Q("22Q"), - FIELD_22R("22R"), - FIELD_22S("22S"), - FIELD_22T("22T"), - FIELD_22U("22U"), - FIELD_22V("22V"), - FIELD_22W("22W"), - FIELD_22X("22X"), - FIELD_22Y("22Y"), - FIELD_22Z("22Z"), - FIELD_22("22"), - FIELD_23A("23A"), - FIELD_23B("23B"), - FIELD_23C("23C"), - FIELD_23D("23D"), - FIELD_23E("23E"), - FIELD_23F("23F"), - FIELD_23G("23G"), - FIELD_23H("23H"), - FIELD_23R("23R"), - FIELD_23S("23S"), - FIELD_23X("23X"), - FIELD_23("23"), - FIELD_24B("24B"), - FIELD_24D("24D"), - FIELD_24E("24E"), - FIELD_24G("24G"), - FIELD_25A("25A"), - FIELD_25D("25D"), - FIELD_25F("25F"), - FIELD_25G("25G"), - FIELD_25P("25P"), - FIELD_25("25"), - FIELD_26A("26A"), - FIELD_26B("26B"), - FIELD_26C("26C"), - FIELD_26D("26D"), - FIELD_26E("26E"), - FIELD_26F("26F"), - FIELD_26H("26H"), - FIELD_26K("26K"), - FIELD_26T("26T"), - FIELD_27("27"), - FIELD_27A("27A"), - FIELD_28C("28C"), - FIELD_28D("28D"), - FIELD_28E("28E"), - FIELD_28("28"), - FIELD_29A("29A"), - FIELD_29B("29B"), - FIELD_29D("29D"), - FIELD_29E("29E"), - FIELD_29F("29F"), - FIELD_29H("29H"), - FIELD_29I("29I"), - FIELD_29J("29J"), - FIELD_29L("29L"), - FIELD_29M("29M"), - FIELD_29N("29N"), - FIELD_29O("29O"), - FIELD_29P("29P"), - FIELD_29S("29S"), - FIELD_29T("29T"), - FIELD_29U("29U"), - FIELD_29Q("29Q"), - FIELD_29W("29W"), - FIELD_30F("30F"), - FIELD_30G("30G"), - FIELD_30H("30H"), - FIELD_30I("30I"), - FIELD_30J("30J"), - FIELD_30K("30K"), - FIELD_30M("30M"), - FIELD_30N("30N"), - FIELD_30P("30P"), - FIELD_30Q("30Q"), - FIELD_30S("30S"), - FIELD_30T("30T"), - FIELD_30U("30U"), - FIELD_30V("30V"), - FIELD_30X("30X"), - FIELD_30Y("30Y"), - FIELD_30Z("30Z"), - FIELD_30("30"), - FIELD_31C("31C"), - FIELD_31D("31D"), - FIELD_31E("31E"), - FIELD_31F("31F"), - FIELD_31G("31G"), - FIELD_31J("31J"), - FIELD_31K("31K"), - FIELD_31L("31L"), - FIELD_31M("31M"), - FIELD_31N("31N"), - FIELD_31P("31P"), - FIELD_31R("31R"), - FIELD_31S("31S"), - FIELD_31T("31T"), - FIELD_31X("31X"), - FIELD_32A("32A"), - FIELD_32B("32B"), - FIELD_32C("32C"), - FIELD_32D("32D"), - FIELD_32E("32E"), - FIELD_32F("32F"), - FIELD_32G("32G"), - FIELD_32H("32H"), - FIELD_32K("32K"), - FIELD_32M("32M"), - FIELD_32Q("32Q"), - FIELD_32R("32R"), - FIELD_32U("32U"), - FIELD_33A("33A"), - FIELD_33B("33B"), - FIELD_33C("33C"), - FIELD_33D("33D"), - FIELD_33E("33E"), - FIELD_33F("33F"), - FIELD_33G("33G"), - FIELD_33H("33H"), - FIELD_33J("33J"), - FIELD_33K("33K"), - FIELD_33S("33S"), - FIELD_33T("33T"), - FIELD_33Z("33Z"), - FIELD_34A("34A"), - FIELD_34B("34B"), - FIELD_34C("34C"), - FIELD_34D("34D"), - FIELD_34E("34E"), - FIELD_34F("34F"), - FIELD_34J("34J"), - FIELD_34K("34K"), - FIELD_34L("34L"), - FIELD_34M("34M"), - FIELD_34O("34O"), - FIELD_34P("34P"), - FIELD_34R("34R"), - FIELD_34S("34S"), - FIELD_34T("34T"), - FIELD_34U("34U"), - FIELD_34V("34V"), - FIELD_34W("34W"), - FIELD_34X("34X"), - FIELD_34Y("34Y"), - FIELD_35A("35A"), - FIELD_35B("35B"), - FIELD_35C("35C"), - FIELD_35D("35D"), - FIELD_35E("35E"), - FIELD_35G("35G"), - FIELD_35H("35H"), - FIELD_35L("35L"), - FIELD_35N("35N"), - FIELD_35S("35S"), - FIELD_35U("35U"), - FIELD_36B("36B"), - FIELD_36C("36C"), - FIELD_36D("36D"), - FIELD_36E("36E"), - FIELD_36("36"), - FIELD_37A("37A"), - FIELD_37B("37B"), - FIELD_37C("37C"), - FIELD_37D("37D"), - FIELD_37E("37E"), - FIELD_37F("37F"), - FIELD_37G("37G"), - FIELD_37H("37H"), - FIELD_37J("37J"), - FIELD_37K("37K"), - FIELD_37L("37L"), - FIELD_37M("37M"), - FIELD_37N("37N"), - FIELD_37R("37R"), - FIELD_37V("37V"), - FIELD_38A("38A"), - FIELD_38D("38D"), - FIELD_38E("38E"), - FIELD_38G("38G"), - FIELD_38H("38H"), - FIELD_38J("38J"), - FIELD_39A("39A"), - FIELD_39B("39B"), - FIELD_39C("39C"), - FIELD_39E("39E"), - FIELD_39F("39F"), - FIELD_39M("39M"), - FIELD_40A("40A"), - FIELD_40B("40B"), - FIELD_40C("40C"), - FIELD_40D("40D"), - FIELD_40E("40E"), - FIELD_40F("40F"), - FIELD_41A("41A"), - FIELD_41D("41D"), - FIELD_41F("41F"), - FIELD_41G("41G"), - FIELD_42A("42A"), - FIELD_42C("42C"), - FIELD_42D("42D"), - FIELD_42M("42M"), - FIELD_42P("42P"), - FIELD_43P("43P"), - FIELD_43T("43T"), - FIELD_44A("44A"), - FIELD_44B("44B"), - FIELD_44C("44C"), - FIELD_44D("44D"), - FIELD_44E("44E"), - FIELD_44F("44F"), - FIELD_44J("44J"), - FIELD_45A("45A"), - FIELD_45B("45B"), - FIELD_45C("45C"), - FIELD_45D("45D"), - FIELD_45L("45L"), - FIELD_46A("46A"), - FIELD_46B("46B"), - FIELD_47A("47A"), - FIELD_47B("47B"), - FIELD_47E("47E"), - FIELD_48B("48B"), - FIELD_48D("48D"), - FIELD_48("48"), - FIELD_49A("49A"), - FIELD_49D("49D"), - FIELD_49F("49F"), - FIELD_49G("49G"), - FIELD_49H("49H"), - FIELD_49J("49J"), - FIELD_49K("49K"), - FIELD_49L("49L"), - FIELD_49M("49M"), - FIELD_49N("49N"), - FIELD_49Y("49Y"), - FIELD_49Z("49Z"), - FIELD_49("49"), - FIELD_50A("50A"), - FIELD_50B("50B"), - FIELD_50C("50C"), - FIELD_50D("50D"), - FIELD_50F("50F"), - FIELD_50G("50G"), - FIELD_50H("50H"), - FIELD_50K("50K"), - FIELD_50L("50L"), - FIELD_50("50"), - FIELD_51A("51A"), - FIELD_51C("51C"), - FIELD_51D("51D"), - FIELD_51("51"), - FIELD_52A("52A"), - FIELD_52B("52B"), - FIELD_52C("52C"), - FIELD_52D("52D"), - FIELD_53A("53A"), - FIELD_53B("53B"), - FIELD_53C("53C"), - FIELD_53D("53D"), - FIELD_53J("53J"), - FIELD_54A("54A"), - FIELD_54B("54B"), - FIELD_54D("54D"), - FIELD_55A("55A"), - FIELD_55B("55B"), - FIELD_55D("55D"), - FIELD_56A("56A"), - FIELD_56B("56B"), - FIELD_56C("56C"), - FIELD_56D("56D"), - FIELD_56J("56J"), - FIELD_57A("57A"), - FIELD_57B("57B"), - FIELD_57C("57C"), - FIELD_57D("57D"), - FIELD_57J("57J"), - FIELD_58A("58A"), - FIELD_58B("58B"), - FIELD_58D("58D"), - FIELD_58J("58J"), - FIELD_59A("59A"), - FIELD_59F("59F"), - FIELD_59K("59K"), - FIELD_59("59"), - FIELD_60F("60F"), - FIELD_60M("60M"), - FIELD_61("61"), - FIELD_62F("62F"), - FIELD_62M("62M"), - FIELD_64("64"), - FIELD_65("65"), - FIELD_68A("68A"), - FIELD_69A("69A"), - FIELD_69B("69B"), - FIELD_69C("69C"), - FIELD_69D("69D"), - FIELD_69E("69E"), - FIELD_69F("69F"), - FIELD_69J("69J"), - FIELD_70C("70C"), - FIELD_70D("70D"), - FIELD_70E("70E"), - FIELD_70F("70F"), - FIELD_70G("70G"), - FIELD_70H("70H"), - FIELD_70("70"), - FIELD_71A("71A"), - FIELD_71B("71B"), - FIELD_71C("71C"), - FIELD_71D("71D"), - FIELD_71E("71E"), - FIELD_71F("71F"), - FIELD_71G("71G"), - FIELD_71M("71M"), - FIELD_71N("71N"), - FIELD_72Z("72Z"), - FIELD_72("72"), - FIELD_73A("73A"), - FIELD_73R("73R"), - FIELD_73S("73S"), - FIELD_73("73"), - FIELD_74("74"), - FIELD_75("75"), - FIELD_76("76"), - FIELD_77A("77A"), - FIELD_77B("77B"), - FIELD_77C("77C"), - FIELD_77D("77D"), - FIELD_77E("77E"), - FIELD_77F("77F"), - FIELD_77H("77H"), - FIELD_77J("77J"), - FIELD_77L("77L"), - FIELD_77T("77T"), - FIELD_77U("77U"), - FIELD_77("77"), - FIELD_78B("78B"), - FIELD_78("78"), - FIELD_78D("78D"), - FIELD_79Z("79Z"), - FIELD_79("79"), - FIELD_80C("80C"), - FIELD_81A("81A"), - FIELD_81D("81D"), - FIELD_81J("81J"), - FIELD_82A("82A"), - FIELD_82B("82B"), - FIELD_82D("82D"), - FIELD_82J("82J"), - FIELD_83A("83A"), - FIELD_83C("83C"), - FIELD_83D("83D"), - FIELD_83J("83J"), - FIELD_84A("84A"), - FIELD_84B("84B"), - FIELD_84D("84D"), - FIELD_84J("84J"), - FIELD_85A("85A"), - FIELD_85B("85B"), - FIELD_85D("85D"), - FIELD_85J("85J"), - FIELD_86A("86A"), - FIELD_86B("86B"), - FIELD_86D("86D"), - FIELD_86J("86J"), - FIELD_86("86"), - FIELD_87A("87A"), - FIELD_87B("87B"), - FIELD_87D("87D"), - FIELD_87J("87J"), - FIELD_88A("88A"), - FIELD_88B("88B"), - FIELD_88D("88D"), - FIELD_88J("88J"), - FIELD_89A("89A"), - FIELD_89D("89D"), - FIELD_89J("89J"), - FIELD_90A("90A"), - FIELD_90B("90B"), - FIELD_90C("90C"), - FIELD_90D("90D"), - FIELD_90E("90E"), - FIELD_90F("90F"), - FIELD_90J("90J"), - FIELD_90K("90K"), - FIELD_90L("90L"), - FIELD_91A("91A"), - FIELD_91D("91D"), - FIELD_91J("91J"), - FIELD_92A("92A"), - FIELD_92B("92B"), - FIELD_92C("92C"), - FIELD_92D("92D"), - FIELD_92F("92F"), - FIELD_92H("92H"), - FIELD_92J("92J"), - FIELD_92K("92K"), - FIELD_92L("92L"), - FIELD_92M("92M"), - FIELD_92N("92N"), - FIELD_92P("92P"), - FIELD_92R("92R"), - FIELD_93A("93A"), - FIELD_93B("93B"), - FIELD_93C("93C"), - FIELD_93D("93D"), - FIELD_93E("93E"), - FIELD_93F("93F"), - FIELD_94A("94A"), - FIELD_94B("94B"), - FIELD_94C("94C"), - FIELD_94D("94D"), - FIELD_94E("94E"), - FIELD_94F("94F"), - FIELD_94G("94G"), - FIELD_94H("94H"), - FIELD_94L("94L"), - FIELD_95C("95C"), - FIELD_95L("95L"), - FIELD_95P("95P"), - FIELD_95Q("95Q"), - FIELD_95R("95R"), - FIELD_95S("95S"), - FIELD_95U("95U"), - FIELD_95V("95V"), - FIELD_96A("96A"), - FIELD_96D("96D"), - FIELD_96J("96J"), - FIELD_97A("97A"), - FIELD_97B("97B"), - FIELD_97C("97C"), - FIELD_97D("97D"), - FIELD_97E("97E"), - FIELD_98A("98A"), - FIELD_98B("98B"), - FIELD_98C("98C"), - FIELD_98D("98D"), - FIELD_98E("98E"), - FIELD_98F("98F"), - FIELD_98G("98G"), - FIELD_98H("98H"), - FIELD_98J("98J"), - FIELD_98K("98K"), - FIELD_99A("99A"), - FIELD_99B("99B"), - FIELD_99C("99C"), - FIELD_101("101"), - FIELD_102("102"), - FIELD_103("103"), - FIELD_104("104"), - FIELD_105("105"), - FIELD_106("106"), - FIELD_107("107"), - FIELD_108("108"), - FIELD_109("109"), - FIELD_110("110"), - FIELD_111("111"), - FIELD_113("113"), - FIELD_114("114"), - FIELD_115("115"), - FIELD_116("116"), - FIELD_117("117"), - FIELD_118("118"), - FIELD_119("119"), - FIELD_120("120"), - FIELD_121("121"), - FIELD_122("122"), - FIELD_123("123"), - FIELD_124("124"), - FIELD_125("125"), - FIELD_126("126"), - FIELD_127("127"), - FIELD_128("128"), - FIELD_129("129"), - FIELD_130("130"), - FIELD_132("132"), - FIELD_133("133"), - FIELD_134("134"), - FIELD_135("135"), - FIELD_136("136"), - FIELD_137("137"), - FIELD_140("140"), - FIELD_141("141"), - FIELD_142("142"), - FIELD_143("143"), - FIELD_144("144"), - FIELD_151("151"), - FIELD_152("152"), - FIELD_153("153"), - FIELD_165("165"), - FIELD_171("171"), - FIELD_172("172"), - FIELD_173("173"), - FIELD_174("174"), - FIELD_175("175"), - FIELD_177("177"), - FIELD_179("179"), - FIELD_199("199"), - FIELD_202("202"), - FIELD_203("203"), - FIELD_204("204"), - FIELD_206("206"), - FIELD_208("208"), - FIELD_209("209"), - FIELD_242("242"), - FIELD_243("243"), - FIELD_251("251"), - FIELD_252("252"), - FIELD_253("253"), - FIELD_254("254"), - FIELD_255("255"), - FIELD_256("256"), - FIELD_257("257"), - FIELD_258("258"), - FIELD_259("259"), - FIELD_260("260"), - FIELD_263("263"), - FIELD_264("264"), - FIELD_270("270"), - FIELD_271("271"), - FIELD_272("272"), - FIELD_280("280"), - FIELD_281("281"), - FIELD_301("301"), - FIELD_302("302"), - FIELD_303("303"), - FIELD_304("304"), - FIELD_305("305"), - FIELD_307("307"), - FIELD_311("311"), - FIELD_312("312"), - FIELD_313("313"), - FIELD_329("329"), - FIELD_330("330"), - FIELD_331("331"), - FIELD_332("332"), - FIELD_333("333"), - FIELD_334("334"), - FIELD_335("335"), - FIELD_336("336"), - FIELD_337("337"), - FIELD_338("338"), - FIELD_339("339"), - FIELD_340("340"), - FIELD_341("341"), - FIELD_342("342"), - FIELD_343("343"), - FIELD_344("344"), - FIELD_345("345"), - FIELD_346("346"), - FIELD_347("347"), - FIELD_348("348"), - FIELD_349("349"), - FIELD_401("401"), - FIELD_405("405"), - FIELD_421("421"), - FIELD_422("422"), - FIELD_423("423"), - FIELD_424("424"), - FIELD_425("425"), - FIELD_431("431"), - FIELD_432("432"), - FIELD_433("433"), - FIELD_434("434"), - FIELD_443("443"), - FIELD_451("451"), - FIELD_461("461"), - FIELD_503("503"), - FIELD_533("533"), - FIELD_619("619"), - FIELD_999("999"); - - private final String code; - - FieldEnum(String code) { - this.code = code; - } - - public String getCode() { - return code; - } - - public static FieldEnum fromCode(String code) { - for (FieldEnum field : FieldEnum.values()) { - if (field.code.equals(code)) { - return field; - } - } - return null; - } -} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldEnumTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldEnumTest.java new file mode 100644 index 000000000..cc1b17bbf --- /dev/null +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldEnumTest.java @@ -0,0 +1,48 @@ +package com.prowidesoftware.swift.model.field; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class FieldEnumTest { + + @Test + void testGetFieldName() { + // Validate that getFieldName returns the correct value + assertEquals("11A", FieldEnum.F11A.getFieldName()); + assertEquals("14P", FieldEnum.F14P.getFieldName()); + assertEquals("30K", FieldEnum.F30K.getFieldName()); + } + + @Test + void testFromCodeValid() { + // Validate that fromCode returns the correct enum when a valid code is provided + assertEquals(FieldEnum.F11A, FieldEnum.fromCode("11A")); + assertEquals(FieldEnum.F14R, FieldEnum.fromCode("14R")); + assertEquals(FieldEnum.F30K, FieldEnum.fromCode("30K")); + } + + @Test + void testFromCodeInvalid() { + // Validate that fromCode returns null when an invalid code is provided + assertNull(FieldEnum.fromCode("930K")); + assertNull(FieldEnum.fromCode("ABC")); + assertNull(FieldEnum.fromCode("")); + } + + @Test + void testFromCodeEdgeCases() { + // Validate edge cases, such as lowercase inputs, to ensure the method is case-sensitive + assertNull(FieldEnum.fromCode("11a")); // should return null because "11a" is lowercase + assertNull(FieldEnum.fromCode(" 11A")); // should return null because of the leading space + assertNull(FieldEnum.fromCode("11A ")); // should return null because of the trailing space + } + + @Test + void testAllEnumValues() { + // Validate that all enum values have the correct field name + for (FieldEnum field : FieldEnum.values()) { + assertEquals(field.name().substring(1), field.getFieldName()); + } + } +}