From 9e6b724d75898f9359fe30de054622278e7c20c8 Mon Sep 17 00:00:00 2001 From: Sebastian Zubrinic Date: Mon, 8 May 2023 19:34:59 -0300 Subject: [PATCH 01/16] GH-56: JAXB Upgrade Plan, Migration to Jakarta EE 10, Migration to Java 11 (#153) * Migration to Java 11 * Migration to Jakarta EE 10 --------- Co-authored-by: Nicolas Filotto Co-authored-by: ptorres-prowide <90214684+ptorres-prowide@users.noreply.github.com> Co-authored-by: ptorres-prowide --- build.gradle | 8 ++++---- .../swift/constraints/BicConstraint.java | 6 +++--- .../swift/constraints/BicValidator.java | 5 ++--- .../swift/constraints/CountryConstraint.java | 6 +++--- .../swift/constraints/CountryValidator.java | 5 ++--- .../swift/constraints/CurrencyConstraint.java | 6 +++--- .../swift/constraints/CurrencyValidator.java | 5 ++--- .../swift/constraints/IbanConstraint.java | 6 +++--- .../swift/constraints/IbanValidator.java | 5 ++--- .../swift/model/AbstractSwiftMessage.java | 5 ++--- .../prowidesoftware/swift/model/MtSwiftMessage.java | 7 +++---- .../swift/model/SwiftMessageNote.java | 4 ++-- .../swift/model/SwiftMessageRevision.java | 6 +++--- .../swift/model/SwiftMessageStatusInfo.java | 6 +++--- .../parser/SwiftParserConsumeBlockLenientTest.java | 2 +- .../swift/model/UnparsedTextListTest.java | 12 ++++++------ .../field/FieldComponentLabelsCompatibilityTest.java | 4 ++-- .../swift/utils/SwiftFormatUtilsTest.java | 12 ++++++------ 18 files changed, 52 insertions(+), 58 deletions(-) diff --git a/build.gradle b/build.gradle index a24d60970..9232f185c 100644 --- a/build.gradle +++ b/build.gradle @@ -55,11 +55,11 @@ dependencies { implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'com.google.code.gson:gson:2.9.0' - compileOnly 'javax.persistence:javax.persistence-api:2.2' - compileOnly 'javax.xml.bind:jaxb-api:2.3.1' - compileOnly 'javax.validation:validation-api:2.0.1.Final' + compileOnly 'jakarta.persistence:jakarta.persistence-api:3.1.0' + compileOnly 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0' + compileOnly 'jakarta.validation:jakarta.validation-api:3.0.2' - testImplementation 'javax.persistence:javax.persistence-api:2.2' + testImplementation 'jakarta.persistence:jakarta.persistence-api:3.1.0' testImplementation('org.junit.jupiter:junit-jupiter:5.8.2') testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.22.0' testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.9.0' diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java index 1509d0967..48af08a76 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java @@ -17,14 +17,14 @@ import static java.lang.annotation.ElementType.*; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - /** * Bean validation for BIC numbers. * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java index f3b8f2d26..8f5be99c4 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java @@ -17,11 +17,10 @@ import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.model.BicValidationResult; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the BIC validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java index 965109e75..5b73fcd65 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java @@ -17,14 +17,14 @@ import static java.lang.annotation.ElementType.*; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - /** * Bean validation for ISO Alpha-2 country codes. * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java index 9f027f0b9..1ee1df146 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java @@ -16,11 +16,10 @@ package com.prowidesoftware.swift.constraints; import com.prowidesoftware.swift.utils.IsoUtils; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the ISO Alpha-2 country validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java index 1fe3ac558..a208274c3 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java @@ -17,14 +17,14 @@ import static java.lang.annotation.ElementType.*; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - /** * Bean validation for ISO currency codes. * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java index a47cdcec2..00716a07b 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java @@ -16,11 +16,10 @@ package com.prowidesoftware.swift.constraints; import com.prowidesoftware.swift.utils.IsoUtils; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the ISO currency code validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java index 832380580..4249b8a52 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java @@ -17,14 +17,14 @@ import static java.lang.annotation.ElementType.*; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - /** * Bean validation for IBAN numbers. * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java index 8c1d35f26..9421570c6 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java @@ -17,11 +17,10 @@ import com.prowidesoftware.swift.model.IBAN; import com.prowidesoftware.swift.model.IbanValidationResult; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the IBAN validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java index 571f7dca7..a1d817cb9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java @@ -21,6 +21,8 @@ import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.utils.Lib; +import jakarta.persistence.*; +import jakarta.xml.bind.annotation.XmlTransient; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -33,9 +35,6 @@ import java.text.NumberFormat; import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.XmlTransient; - /** * Base entity for MT and MX message persistence. * diff --git a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java index 8dddc1df9..6bfb332dd 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java @@ -24,6 +24,9 @@ import com.prowidesoftware.swift.model.mt.AbstractMT; import com.prowidesoftware.swift.model.mt.DefaultMtMetadataStrategy; import com.prowidesoftware.swift.model.mt.MTVariant; +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -36,10 +39,6 @@ import java.util.Optional; import java.util.logging.Level; -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - /** * MT messages entity for JPA persistence. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java index e61247cc2..becb700ae 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java @@ -15,9 +15,9 @@ */ package com.prowidesoftware.swift.model; -import java.util.Calendar; +import jakarta.persistence.*; -import javax.persistence.*; +import java.util.Calendar; /** * Comments associated to a message for application only usage (not part of the standard). diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java index 5bea1ad3a..e34214528 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java @@ -15,13 +15,13 @@ */ package com.prowidesoftware.swift.model; -import static javax.persistence.FetchType.LAZY; +import static jakarta.persistence.FetchType.LAZY; + +import jakarta.persistence.*; import java.util.Calendar; import java.util.Objects; -import javax.persistence.*; - /** * A revision is a snapshot of message content and is used to track the history of changes in a message. * Applications may use to store revisions each time a message is edited. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java index 7ae5877bc..c9b2bd2c0 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java @@ -15,13 +15,13 @@ */ package com.prowidesoftware.swift.model; -import static javax.persistence.FetchType.LAZY; +import static jakarta.persistence.FetchType.LAZY; + +import jakarta.persistence.*; import java.util.Calendar; import java.util.Objects; -import javax.persistence.*; - /** * Status tracking record for application only usage (not part of the standard).
* The status name identifier is modeled with plain String, nevertheless diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java index 10a893e9c..48e6b64ef 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java @@ -319,7 +319,7 @@ public void testSimpleBlockConsumerBlock3_3_KnownToFail() throws IOException { assertEquals("00112233", b.getTagValue("108")); assertTrue(b.containsTag("4")); assertEquals("foobar", b.getTagValue("4")); - assertEquals(b.getUnparsedTextsSize(), new Integer(1)); + assertEquals(b.getUnparsedTextsSize(), Integer.valueOf(1)); assertEquals(b.unparsedTextGetText(0), "blockdata"); } diff --git a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java index ebd5fcc14..8e77d065e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java @@ -58,7 +58,7 @@ public void test_staticIsMessage() { @Test public void test_addText() { t.addText(someText); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); assertEquals(t.getText(0), someText); } @@ -72,9 +72,9 @@ public void test_isMessage() { @Test public void test_size() { - assertEquals(t.size(), new Integer(0)); + assertEquals(t.size(), Integer.valueOf(0)); t.addText(someText); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @Test @@ -113,7 +113,7 @@ public void test_addTextMessage() { t.addText(msg); // check things out - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); assertEquals(t.getText(0), msgString); } @@ -123,7 +123,7 @@ public void test_removeIndexOK() { t.addText(someMsg); t.removeText(0); assertEquals(t.getText(0), someMsg); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @Test @@ -137,7 +137,7 @@ public void test_removeText() { t.addText(someMsg); t.removeText(someText); assertEquals(t.getText(0), someMsg); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @Test diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java index 5403150d8..68f55b095 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java @@ -51,8 +51,8 @@ public void test() throws Exception { int missing = 0; int availableOK = 0; int availableError = 0; - for (Class c : classes) { - Field f = (Field) c.newInstance(); + for (Class c : classes) { + Field f = (Field) c.getDeclaredConstructor().newInstance(); int size = f.getComponents().size(); final String label = Field.getLabelComponents(f.getName(), null, null, null); if (label.endsWith(".components")) { diff --git a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java index f38adc5a0..892e21720 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java @@ -42,22 +42,22 @@ public void testGetNumber() { //this test does not work but this format is not used assertNotNull(SwiftFormatUtils.getNumber("1,2")); - assertEquals(new Double(1.2), new Double(SwiftFormatUtils.getNumber("1,2").doubleValue())); + assertEquals(Double.valueOf(1.2), Double.valueOf(SwiftFormatUtils.getNumber("1,2").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,34")); - assertEquals(new Double(12.34), new Double(SwiftFormatUtils.getNumber("12,34").doubleValue())); + assertEquals(Double.valueOf(12.34), Double.valueOf(SwiftFormatUtils.getNumber("12,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,3456")); - assertEquals(new Double(12.3456), new Double(SwiftFormatUtils.getNumber("12,3456").doubleValue())); + assertEquals(Double.valueOf(12.3456), Double.valueOf(SwiftFormatUtils.getNumber("12,3456").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("0,")); - assertEquals(new Double(0), new Double(SwiftFormatUtils.getNumber("0,").doubleValue())); + assertEquals(Double.valueOf(0), Double.valueOf(SwiftFormatUtils.getNumber("0,").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("299000,34")); - assertEquals(new Double(299000.34), new Double(SwiftFormatUtils.getNumber("299000,34").doubleValue())); + assertEquals(Double.valueOf(299000.34), Double.valueOf(SwiftFormatUtils.getNumber("299000,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber(",34")); - assertEquals(new Double(0.34), new Double(SwiftFormatUtils.getNumber(",34").doubleValue())); + assertEquals(Double.valueOf(0.34), Double.valueOf(SwiftFormatUtils.getNumber(",34").doubleValue())); } @Test From 933979307bea07d67eb502d4a3c890b863f9732f Mon Sep 17 00:00:00 2001 From: zubri Date: Mon, 8 May 2023 19:51:18 -0300 Subject: [PATCH 02/16] upgrade to Java 11 --- CHANGELOG.md | 4 ++++ build.gradle | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72e858129..6eb7af9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Prowide Core - CHANGELOG +#### 10.1.0 - SNAPSHOT + * Migration to Java 11 + * Migration to Jakarta EE 10 + #### 9.4.0 - May 2022 * SWIFT Standard release update 2023 (live 19 November 2023) * Yearly revision of deprecation phase (see https://dev.prowidesoftware.com/SRU2022/getting-started/deprecation/) diff --git a/build.gradle b/build.gradle index 9232f185c..b6c325844 100644 --- a/build.gradle +++ b/build.gradle @@ -33,13 +33,13 @@ scmVersion { } } //project.version = "${SRU}-${scmVersion.version}" -project.version = "${SRU}-9.4.0" +project.version = "${SRU}-10.1.0-SNAPSHOT" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' java { toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) + languageVersion.set(JavaLanguageVersion.of(11)) } } doFirst { From a56d25cae554100e5ec4b137be277bd3fca1a0df Mon Sep 17 00:00:00 2001 From: zubri Date: Tue, 9 May 2023 16:15:45 -0300 Subject: [PATCH 03/16] changelog From 53a5cd26f5f4189ddb458bb007acdc472c17b791 Mon Sep 17 00:00:00 2001 From: zubri Date: Tue, 6 Jun 2023 19:04:28 -0300 Subject: [PATCH 04/16] comment and Idea compiler param update --- .idea/compiler.xml | 2 +- build.gradle | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130cd..fb7f4a8a4 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index b6c325844..c0a1f81b8 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,8 @@ dependencies { implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'com.google.code.gson:gson:2.9.0' + // jakarta is only used for annotations, we do not add it as implementation dependency on purpose to avoid forcing + // users to use jakarta jars in their project when they might not event be using JPA or JAXB at all compileOnly 'jakarta.persistence:jakarta.persistence-api:3.1.0' compileOnly 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0' compileOnly 'jakarta.validation:jakarta.validation-api:3.0.2' From 6ef66b0db66050ad225b20361716dcb461535fc9 Mon Sep 17 00:00:00 2001 From: zubri Date: Wed, 14 Jun 2023 16:24:29 -0300 Subject: [PATCH 05/16] release --- CHANGELOG.md | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf9d1cf4..941c62a46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Prowide Core - CHANGELOG -#### 10.1.0 - SNAPSHOT +#### 10.1.0 - June 2023 * Migration to Java 11 * Migration to Jakarta EE 10 * (PW-1323) Fixing getValue method for pattern issue in Field44J diff --git a/build.gradle b/build.gradle index c0a1f81b8..47627262c 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ scmVersion { } } //project.version = "${SRU}-${scmVersion.version}" -project.version = "${SRU}-10.1.0-SNAPSHOT" +project.version = "${SRU}-10.1.0" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' From c2043d964d4f99eb5b563bdc3c9e2542d70464ca Mon Sep 17 00:00:00 2001 From: zubri Date: Sat, 1 Jul 2023 19:35:50 -0300 Subject: [PATCH 06/16] release --- CHANGELOG.md | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0093e87f3..481924e3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Prowide Core - CHANGELOG -#### 10.1.2 - SNAPSHOT +#### 10.1.1 - July 2023 * (GH-163) Remove unnecessary padding in sender and receiver in AbstractMT#creeate(number, sender, receiver) method * (PW-1323) Fixing getValue method for pattern issue in Field44J diff --git a/build.gradle b/build.gradle index 47627262c..77a89a192 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ scmVersion { } } //project.version = "${SRU}-${scmVersion.version}" -project.version = "${SRU}-10.1.0" +project.version = "${SRU}-10.1.1" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' From 7901a6435d965773bf1487eeb31502dc15444854 Mon Sep 17 00:00:00 2001 From: zubri Date: Fri, 4 Aug 2023 18:47:33 -0300 Subject: [PATCH 07/16] spotless code formatting --- .gitignore | 1 + build.gradle | 12 + .../java/com/prowidesoftware/CopyableTo.java | 2 +- .../java/com/prowidesoftware/Generated.java | 9 +- .../com/prowidesoftware/JsonSerializable.java | 3 +- .../com/prowidesoftware/ProwideException.java | 10 +- .../com/prowidesoftware/ProwideLocale.java | 3 +- .../deprecation/DeprecationUtils.java | 13 +- .../deprecation/ProwideDeprecated.java | 3 +- .../deprecation/TargetYear.java | 2 +- .../deprecation/package-info.java | 4 +- .../com/prowidesoftware/package-info.java | 4 +- .../swift/UnknownMTException.java | 1 + .../swift/constraints/BicConstraint.java | 5 +- .../swift/constraints/BicValidator.java | 8 +- .../swift/constraints/CountryConstraint.java | 5 +- .../swift/constraints/CountryValidator.java | 8 +- .../swift/constraints/CurrencyConstraint.java | 3 +- .../swift/constraints/CurrencyValidator.java | 6 +- .../swift/constraints/IbanConstraint.java | 5 +- .../swift/constraints/IbanValidator.java | 8 +- .../swift/internal/NonUniqueSeparator.java | 6 +- .../swift/internal/SequenceStyle.java | 2 +- .../swift/internal/package-info.java | 4 +- .../swift/io/AbstractReader.java | 18 +- .../swift/io/AbstractWriter.java | 9 +- .../swift/io/ConversionService.java | 6 +- .../swift/io/IConversionService.java | 3 +- .../prowidesoftware/swift/io/PPCReader.java | 3 +- .../prowidesoftware/swift/io/PPCWriter.java | 17 +- .../prowidesoftware/swift/io/RJEReader.java | 3 +- .../prowidesoftware/swift/io/RJEWriter.java | 6 +- .../swift/io/package-info.java | 4 +- .../swift/io/parser/SwiftParser.java | 56 +- .../io/parser/SwiftParserConfiguration.java | 2 +- .../swift/io/parser/XMLParser.java | 22 +- .../swift/io/parser/package-info.java | 4 +- .../swift/io/writer/FINWriterVisitor.java | 44 +- .../swift/io/writer/MultilineUtil.java | 14 +- .../swift/io/writer/SwiftWriter.java | 11 +- .../swift/io/writer/XMLWriterVisitor.java | 72 +- .../swift/io/writer/package-info.java | 4 +- .../swift/model/AbstractMessage.java | 5 +- .../swift/model/AbstractSwiftMessage.java | 117 +- .../com/prowidesoftware/swift/model/BIC.java | 47 +- .../swift/model/BbanEntryType.java | 12 +- .../swift/model/BbanStructureDTO.java | 4 +- .../swift/model/BbanStructureEntryDTO.java | 4 +- .../swift/model/BbanStructureValidations.java | 16 +- .../swift/model/BicValidationResult.java | 10 +- .../swift/model/FileFormat.java | 2 +- .../com/prowidesoftware/swift/model/IBAN.java | 12 +- .../swift/model/IbanValidationResult.java | 24 +- .../swift/model/IbanValidationUtils.java | 19 +- .../swift/model/LogicalTerminalAddress.java | 5 +- .../com/prowidesoftware/swift/model/MIR.java | 19 +- .../com/prowidesoftware/swift/model/MOR.java | 9 +- .../swift/model/MessageDirection.java | 2 +- .../swift/model/MessageIOType.java | 2 +- .../swift/model/MessageMetadataStrategy.java | 4 +- .../swift/model/MessageStandardType.java | 2 +- .../prowidesoftware/swift/model/Money.java | 10 +- .../com/prowidesoftware/swift/model/MtId.java | 21 +- .../swift/model/MtSwiftMessage.java | 29 +- .../swift/model/SwiftBlock.java | 12 +- .../swift/model/SwiftBlock1.java | 71 +- .../swift/model/SwiftBlock1Field.java | 2 +- .../swift/model/SwiftBlock2.java | 19 +- .../swift/model/SwiftBlock2Adapter.java | 42 +- .../swift/model/SwiftBlock2Field.java | 2 +- .../swift/model/SwiftBlock2Input.java | 54 +- .../swift/model/SwiftBlock2InputField.java | 2 +- .../swift/model/SwiftBlock2Output.java | 81 +- .../swift/model/SwiftBlock2OutputField.java | 2 +- .../swift/model/SwiftBlock3.java | 17 +- .../swift/model/SwiftBlock3Builder.java | 9 +- .../swift/model/SwiftBlock4.java | 23 +- .../swift/model/SwiftBlock5.java | 17 +- .../swift/model/SwiftBlock5Field.java | 12 +- .../swift/model/SwiftBlockUser.java | 48 +- .../swift/model/SwiftCharset.java | 2 +- .../swift/model/SwiftCharsetUtils.java | 48 +- .../swift/model/SwiftMessage.java | 42 +- .../swift/model/SwiftMessageAdapter.java | 9 +- .../swift/model/SwiftMessageNote.java | 7 +- .../swift/model/SwiftMessageRevision.java | 13 +- .../swift/model/SwiftMessageStatusInfo.java | 20 +- .../swift/model/SwiftMessageUtils.java | 45 +- .../swift/model/SwiftTagListBlock.java | 117 +- .../swift/model/SwiftValueBlock.java | 22 +- .../com/prowidesoftware/swift/model/Tag.java | 43 +- .../swift/model/TagVisitor.java | 2 +- .../swift/model/UETRUtils.java | 3 +- .../swift/model/UnparsedTextList.java | 11 +- .../swift/model/field/AmountContainer.java | 3 +- .../swift/model/field/AmountResolver.java | 4 +- .../swift/model/field/BICContainer.java | 3 +- .../swift/model/field/BICResolver.java | 2 - .../swift/model/field/CurrencyContainer.java | 3 +- .../swift/model/field/CurrencyResolver.java | 10 +- .../swift/model/field/DateContainer.java | 3 +- .../swift/model/field/DateResolver.java | 33 +- .../swift/model/field/Field.java | 86 +- .../swift/model/field/Field11T.java | 111 +- .../swift/model/field/Field12H.java | 78 +- .../swift/model/field/Field12K.java | 81 +- .../swift/model/field/Field12L.java | 68 +- .../swift/model/field/Field12R.java | 78 +- .../swift/model/field/Field12S.java | 68 +- .../swift/model/field/Field13E.java | 86 +- .../swift/model/field/Field20E.java | 78 +- .../swift/model/field/Field21S.java | 68 +- .../swift/model/field/Field21T.java | 68 +- .../swift/model/field/Field25F.java | 68 +- .../swift/model/field/Field25G.java | 68 +- .../swift/model/field/Field27A.java | 83 +- .../swift/model/field/Field29D.java | 75 +- .../swift/model/field/Field29F.java | 75 +- .../swift/model/field/Field29P.java | 83 +- .../swift/model/field/Field29S.java | 78 +- .../swift/model/field/Field29U.java | 83 +- .../swift/model/field/Field31J.java | 76 +- .../swift/model/field/Field31K.java | 76 +- .../swift/model/field/Field31M.java | 76 +- .../swift/model/field/Field31R.java | 89 +- .../swift/model/field/Field31T.java | 76 +- .../swift/model/field/Field34D.java | 85 +- .../swift/model/field/Field34K.java | 85 +- .../swift/model/field/Field34L.java | 85 +- .../swift/model/field/Field34M.java | 85 +- .../swift/model/field/Field34S.java | 85 +- .../swift/model/field/Field34T.java | 85 +- .../swift/model/field/Field34U.java | 85 +- .../swift/model/field/Field34V.java | 85 +- .../swift/model/field/Field34W.java | 85 +- .../swift/model/field/Field34X.java | 85 +- .../swift/model/field/Field47E.java | 69 +- .../swift/model/field/Field49D.java | 68 +- .../swift/model/field/Field49F.java | 69 +- .../swift/model/field/Field49J.java | 69 +- .../swift/model/field/Field49K.java | 69 +- .../swift/model/field/Field49L.java | 69 +- .../swift/model/field/Field49Z.java | 69 +- .../swift/model/field/Field71E.java | 49 +- .../swift/model/field/Field78B.java | 69 +- .../swift/model/field/GenericField.java | 3 +- .../model/field/MonetaryAmountContainer.java | 5 +- .../model/field/MonetaryAmountResolver.java | 2 +- .../swift/model/field/MultiLineField.java | 4 +- .../swift/model/field/Narrative.java | 18 +- .../swift/model/field/NarrativeContainer.java | 3 +- .../field/NarrativeContainerJsonUtils.java | 7 +- .../swift/model/field/NarrativeResolver.java | 103 +- .../swift/model/field/OptionAPartyField.java | 8 +- .../swift/model/field/OptionBPartyField.java | 8 +- .../swift/model/field/OptionCPartyField.java | 6 +- .../swift/model/field/OptionDPartyField.java | 8 +- .../swift/model/field/OptionGPartyField.java | 9 +- .../swift/model/field/OptionHPartyField.java | 8 +- .../swift/model/field/OptionJPartyField.java | 8 +- .../swift/model/field/OptionKPartyField.java | 8 +- .../swift/model/field/OptionLPartyField.java | 6 +- .../swift/model/field/OptionPPartyField.java | 6 +- .../swift/model/field/OptionQPartyField.java | 8 +- .../swift/model/field/OptionRPartyField.java | 6 +- .../swift/model/field/OptionSPartyField.java | 6 +- .../swift/model/field/OptionUPartyField.java | 8 +- .../swift/model/field/PartyIdentifier.java | 1 - .../model/field/PartyIdentifierUtils.java | 9 +- .../swift/model/field/PatternContainer.java | 3 +- .../model/field/StructuredNarrative.java | 23 +- .../model/field/StructuredNarrativeField.java | 7 +- .../swift/model/field/SwiftParseUtils.java | 41 +- .../swift/model/field/package-info.java | 4 +- .../swift/model/mt/AbstractMT.java | 20 +- .../swift/model/mt/AbstractMTAdapter.java | 22 +- .../model/mt/DefaultMtMetadataStrategy.java | 5 +- .../swift/model/mt/MTVariant.java | 3 +- .../swift/model/mt/MtCategory.java | 3 +- .../swift/model/mt/SequenceUtils.java | 130 +- .../swift/model/mt/ServiceIdType.java | 3 +- .../swift/model/mt/ServiceMessage21.java | 12 +- .../swift/model/mt/package-info.java | 4 +- .../swift/model/package-info.java | 4 +- .../prowidesoftware/swift/package-info.java | 4 +- .../swift/utils/AckMessageComparator.java | 3 +- .../swift/utils/BaseMessageVisitor.java | 65 +- .../swift/utils/IMessageVisitor.java | 3 +- .../prowidesoftware/swift/utils/IsoUtils.java | 19 +- .../com/prowidesoftware/swift/utils/Lib.java | 15 +- .../swift/utils/LineWrapper.java | 9 +- .../swift/utils/MurMessageComparator.java | 6 +- .../swift/utils/ResolverUtils.java | 33 +- .../swift/utils/SafeXmlUtils.java | 51 +- .../swift/utils/SwiftFormatUtils.java | 24 +- .../swift/utils/SwiftMessageComparator.java | 52 +- .../swift/utils/TestUtils.java | 6 +- .../swift/utils/package-info.java | 4 +- .../resources/ProwideException.properties | 2 +- .../resources/pw_swift_labels_de.properties | 2 +- .../resources/pw_swift_labels_en.properties | 2 +- .../resources/pw_swift_labels_es.properties | 2 +- .../resources/pw_swift_labels_fr.properties | 2 +- .../resources/pw_swift_labels_it.properties | 2 +- .../resources/pw_swift_labels_ru.properties | 2 +- .../deprecation/DeprecationUtilTest.java | 21 +- .../prowidesoftware/issues/Bug3085740.java | 43 +- .../issues/CustomTagInParserTest.java | 14 +- .../com/prowidesoftware/issues/Issue41.java | 93 +- .../com/prowidesoftware/issues/Issue74.java | 5 +- .../com/prowidesoftware/issues/Issue78.java | 531 +-- .../com/prowidesoftware/issues/Issue95.java | 1 - .../issues/IssueGh148Test.java | 26 +- .../issues/JapaneseCharactersTest.java | 47 +- .../com/prowidesoftware/issues/Jira1341.java | 9 +- .../issues/TabInFieldValueTest.java | 75 +- .../com/prowidesoftware/swift/Constants.java | 52 +- .../prowidesoftware/swift/GeneralAPITest.java | 65 +- .../swift/io/RJEReaderTest.java | 28 +- .../swift/io/RJEWriterTest.java | 14 +- .../swift/io/parser/BaseMessageTestcase.java | 10 +- .../swift/io/parser/MT103ParserTest.java | 460 ++- .../swift/io/parser/MT199ParserTest.java | 174 +- .../swift/io/parser/MT202ParserTest.java | 287 +- .../swift/io/parser/MT535ParserTest.java | 55 +- .../swift/io/parser/MT541ParserTest.java | 349 +- .../swift/io/parser/MT543ParserTest.java | 353 +- .../swift/io/parser/MT564ParserTest.java | 298 +- .../swift/io/parser/MT900ParserTest.java | 54 +- .../swift/io/parser/MT940ParserTest.java | 242 +- .../swift/io/parser/MT950ParserTest.java | 32 +- .../swift/io/parser/MTn9nParserTest.java | 166 +- .../swift/io/parser/ParserTest.java | 8 +- .../SwiftParserConsumeBlockLenientTest.java | 106 +- .../SwiftParserConsumeBlockStrictTest.java | 17 +- .../io/parser/SwiftParserConsumeTagTest.java | 275 +- .../io/parser/SwiftParserParseBlockTest.java | 83 +- .../io/parser/SwiftParserReadBlockTest.java | 110 +- .../swift/io/parser/SwiftParserTest.java | 993 ++--- .../swift/io/parser/SystemMessageTest.java | 186 +- .../io/parser/UnparsedTextParsingTest.java | 36 +- .../swift/io/parser/VisibleParser.java | 19 +- .../swift/io/parser/XMLParserTest.java | 650 ++- .../swift/io/writer/FINWriterVisitorTest.java | 13 +- .../swift/io/writer/MultilineUtilTest.java | 2 +- .../swift/io/writer/SwiftWriterTest.java | 67 +- .../swift/io/writer/XMLWriterVisitorTest.java | 144 +- .../swift/model/AbstractSwiftMessageTest.java | 3 +- .../prowidesoftware/swift/model/BICTest.java | 7 +- .../swift/model/ConversionServiceTest.java | 216 +- .../prowidesoftware/swift/model/IBANTest.java | 18 +- .../model/LogicalTerminalAddressTest.java | 3 +- .../prowidesoftware/swift/model/MIRTest.java | 4 +- .../swift/model/MoneyTest.java | 9 +- .../prowidesoftware/swift/model/MtIdTest.java | 5 +- .../swift/model/MtSwiftMessageJsonTest.java | 179 +- .../swift/model/MtSwiftMessageTest.java | 47 +- .../swift/model/SwiftBlock1Test.java | 13 +- .../swift/model/SwiftBlock2InputTest.java | 11 +- .../swift/model/SwiftBlock2OutputTest.java | 9 +- .../swift/model/SwiftBlock3Test.java | 7 +- .../swift/model/SwiftBlock4Test.java | 5 +- .../swift/model/SwiftBlock5Test.java | 7 +- .../swift/model/SwiftBlockNumberingTest.java | 2 +- .../swift/model/SwiftBlockUserTest.java | 2 +- .../swift/model/SwiftCharsetUtilsTest.java | 26 +- .../swift/model/SwiftMessageFragmentTest.java | 2 +- .../swift/model/SwiftMessageJsonTest.java | 529 +-- .../swift/model/SwiftMessageTest.java | 102 +- .../swift/model/SwiftMessageUtilsTest.java | 86 +- .../swift/model/SwiftTagListBlockTest.java | 3654 ++++++++--------- .../swift/model/SwiftValueBlockTest.java | 11 +- .../prowidesoftware/swift/model/TagTest.java | 5 +- .../swift/model/UnparsedTextListTest.java | 7 +- .../swift/model/field/AbstractFieldTest.java | 101 +- .../swift/model/field/AmountResolverTest.java | 7 +- .../swift/model/field/BICResolverTest.java | 5 +- .../model/field/ContainerInterfacesTest.java | 3 +- .../model/field/CurrencyResolverTest.java | 12 +- .../swift/model/field/DateResolverTest.java | 14 +- .../swift/model/field/Field11RTest.java | 31 +- .../swift/model/field/Field11STest.java | 12 +- .../swift/model/field/Field133Test.java | 14 +- .../swift/model/field/Field13DTest.java | 9 +- .../swift/model/field/Field14STest.java | 9 +- .../swift/model/field/Field19ATest.java | 19 +- .../swift/model/field/Field19Test.java | 13 +- .../swift/model/field/Field22CTest.java | 11 +- .../swift/model/field/Field23Test.java | 9 +- .../swift/model/field/Field252Test.java | 9 +- .../swift/model/field/Field257Test.java | 12 +- .../swift/model/field/Field259Test.java | 9 +- .../swift/model/field/Field26ATest.java | 10 +- .../swift/model/field/Field26CTest.java | 9 +- .../swift/model/field/Field281Test.java | 9 +- .../swift/model/field/Field31FTest.java | 9 +- .../swift/model/field/Field31XTest.java | 10 +- .../swift/model/field/Field32ATest.java | 15 +- .../swift/model/field/Field32BTest.java | 12 +- .../swift/model/field/Field32KTest.java | 10 +- .../swift/model/field/Field335Test.java | 11 +- .../swift/model/field/Field33GTest.java | 9 +- .../swift/model/field/Field343Test.java | 9 +- .../swift/model/field/Field345Test.java | 9 +- .../swift/model/field/Field34FTest.java | 12 +- .../swift/model/field/Field35BTest.java | 12 +- .../swift/model/field/Field36ETest.java | 11 +- .../swift/model/field/Field37ATest.java | 9 +- .../swift/model/field/Field37HTest.java | 13 +- .../swift/model/field/Field38GTest.java | 9 +- .../swift/model/field/Field41DTest.java | 10 +- .../swift/model/field/Field45BTest.java | 5 +- .../swift/model/field/Field48Test.java | 10 +- .../swift/model/field/Field49ATest.java | 11 +- .../swift/model/field/Field50ATest.java | 10 +- .../swift/model/field/Field50FTest.java | 107 +- .../swift/model/field/Field50GTest.java | 10 +- .../swift/model/field/Field50HTest.java | 10 +- .../swift/model/field/Field50KTest.java | 10 +- .../swift/model/field/Field52DTest.java | 14 +- .../swift/model/field/Field53ATest.java | 11 +- .../swift/model/field/Field53BTest.java | 11 +- .../swift/model/field/Field54BTest.java | 11 +- .../swift/model/field/Field57ATest.java | 11 +- .../swift/model/field/Field57CTest.java | 9 +- .../swift/model/field/Field57DTest.java | 8 +- .../swift/model/field/Field58DTest.java | 9 +- .../swift/model/field/Field59FTest.java | 33 +- .../swift/model/field/Field59Test.java | 18 +- .../swift/model/field/Field60FTest.java | 8 +- .../swift/model/field/Field61Test.java | 45 +- .../swift/model/field/Field64Test.java | 10 +- .../swift/model/field/Field68ATest.java | 10 +- .../swift/model/field/Field69BTest.java | 12 +- .../swift/model/field/Field69DTest.java | 12 +- .../swift/model/field/Field69FTest.java | 12 +- .../swift/model/field/Field70DTest.java | 7 +- .../swift/model/field/Field70ETest.java | 17 +- .../swift/model/field/Field70FTest.java | 127 +- .../swift/model/field/Field70Test.java | 9 +- .../swift/model/field/Field71BTest.java | 13 +- .../swift/model/field/Field77HTest.java | 9 +- .../swift/model/field/Field90ATest.java | 14 +- .../swift/model/field/Field90FTest.java | 11 +- .../swift/model/field/Field90JTest.java | 11 +- .../swift/model/field/Field90LTest.java | 13 +- .../swift/model/field/Field92JTest.java | 9 +- .../swift/model/field/Field92MTest.java | 11 +- .../swift/model/field/Field93BTest.java | 9 +- .../swift/model/field/Field93CTest.java | 11 +- .../swift/model/field/Field93ETest.java | 7 +- .../swift/model/field/Field93FTest.java | 7 +- .../swift/model/field/Field94DTest.java | 11 +- .../swift/model/field/Field94ETest.java | 9 +- .../swift/model/field/Field94GTest.java | 8 +- .../swift/model/field/Field94LTest.java | 12 +- .../swift/model/field/Field95LTest.java | 12 +- .../swift/model/field/Field97ATest.java | 9 +- .../swift/model/field/Field98CTest.java | 12 +- .../swift/model/field/Field98DTest.java | 9 +- .../swift/model/field/Field98ETest.java | 13 +- .../swift/model/field/Field98FTest.java | 10 +- .../swift/model/field/Field98JTest.java | 9 +- .../swift/model/field/Field98KTest.java | 9 +- ...FieldComponentLabelsCompatibilityTest.java | 17 +- .../model/field/FieldComponentNameTest.java | 1 - .../swift/model/field/FieldJsonTest.java | 109 +- .../swift/model/field/FieldTest.java | 13 +- .../swift/model/field/GetLabelTest.java | 4 +- .../model/field/GetLineField70ETest.java | 10 +- .../swift/model/field/GetLineTest.java | 13 +- .../model/field/GetValueDisplayTest.java | 13 +- .../field/MonetaryAmountResolverTest.java | 6 +- .../model/field/NarrativeBuilderTest.java | 101 +- .../NarrativeContainerJsonUtilsTest.java | 57 +- .../model/field/NarrativeResolverTest.java | 207 +- .../NationalClearingSystemComponentTest.java | 11 +- .../model/field/OptionJPartyFieldTest.java | 12 +- .../model/field/SwiftParseUtilsTest.java | 26 +- .../swift/model/mt/AbstractMTTest.java | 243 +- .../swift/model/mt/AbstractMtJsonTest.java | 1069 ++--- .../swift/model/mt/MTVariantTest.java | 4 +- .../swift/model/mt/SequenceUtilsTest.java | 2 +- .../swift/model/mt/SequencesAPITest.java | 165 +- .../swift/model/mt/mt0xx/MT010Test.java | 5 +- .../swift/model/mt/mt0xx/MT011Test.java | 6 +- .../swift/model/mt/mt0xx/MT015Test.java | 5 +- .../swift/model/mt/mt0xx/MT019Test.java | 2 +- .../swift/model/mt/mt0xx/MT020Test.java | 11 +- .../swift/model/mt/mt0xx/MT021Test.java | 3 +- .../swift/model/mt/mt0xx/MT022Test.java | 11 +- .../swift/model/mt/mt0xx/MT023Test.java | 3 +- .../swift/model/mt/mt0xx/MT024Test.java | 2 +- .../swift/model/mt/mt0xx/MT025Test.java | 2 +- .../swift/model/mt/mt0xx/MT028Test.java | 9 +- .../swift/model/mt/mt0xx/MT031Test.java | 3 +- .../swift/model/mt/mt0xx/package-info.java | 4 +- .../swift/model/mt/mt1xx/MT101Test.java | 60 +- .../swift/model/mt/mt1xx/MT103Test.java | 3 +- .../swift/model/mt/mt1xx/MT103_REMITTest.java | 3 +- .../swift/model/mt/mt1xx/MT103_STPTest.java | 3 +- .../swift/model/mt/mt2xx/MT202COVTest.java | 7 +- .../swift/model/mt/mt2xx/MT202Test.java | 3 +- .../swift/model/mt/mt2xx/MT205Test.java | 3 +- .../swift/model/mt/mt3xx/MT300Test.java | 71 +- .../swift/model/mt/mt3xx/MT304Test.java | 51 +- .../swift/model/mt/mt5xx/MT535Test.java | 3 +- .../swift/model/mt/mt5xx/MT536Test.java | 3 +- .../swift/model/mt/mt5xx/MT537Test.java | 29 +- .../swift/model/mt/mt5xx/MT538Test.java | 4 +- .../swift/model/mt/mt5xx/MT540Test.java | 78 +- .../swift/model/mt/mt5xx/MT564Test.java | 68 +- .../swift/model/mt/mt5xx/MT566Test.java | 4 +- .../swift/model/mt/mt5xx/MT575Test.java | 4 +- .../swift/model/mt/mt5xx/MT576Test.java | 4 +- .../swift/model/mt/mt5xx/MT586Test.java | 4 +- .../swift/model/mt/mt6xx/MT670Test.java | 4 +- .../swift/model/mt/mt6xx/MT671Test.java | 4 +- .../swift/model/mt/mt7xx/MT798Test.java | 142 +- .../swift/model/mt/mt9xx/MT920Test.java | 41 +- .../swift/utils/AckMessageComparatorTest.java | 47 +- .../swift/utils/IsoUtilsTest.java | 27 +- .../swift/utils/LineWrapperTest.java | 81 +- .../swift/utils/MurMessageComparatorTest.java | 33 +- .../swift/utils/ResolverUtilsTest.java | 8 +- .../swift/utils/SwiftFormatUtilsTest.java | 36 +- .../utils/SwiftMessageComparatorTest.java | 34 +- .../swift/utils/TestUtilsTest.java | 3 +- 428 files changed, 10218 insertions(+), 11134 deletions(-) diff --git a/.gitignore b/.gitignore index ed1cfb73b..eaab63fe8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ release.sh .idea/sonarlint/issuestore/ .idea/sonarlint/issuestore/ .idea/sonarlint/issuestore/ +.java-version diff --git a/build.gradle b/build.gradle index 77a89a192..e4bc99a90 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ buildscript { classpath 'ru.vyarus:gradle-quality-plugin:4.7.0' classpath 'pl.allegro.tech.build:axion-release-plugin:1.14.2' classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.20.0' } } apply plugin: 'pl.allegro.tech.build.axion-release' @@ -320,3 +321,14 @@ quality { spotbugsEffort = 'min' spotbugsMaxRank = 8 } + +apply plugin: 'com.diffplug.spotless' + +spotless { + java { + target '**/src/main/java/**/*.java', '**/src/test/java/**/*.java' + palantirJavaFormat() + } +} + +test.finalizedBy(spotlessCheck) diff --git a/src/main/java/com/prowidesoftware/CopyableTo.java b/src/main/java/com/prowidesoftware/CopyableTo.java index 9b6e76779..2251bd50f 100644 --- a/src/main/java/com/prowidesoftware/CopyableTo.java +++ b/src/main/java/com/prowidesoftware/CopyableTo.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/Generated.java b/src/main/java/com/prowidesoftware/Generated.java index e5d0f7e98..aa7454980 100644 --- a/src/main/java/com/prowidesoftware/Generated.java +++ b/src/main/java/com/prowidesoftware/Generated.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,5 @@ */ @Documented @Retention(SOURCE) -@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, - LOCAL_VARIABLE, PARAMETER}) -public @interface Generated { - -} +@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, PARAMETER}) +public @interface Generated {} diff --git a/src/main/java/com/prowidesoftware/JsonSerializable.java b/src/main/java/com/prowidesoftware/JsonSerializable.java index 54bb9c913..445a92e85 100644 --- a/src/main/java/com/prowidesoftware/JsonSerializable.java +++ b/src/main/java/com/prowidesoftware/JsonSerializable.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,5 +28,4 @@ public interface JsonSerializable { * @return the message content as JSON */ String toJson(); - } diff --git a/src/main/java/com/prowidesoftware/ProwideException.java b/src/main/java/com/prowidesoftware/ProwideException.java index c3e9ffba4..10a206f1b 100644 --- a/src/main/java/com/prowidesoftware/ProwideException.java +++ b/src/main/java/com/prowidesoftware/ProwideException.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import java.util.*; import java.util.Map.Entry; - /** * Base class for Prowide exceptions hierarchy. * @@ -26,12 +25,12 @@ */ public class ProwideException extends RuntimeException { private static final long serialVersionUID = 4645197208853563727L; - private static transient final java.util.logging.Logger log = java.util.logging.Logger.getLogger(ProwideException.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(ProwideException.class.getName()); private final Map variables = new HashMap<>(); - public ProwideException() { - } + public ProwideException() {} public ProwideException(final String message, final Throwable cause) { super(message, cause); @@ -98,7 +97,6 @@ protected String getMessage(final Locale locale, final Map varia log.fine("No localized message found for exception key '" + key + "'"); return super.getMessage(); } - } static String substitute(String message, Map variables) { diff --git a/src/main/java/com/prowidesoftware/ProwideLocale.java b/src/main/java/com/prowidesoftware/ProwideLocale.java index 3d6eb6bf5..b35c2ca9f 100644 --- a/src/main/java/com/prowidesoftware/ProwideLocale.java +++ b/src/main/java/com/prowidesoftware/ProwideLocale.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,5 +85,4 @@ public static ResourceBundle getBundle(final String resource, Locale locale) { public static ResourceBundle getBundle(final String resource) { return getBundle(resource, Locale.getDefault()); } - } diff --git a/src/main/java/com/prowidesoftware/deprecation/DeprecationUtils.java b/src/main/java/com/prowidesoftware/deprecation/DeprecationUtils.java index cae205f76..14521a802 100644 --- a/src/main/java/com/prowidesoftware/deprecation/DeprecationUtils.java +++ b/src/main/java/com/prowidesoftware/deprecation/DeprecationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,11 @@ */ package com.prowidesoftware.deprecation; -import org.apache.commons.lang3.StringUtils; - import java.lang.reflect.Field; import java.util.Collections; import java.util.Map; import java.util.logging.Level; +import org.apache.commons.lang3.StringUtils; /** * Helper API to implement the http://www.prowidesoftware.com/resources/deprecation-policy @@ -33,7 +32,9 @@ public class DeprecationUtils { * Environment variable used to switch off deprecation phase implementation */ public static final String PW_DEPRECATED = "PW_DEPRECATED"; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(DeprecationUtils.class.getName()); + + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(DeprecationUtils.class.getName()); // Suppress default constructor for noninstantiability private DeprecationUtils() { @@ -142,7 +143,8 @@ private static void setEnv(final String key, final String value) { theEnvironmentField.setAccessible(true); Map env = (Map) theEnvironmentField.get(null); env.put(key, value); - Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment"); + Field theCaseInsensitiveEnvironmentField = + processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment"); theCaseInsensitiveEnvironmentField.setAccessible(true); Map cienv = (Map) theCaseInsensitiveEnvironmentField.get(null); cienv.put(key, value); @@ -176,5 +178,4 @@ public enum EnvironmentVariableKey { NODELAY, NOEXCEPTION } - } diff --git a/src/main/java/com/prowidesoftware/deprecation/ProwideDeprecated.java b/src/main/java/com/prowidesoftware/deprecation/ProwideDeprecated.java index 590918ab2..f29e049b3 100644 --- a/src/main/java/com/prowidesoftware/deprecation/ProwideDeprecated.java +++ b/src/main/java/com/prowidesoftware/deprecation/ProwideDeprecated.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,5 +55,4 @@ * @return year */ TargetYear phase4() default TargetYear.SRU2026; - } diff --git a/src/main/java/com/prowidesoftware/deprecation/TargetYear.java b/src/main/java/com/prowidesoftware/deprecation/TargetYear.java index c81bea151..4d5d8c3c6 100644 --- a/src/main/java/com/prowidesoftware/deprecation/TargetYear.java +++ b/src/main/java/com/prowidesoftware/deprecation/TargetYear.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/deprecation/package-info.java b/src/main/java/com/prowidesoftware/deprecation/package-info.java index 82792bddc..7d69fcf37 100644 --- a/src/main/java/com/prowidesoftware/deprecation/package-info.java +++ b/src/main/java/com/prowidesoftware/deprecation/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Classes to support Prowide deprecation policy: Deprecation Policy */ -package com.prowidesoftware.deprecation; \ No newline at end of file +package com.prowidesoftware.deprecation; diff --git a/src/main/java/com/prowidesoftware/package-info.java b/src/main/java/com/prowidesoftware/package-info.java index 63c5d0118..cad29ea01 100644 --- a/src/main/java/com/prowidesoftware/package-info.java +++ b/src/main/java/com/prowidesoftware/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Generic helper classes */ -package com.prowidesoftware; \ No newline at end of file +package com.prowidesoftware; diff --git a/src/main/java/com/prowidesoftware/swift/UnknownMTException.java b/src/main/java/com/prowidesoftware/swift/UnknownMTException.java index e69de29bb..8b1378917 100644 --- a/src/main/java/com/prowidesoftware/swift/UnknownMTException.java +++ b/src/main/java/com/prowidesoftware/swift/UnknownMTException.java @@ -0,0 +1 @@ + diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java index 48af08a76..d36708c42 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import jakarta.validation.Constraint; import jakarta.validation.Payload; - import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -45,4 +44,4 @@ Class[] groups() default {}; Class[] payload() default {}; -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java index 8f5be99c4..90baf9228 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,7 @@ public class BicValidator implements ConstraintValidator { @Override - public void initialize(BicConstraint bic) { - } + public void initialize(BicConstraint bic) {} @Override public boolean isValid(String bic, ConstraintValidatorContext context) { @@ -47,5 +46,4 @@ public boolean isValid(String bic, ConstraintValidatorContext context) { return false; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java index 5b73fcd65..d306f76b7 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import jakarta.validation.Constraint; import jakarta.validation.Payload; - import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -45,4 +44,4 @@ Class[] groups() default {}; Class[] payload() default {}; -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java index 1ee1df146..59c6a0a92 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,7 @@ public class CountryValidator implements ConstraintValidator { @Override - public void initialize(CountryConstraint country) { - } + public void initialize(CountryConstraint country) {} @Override public boolean isValid(String country, ConstraintValidatorContext context) { @@ -39,5 +38,4 @@ public boolean isValid(String country, ConstraintValidatorContext context) { } return IsoUtils.getInstance().isValidISOCountry(country); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java index a208274c3..38b2f07b5 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import jakarta.validation.Constraint; import jakarta.validation.Payload; - import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java index 00716a07b..ea2519b1c 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,7 @@ public class CurrencyValidator implements ConstraintValidator { @Override - public void initialize(CurrencyConstraint currency) { - } + public void initialize(CurrencyConstraint currency) {} @Override public boolean isValid(String currency, ConstraintValidatorContext context) { @@ -39,5 +38,4 @@ public boolean isValid(String currency, ConstraintValidatorContext context) { } return IsoUtils.getInstance().isValidISOCurrency(currency); } - } diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java index 4249b8a52..a1c2912d0 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import jakarta.validation.Constraint; import jakarta.validation.Payload; - import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -45,4 +44,4 @@ Class[] groups() default {}; Class[] payload() default {}; -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java index 9421570c6..1c92bfe1a 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,7 @@ public class IbanValidator implements ConstraintValidator { @Override - public void initialize(IbanConstraint iban) { - } + public void initialize(IbanConstraint iban) {} @Override public boolean isValid(String iban, ConstraintValidatorContext context) { @@ -47,5 +46,4 @@ public boolean isValid(String iban, ConstraintValidatorContext context) { return false; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/internal/NonUniqueSeparator.java b/src/main/java/com/prowidesoftware/swift/internal/NonUniqueSeparator.java index d4f07522c..c2270c992 100644 --- a/src/main/java/com/prowidesoftware/swift/internal/NonUniqueSeparator.java +++ b/src/main/java/com/prowidesoftware/swift/internal/NonUniqueSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,4 @@ */ @Documented @Retention(RetentionPolicy.SOURCE) -public @interface NonUniqueSeparator { - -} +public @interface NonUniqueSeparator {} diff --git a/src/main/java/com/prowidesoftware/swift/internal/SequenceStyle.java b/src/main/java/com/prowidesoftware/swift/internal/SequenceStyle.java index df84ab7af..1b637a97e 100644 --- a/src/main/java/com/prowidesoftware/swift/internal/SequenceStyle.java +++ b/src/main/java/com/prowidesoftware/swift/internal/SequenceStyle.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/internal/package-info.java b/src/main/java/com/prowidesoftware/swift/internal/package-info.java index 2b98e44ef..204e3cf5c 100644 --- a/src/main/java/com/prowidesoftware/swift/internal/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/internal/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Internal use classes */ -package com.prowidesoftware.swift.internal; \ No newline at end of file +package com.prowidesoftware.swift.internal; diff --git a/src/main/java/com/prowidesoftware/swift/io/AbstractReader.java b/src/main/java/com/prowidesoftware/swift/io/AbstractReader.java index fdc88bfd8..2d82632da 100644 --- a/src/main/java/com/prowidesoftware/swift/io/AbstractReader.java +++ b/src/main/java/com/prowidesoftware/swift/io/AbstractReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,14 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Iterator; import java.util.Objects; import java.util.logging.Logger; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Base class for message reader iterators. @@ -36,6 +35,7 @@ public abstract class AbstractReader implements Iterator, Iterable iterator() throws IllegalArgumentException { if (usedAsIterable) { - throw new IllegalStateException("This reader has already been used as Iterator and the implementation does not support multiple iterations, create another reader instance instead"); + throw new IllegalStateException( + "This reader has already been used as Iterator and the implementation does not support multiple iterations, create another reader instance instead"); } usedAsIterable = true; return this; @@ -129,7 +131,8 @@ public AbstractMT nextMT() throws IOException { final String fin = candidate.getUnparsedTexts().getAsFINString(); return AbstractMT.parse(fin); } else if (candidate.isServiceMessage()) { - log.warning("nextMT in " + getClass().getName() + " is not intended for service messages, use nextSwiftMessage() instead"); + log.warning("nextMT in " + getClass().getName() + + " is not intended for service messages, use nextSwiftMessage() instead"); return null; } else { return candidate.toMT(); @@ -155,5 +158,4 @@ public SwiftMessage nextSwiftMessage() throws IOException { log.warning("Ignoring blank message"); return null; } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/AbstractWriter.java b/src/main/java/com/prowidesoftware/swift/io/AbstractWriter.java index ed16b814c..d883fa528 100644 --- a/src/main/java/com/prowidesoftware/swift/io/AbstractWriter.java +++ b/src/main/java/com/prowidesoftware/swift/io/AbstractWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,8 @@ public AbstractWriter(final String filename) throws FileNotFoundException { * @throws FileNotFoundException if file does not exist */ public AbstractWriter(final File _file, final Charset _charset) throws FileNotFoundException { - this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(_file), _charset != null ? _charset : StandardCharsets.UTF_8)); + this.writer = new BufferedWriter(new OutputStreamWriter( + new FileOutputStream(_file), _charset != null ? _charset : StandardCharsets.UTF_8)); } public AbstractWriter(final OutputStream stream) { @@ -77,7 +78,8 @@ public AbstractWriter(final OutputStream stream) { * @param _charset charset */ public AbstractWriter(final OutputStream _stream, Charset _charset) { - this.writer = new BufferedWriter(new OutputStreamWriter(_stream, _charset != null ? _charset : StandardCharsets.UTF_8)); + this.writer = new BufferedWriter( + new OutputStreamWriter(_stream, _charset != null ? _charset : StandardCharsets.UTF_8)); } /** @@ -101,5 +103,4 @@ public void flush() throws IOException { this.writer.flush(); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/ConversionService.java b/src/main/java/com/prowidesoftware/swift/io/ConversionService.java index 26ab4114e..e722ce7d3 100644 --- a/src/main/java/com/prowidesoftware/swift/io/ConversionService.java +++ b/src/main/java/com/prowidesoftware/swift/io/ConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,13 +20,10 @@ import com.prowidesoftware.swift.io.writer.SwiftWriter; import com.prowidesoftware.swift.io.writer.XMLWriterVisitor; import com.prowidesoftware.swift.model.SwiftMessage; -import org.apache.commons.lang3.Validate; - import java.io.IOException; import java.io.StringWriter; import java.util.Objects; - /** * This interface provides a general conversion service between three different formats: *
    @@ -125,5 +122,4 @@ public SwiftMessage getMessageFromFIN(final String fin) { public SwiftMessage getMessageFromXML(final String xml) { return new XMLParser().parse(xml); } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/IConversionService.java b/src/main/java/com/prowidesoftware/swift/io/IConversionService.java index 465c7378b..23a2d51b6 100644 --- a/src/main/java/com/prowidesoftware/swift/io/IConversionService.java +++ b/src/main/java/com/prowidesoftware/swift/io/IConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,5 +88,4 @@ public interface IConversionService { * @throws IllegalArgumentException if XML is null */ SwiftMessage getMessageFromXML(String xml); - } diff --git a/src/main/java/com/prowidesoftware/swift/io/PPCReader.java b/src/main/java/com/prowidesoftware/swift/io/PPCReader.java index d027b3525..da9b97a2e 100644 --- a/src/main/java/com/prowidesoftware/swift/io/PPCReader.java +++ b/src/main/java/com/prowidesoftware/swift/io/PPCReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,5 +126,4 @@ public String next() { throw new IllegalStateException("hasNext did not return true but this method was called"); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/PPCWriter.java b/src/main/java/com/prowidesoftware/swift/io/PPCWriter.java index 93fea2e16..cfce7794c 100644 --- a/src/main/java/com/prowidesoftware/swift/io/PPCWriter.java +++ b/src/main/java/com/prowidesoftware/swift/io/PPCWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,6 @@ import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.apache.commons.lang3.Validate; - import java.io.*; import java.nio.charset.Charset; import java.util.Objects; @@ -51,7 +49,9 @@ public PPCWriter(final Writer writer) { * @deprecated Use constructor signature with {@link Charset} parameter instead */ @Deprecated - @ProwideDeprecated(phase4 = TargetYear.SRU2024, comment = "Use constructor signature with Charset parameter instead") + @ProwideDeprecated( + phase4 = TargetYear.SRU2024, + comment = "Use constructor signature with Charset parameter instead") public PPCWriter(final File file) throws FileNotFoundException { super(file); } @@ -60,7 +60,9 @@ public PPCWriter(final File file) throws FileNotFoundException { * @deprecated Use constructor signature with {@link Charset} parameter instead */ @Deprecated - @ProwideDeprecated(phase4 = TargetYear.SRU2024, comment = "Use constructor signature with Charset parameter instead") + @ProwideDeprecated( + phase4 = TargetYear.SRU2024, + comment = "Use constructor signature with Charset parameter instead") public PPCWriter(final String filename) throws FileNotFoundException { super(filename); } @@ -79,7 +81,9 @@ public PPCWriter(final File _file, final Charset _charset) throws FileNotFoundEx * @deprecated Use constructor signature with {@link Charset} parameter instead */ @Deprecated - @ProwideDeprecated(phase4 = TargetYear.SRU2024, comment = "Use constructor signature with Charset parameter instead") + @ProwideDeprecated( + phase4 = TargetYear.SRU2024, + comment = "Use constructor signature with Charset parameter instead") public PPCWriter(final OutputStream stream) { super(stream); } @@ -160,5 +164,4 @@ public void write(final String msg) throws IOException { public void write(final AbstractMT msg) throws IOException { write(msg, this.writer); } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/RJEReader.java b/src/main/java/com/prowidesoftware/swift/io/RJEReader.java index 585ff3ca5..d7bef9433 100644 --- a/src/main/java/com/prowidesoftware/swift/io/RJEReader.java +++ b/src/main/java/com/prowidesoftware/swift/io/RJEReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,5 +124,4 @@ public String next() { public void setSplitChar(final char c) { this.splitChar = c; } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/RJEWriter.java b/src/main/java/com/prowidesoftware/swift/io/RJEWriter.java index ff4a93edb..44e722059 100644 --- a/src/main/java/com/prowidesoftware/swift/io/RJEWriter.java +++ b/src/main/java/com/prowidesoftware/swift/io/RJEWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ import com.prowidesoftware.swift.io.writer.FINWriterVisitor; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.apache.commons.lang3.Validate; - import java.io.*; import java.nio.charset.Charset; import java.util.Objects; @@ -36,7 +34,6 @@ public class RJEWriter extends AbstractWriter { private int count = 0; private char splitChar = RJEReader.SPLITCHAR; - /** * Constructs a RJEWriter to write content into a given Writer instance. * @@ -149,5 +146,4 @@ private void _write(final String msg, final Writer writer) throws IOException { public void setSplitChar(final char c) { this.splitChar = c; } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/package-info.java b/src/main/java/com/prowidesoftware/swift/io/package-info.java index 75cd090f8..6fff2c9bd 100644 --- a/src/main/java/com/prowidesoftware/swift/io/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/io/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * RJE reader/writer to process batch files with multiple messages. */ -package com.prowidesoftware.swift.io; \ No newline at end of file +package com.prowidesoftware.swift.io; diff --git a/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java b/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java index 9ab23933d..6dc7988c4 100644 --- a/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java +++ b/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,11 @@ import com.prowidesoftware.ProwideException; import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.utils.Lib; -import org.apache.commons.lang3.StringUtils; - import java.io.*; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.StringUtils; /** * FIN Parser. This implementation now properly supports all system messages (i.e: messages for MT 0xx) and @@ -38,11 +37,13 @@ */ public class SwiftParser { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftParser.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftParser.class.getName()); /** * Errors found while parsing the message. */ private final List errors = new ArrayList<>(); + private Reader reader; private StringBuilder buffer; /** @@ -51,6 +52,7 @@ public class SwiftParser { * like a value in a previous tag or block. */ private SwiftMessage currentMessage; + private int lastBlockStartOffset = 0; /** @@ -90,8 +92,7 @@ public SwiftParser(final String message) { * default constructor.
    * NOTE: If this constructor is called, setReader must be called to use the parser */ - public SwiftParser() { - } + public SwiftParser() {} /** * Create a parser and feed it with the contents of the given file @@ -139,7 +140,7 @@ private static boolean isBlockEnd(final char c) { * @return content parsed into a block 4 or an empty block 4 if string cannot be parsed * @since 7.8.4 */ - static public SwiftBlock4 parseBlock4(String s) { + public static SwiftBlock4 parseBlock4(String s) { SwiftBlock4 b4 = new SwiftBlock4(); String toParse = s; if (toParse.startsWith("{")) { @@ -159,7 +160,7 @@ static public SwiftBlock4 parseBlock4(String s) { * @return content parsed into a block 3 or an empty block 3 if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock3 parseBlock3(String s) { + public static SwiftBlock3 parseBlock3(String s) { SwiftBlock3 b3 = new SwiftBlock3(); SwiftParser parser = new SwiftParser(); return (SwiftBlock3) parser.consumeTagListBlock(b3, s); @@ -172,7 +173,7 @@ static public SwiftBlock3 parseBlock3(String s) { * @return content parsed into a block 5 or an empty block 5 if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock5 parseBlock5(String s) { + public static SwiftBlock5 parseBlock5(String s) { SwiftBlock5 b5 = new SwiftBlock5(); SwiftParser parser = new SwiftParser(); return (SwiftBlock5) parser.consumeTagListBlock(b5, s); @@ -185,7 +186,7 @@ static public SwiftBlock5 parseBlock5(String s) { * @return content parsed into a block 1 or an empty block 1 if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock1 parseBlock1(String s) { + public static SwiftBlock1 parseBlock1(String s) { return new SwiftBlock1(StringUtils.strip(s, "{}"), true); } @@ -197,7 +198,7 @@ static public SwiftBlock1 parseBlock1(String s) { * @return content parsed into a block 2 or an empty block 2 (output) if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock2 parseBlock2(String s) { + public static SwiftBlock2 parseBlock2(String s) { if (s != null) { Character block2Type = extractBlock2Type(s); if (Character.valueOf('I').equals(block2Type)) { @@ -226,7 +227,7 @@ private static SwiftBlock2 enrichBlockType(SwiftBlock2 block, String type) { * @return content parsed into a block 2 or an empty block 2 if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock2Input parseBlock2Input(String s) { + public static SwiftBlock2Input parseBlock2Input(String s) { return new SwiftBlock2Input(StringUtils.strip(s, "{}"), true); } @@ -238,7 +239,7 @@ static public SwiftBlock2Input parseBlock2Input(String s) { * @return content parsed into a block 2 or an empty block 2 if string cannot be parsed * @since 7.8.6 */ - static public SwiftBlock2Output parseBlock2Output(String s) { + public static SwiftBlock2Output parseBlock2Output(String s) { return new SwiftBlock2Output(StringUtils.strip(s, "{}"), true); } @@ -470,12 +471,12 @@ private SwiftBlock1 createBlock1(final String s) { private SwiftBlock2 createBlock2(final String s) { Character block2Type = extractBlock2Type(s); if (Character.valueOf('I').equals(block2Type)) { - return enrichBlockType(createBlock2Input(s),"I"); + return enrichBlockType(createBlock2Input(s), "I"); } else if (Character.valueOf('O').equals(block2Type)) { - return enrichBlockType(createBlock2Output(s),"O"); + return enrichBlockType(createBlock2Output(s), "O"); } else { - final String error = "Expected an \"I\" or \"O\" to identify " + - "the block 2 type (direction) and found: " + block2Type; + final String error = + "Expected an \"I\" or \"O\" to identify " + "the block 2 type (direction) and found: " + block2Type; if (this.configuration.isLenient()) { this.errors.add(error); // in lenient mode we use the size as heuristic to default as Input or Output @@ -507,7 +508,6 @@ private SwiftBlock2Input createBlock2Input(final String s) { } } - /** * Creates the block 2, dealing with the {@link IllegalArgumentException} in case of lenient mode */ @@ -560,8 +560,7 @@ protected SwiftTagListBlock consumeTagListBlock(final SwiftTagListBlock b, final } else { // read all the characters until data end or a new '{' int end; - for (end = i; end < data.length() && data.charAt(end) != '{'; end++) { - } + for (end = i; end < data.length() && data.charAt(end) != '{'; end++) {} final String unparsedText = data.substring(i, end).trim(); if (!"".equals(unparsedText)) { b.unparsedTextAddText(unparsedText); @@ -784,12 +783,12 @@ protected int findEndOfTagByLineFeed(final String s, int start, final boolean is // found it i = begin; break; - // if it's a colon followed by a character different than CR or LF (':x') => it's a proper tag end - // because we have reached a new line with a beginning new tag. - // Note: It is note sufficient to check for a starting colon because for some fields like - // 77E for example, it is allowed the field content to have a ':' as the second line - // of its content. - // check if :xxx matches a new starting tag or not, break only if matches valid start of tag + // if it's a colon followed by a character different than CR or LF (':x') => it's a proper tag end + // because we have reached a new line with a beginning new tag. + // Note: It is note sufficient to check for a starting colon because for some fields like + // 77E for example, it is allowed the field content to have a ':' as the second line + // of its content. + // check if :xxx matches a new starting tag or not, break only if matches valid start of tag } else if (c == ':' && isTagStart(s, i + 1)) { i = begin; break; @@ -1048,7 +1047,7 @@ protected String readUntilBlockEnds() throws IOException { int count = 0; Boolean isTextBlock = null; - //iterate until proper block end or EOF + // iterate until proper block end or EOF while (!done) { c = getChar(); // check if we can set the textblock flag first @@ -1180,7 +1179,7 @@ protected String findBlockStart() throws IOException { } // debug code - //if (textUntilBlock.length()>0) log.fine("textUntilBlock: "+textUntilBlock.toString()); + // if (textUntilBlock.length()>0) log.fine("textUntilBlock: "+textUntilBlock.toString()); return textUntilBlock.length() > 0 ? textUntilBlock.toString() : StringUtils.EMPTY; } @@ -1237,5 +1236,4 @@ public SwiftParserConfiguration getConfiguration() { public void setConfiguration(final SwiftParserConfiguration configuration) { this.configuration = configuration; } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParserConfiguration.java b/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParserConfiguration.java index 26a8a65ee..9a00fa52c 100644 --- a/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParserConfiguration.java +++ b/src/main/java/com/prowidesoftware/swift/io/parser/SwiftParserConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/io/parser/XMLParser.java b/src/main/java/com/prowidesoftware/swift/io/parser/XMLParser.java index b5baa6f0e..342f40bab 100644 --- a/src/main/java/com/prowidesoftware/swift/io/parser/XMLParser.java +++ b/src/main/java/com/prowidesoftware/swift/io/parser/XMLParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,16 @@ import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.utils.SafeXmlUtils; +import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; +import java.util.logging.Level; +import javax.xml.parsers.DocumentBuilder; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import java.io.ByteArrayInputStream; -import java.nio.charset.StandardCharsets; -import java.util.logging.Level; - -import javax.xml.parsers.DocumentBuilder; - /** * This is the main parser for WIFE's XML internal representation.
    * The supported XML format is consider internal because it is an ad-hoc @@ -46,7 +44,8 @@ * @since 5.0 */ public class XMLParser { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(XMLParser.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(XMLParser.class.getName()); private static final String UNPARSEDTEXTS = "unparsedtexts"; @@ -186,7 +185,8 @@ private SwiftBlock2 getBlock2FromNode(final Node blockNode) { } else if ("output".equals(type)) { return getBlock2OutputFromNode(blockNode); } else { - log.severe("expected 'input' or 'output' value for 'type' atribute at xml tag, and found: " + type); + log.severe( + "expected 'input' or 'output' value for 'type' atribute at xml tag, and found: " + type); return null; } } @@ -340,7 +340,7 @@ private Tag getTag(final Node t) { } if ("value".equalsIgnoreCase(n.getNodeName())) { String text = getText(n); - //normalize line feeds (DOM parser removes carriage return characters from original XML file) + // normalize line feeds (DOM parser removes carriage return characters from original XML file) text = StringUtils.replace(text, "\n", FINWriterVisitor.SWIFT_EOL); tag.setValue(text); } else if (UNPARSEDTEXTS.equalsIgnoreCase(n.getNodeName())) { @@ -378,7 +378,7 @@ private Field getField(final Node t) { final String number = getNodeAttribute(n, "number"); if (StringUtils.isNumeric(number)) { String text = getText(n); - //normalize line feeds (DOM parser removes carriage return characters from original XML file) + // normalize line feeds (DOM parser removes carriage return characters from original XML file) text = StringUtils.replace(text, "\n", FINWriterVisitor.SWIFT_EOL); field.setComponent(Integer.parseInt(number), text); } diff --git a/src/main/java/com/prowidesoftware/swift/io/parser/package-info.java b/src/main/java/com/prowidesoftware/swift/io/parser/package-info.java index 46e600196..fa68be6ca 100644 --- a/src/main/java/com/prowidesoftware/swift/io/parser/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/io/parser/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Classes that parse SWIFT messages from FIN or XML into SwiftMessage objects. */ -package com.prowidesoftware.swift.io.parser; \ No newline at end of file +package com.prowidesoftware.swift.io.parser; diff --git a/src/main/java/com/prowidesoftware/swift/io/writer/FINWriterVisitor.java b/src/main/java/com/prowidesoftware/swift/io/writer/FINWriterVisitor.java index 0ba5450a3..0807a9084 100644 --- a/src/main/java/com/prowidesoftware/swift/io/writer/FINWriterVisitor.java +++ b/src/main/java/com/prowidesoftware/swift/io/writer/FINWriterVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,10 @@ import com.prowidesoftware.ProwideException; import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.utils.IMessageVisitor; -import org.apache.commons.lang3.StringUtils; - import java.io.IOException; import java.io.Writer; import java.util.logging.Level; +import org.apache.commons.lang3.StringUtils; /** * Main class for writing SwiftMessage objects into SWIFT FIN message text. @@ -36,7 +35,9 @@ public class FINWriterVisitor implements IMessageVisitor { * EOL as defined by swift */ public static final String SWIFT_EOL = "\r\n"; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(FINWriterVisitor.class.getName()); + + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(FINWriterVisitor.class.getName()); private final Writer writer; private boolean block4asText = true; private boolean trimTagValues = false; @@ -80,7 +81,8 @@ public void startMessage(SwiftMessage m) { // if b1 not empty if (b1 != null && StringUtils.isNotEmpty(b1.getValue())) { // check for app id and service id - boolean isAppIdOrServiceId = !StringUtils.equals(b1.getApplicationId(), "F") || !StringUtils.equals(b1.getServiceId(), "01"); + boolean isAppIdOrServiceId = + !StringUtils.equals(b1.getApplicationId(), "F") || !StringUtils.equals(b1.getServiceId(), "01"); if (isAppIdOrServiceId) { // if app identifier NOT 'F' OR service identifier NOT '01' => USE TAG-BLOCK syntax this.block4asText = false; @@ -107,8 +109,7 @@ public void endMessage(SwiftMessage m) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (m.getUnparsedTextsSize() > 0) - write(m.getUnparsedTexts()); + if (m.getUnparsedTextsSize() > 0) write(m.getUnparsedTexts()); // cleanup status this.block4asText = true; @@ -139,8 +140,7 @@ public void endBlock1(SwiftBlock1 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write("}"); @@ -171,8 +171,7 @@ public void endBlock2(SwiftBlock2 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write("}"); @@ -201,8 +200,7 @@ public void endBlock3(SwiftBlock3 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write("}"); @@ -235,8 +233,7 @@ public void endBlock4(SwiftBlock4 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write((this.block4asText ? "-" : "") + "}"); @@ -265,8 +262,7 @@ public void endBlock5(SwiftBlock5 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write("}"); @@ -295,8 +291,7 @@ public void endBlockUser(SwiftBlockUser b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts()); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts()); // write block termination write("}"); @@ -308,8 +303,7 @@ public void endBlockUser(SwiftBlockUser b) { // //////////////////////////////////////////////////////////// public void tag(SwiftBlock b, Tag t) { - if (b == null) - return; + if (b == null) return; if (b instanceof SwiftBlock3) { tag((SwiftBlock3) b, t); } @@ -352,8 +346,7 @@ private void appendBlockTag(Tag t) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (t.getUnparsedTextsSize() > 0) - write(t.getUnparsedTexts()); + if (t.getUnparsedTextsSize() > 0) write(t.getUnparsedTexts()); // write closing braquets write("}"); @@ -393,7 +386,6 @@ private void appendTextTag(Tag t) { } } - /** * Returns the tags value. * @@ -415,8 +407,7 @@ private void write(UnparsedTextList texts) { // write the unparsed texts (if any) if (texts.size() > 0) { for (int i = 0; i < texts.size(); i++) { - if (texts.isMessage(i)) - write(texts.getText(i)); + if (texts.isMessage(i)) write(texts.getText(i)); } } } @@ -429,5 +420,4 @@ private void write(String s) { throw new ProwideException(e); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/writer/MultilineUtil.java b/src/main/java/com/prowidesoftware/swift/io/writer/MultilineUtil.java index 88db35f3c..089d06c81 100644 --- a/src/main/java/com/prowidesoftware/swift/io/writer/MultilineUtil.java +++ b/src/main/java/com/prowidesoftware/swift/io/writer/MultilineUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,6 @@ */ package com.prowidesoftware.swift.io.writer; -import org.apache.commons.lang3.Validate; - import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -27,10 +25,10 @@ * * @author sebastian */ -//Sebastian Feb 2016: make this API static +// Sebastian Feb 2016: make this API static public class MultilineUtil { - private static final transient java.util.logging.Logger log = java.util.logging.Logger - .getLogger(MultilineUtil.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(MultilineUtil.class.getName()); /** * Same as removeInnerEmptyLines(lines, false) @@ -51,8 +49,7 @@ public String[] removeInnerEmptyLines(final String[] lines) { */ public String[] removeInnerEmptyLines(final String[] lines, final boolean keepAll) { Objects.requireNonNull(lines, "lines cannot be null"); - if (lines.length == 0) - return lines; + if (lines.length == 0) return lines; final List text = new ArrayList<>(); List empty = null; if (keepAll) { @@ -80,5 +77,4 @@ public String[] removeInnerEmptyLines(final String[] lines, final boolean keepAl private boolean isEmpty(String string) { return string == null || string.trim().length() == 0; } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/writer/SwiftWriter.java b/src/main/java/com/prowidesoftware/swift/io/writer/SwiftWriter.java index 32ec70e64..15fe2597a 100644 --- a/src/main/java/com/prowidesoftware/swift/io/writer/SwiftWriter.java +++ b/src/main/java/com/prowidesoftware/swift/io/writer/SwiftWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,18 @@ package com.prowidesoftware.swift.io.writer; import com.prowidesoftware.swift.model.*; -import org.apache.commons.lang3.Validate; - import java.io.BufferedReader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; +import org.apache.commons.lang3.Validate; /** * Writes MT messages content into FIN format (raw SWIFT format for MT messages). */ public class SwiftWriter { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftWriter.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftWriter.class.getName()); private static final String WRITER_MESSAGE = "writer cannot be null"; @@ -280,11 +280,10 @@ public static String ensureEols(final String content) { log.severe("Error in EOL correction: " + e); } if (buf.length() > 0) { - //remove the last EOL inserted + // remove the last EOL inserted return buf.substring(0, buf.length() - FINWriterVisitor.SWIFT_EOL.length()); } else { return ""; } } - } diff --git a/src/main/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitor.java b/src/main/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitor.java index e1177b4bd..7dd2ac1e1 100644 --- a/src/main/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitor.java +++ b/src/main/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,11 @@ import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.utils.IMessageVisitor; -import org.apache.commons.lang3.StringUtils; - import java.io.IOException; import java.io.Writer; import java.util.List; import java.util.logging.Level; +import org.apache.commons.lang3.StringUtils; /** * Main class for XML generation, that is called from {@link SwiftMessage#visit(IMessageVisitor)}. @@ -33,8 +32,8 @@ * @author sebastian */ public class XMLWriterVisitor implements IMessageVisitor { - private static final transient java.util.logging.Logger log = java.util.logging.Logger - .getLogger(XMLWriterVisitor.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(XMLWriterVisitor.class.getName()); private static final String EOL = System.getProperties().getProperty("line.separator", "\n"); @@ -77,8 +76,7 @@ public void endMessage(SwiftMessage m) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (m.getUnparsedTextsSize() > 0) - write(m.getUnparsedTexts(), 0); + if (m.getUnparsedTextsSize() > 0) write(m.getUnparsedTexts(), 0); write(EOL + ""); } @@ -121,8 +119,7 @@ public void endBlock1(SwiftBlock1 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -138,10 +135,8 @@ public void startBlock2(SwiftBlock2 b) { // decide on the tag to use String xmlTag = ""; if (!b.isEmpty()) { - if (b instanceof SwiftBlock2Input) - xmlTag = ""; - if (b instanceof SwiftBlock2Output) - xmlTag = ""; + if (b instanceof SwiftBlock2Input) xmlTag = ""; + if (b instanceof SwiftBlock2Output) xmlTag = ""; } write(EOL + xmlTag); } @@ -183,8 +178,8 @@ public void value(SwiftBlock2 b, String v) { appendElement(sb, "MIRSequenceNumber", b2.getMIRSequenceNumber()); appendElement(sb, "receiverOutputDate", b2.getReceiverOutputDate()); appendElement(sb, "receiverOutputTime", b2.getReceiverOutputTime()); - if (b2.getMessagePriority() != null) // optional for service messages - appendElement(sb, "messagePriority", b2.getMessagePriority()); + if (b2.getMessagePriority() != null) // optional for service messages + appendElement(sb, "messagePriority", b2.getMessagePriority()); } write(sb.toString()); @@ -198,8 +193,7 @@ public void endBlock2(SwiftBlock2 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -228,8 +222,7 @@ public void endBlock3(SwiftBlock3 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -262,8 +255,7 @@ public void endBlock4(SwiftBlock4 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -292,8 +284,7 @@ public void endBlock5(SwiftBlock5 b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -322,8 +313,7 @@ public void endBlockUser(SwiftBlockUser b) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (b.getUnparsedTextsSize() > 0) - write(b.getUnparsedTexts(), 1); + if (b.getUnparsedTextsSize() > 0) write(b.getUnparsedTexts(), 1); // write block termination write(EOL + ""); @@ -335,8 +325,7 @@ public void endBlockUser(SwiftBlockUser b) { // //////////////////////////////////////////////////////////// public void tag(SwiftBlock b, Tag t) { - if (b == null) - return; + if (b == null) return; if (b instanceof SwiftBlock3) { tag((SwiftBlock3) b, t); } @@ -360,12 +349,12 @@ private void appendTag(Tag t) { // generate the xml tag write(EOL + "\t"); write(EOL + "\t\t"); - if (t.getName() != null) // otherwise, null name writes name "null" - write(t.getName()); + if (t.getName() != null) // otherwise, null name writes name "null" + write(t.getName()); write(""); write(EOL + "\t\t"); - if (t.getValue() != null) // otherwise, null value writes value "null" - write(t.getValue()); + if (t.getValue() != null) // otherwise, null value writes value "null" + write(t.getValue()); write(""); // if tag has unparsed texts, write them down @@ -373,16 +362,14 @@ private void appendTag(Tag t) { // IMPORTANT: do not just "write(m.getUnparsedTexts())" because this latest method actually // creates the object if not already there. Guard this with the size "if" that is // safe (returns 0 if there is no list or real size otherwise). - if (t.getUnparsedTextsSize() > 0) - write(t.getUnparsedTexts(), 2); + if (t.getUnparsedTextsSize() > 0) write(t.getUnparsedTexts(), 2); // write tag termination write(EOL + "\t"); } private void appendField(Tag tag) { - if (tag == null) - return; + if (tag == null) return; final Field f = tag.asField(); if (f == null) { // Something went wrong @@ -390,8 +377,8 @@ private void appendField(Tag tag) { // generate the xml tag write(EOL + "\t"); write(EOL + "\t\t"); - if (f.getName() != null) // otherwise, null name writes name "null" - write(f.getName()); + if (f.getName() != null) // otherwise, null name writes name "null" + write(f.getName()); write(""); final List components = f.getComponents(); for (int i = 0; i < components.size(); i++) { @@ -410,9 +397,14 @@ private void appendField(Tag tag) { } private void appendElement(StringBuilder sb, String element, String value) { - sb.append(EOL).append("\t<").append(element).append('>') + sb.append(EOL) + .append("\t<") + .append(element) + .append('>') .append(value) - .append("'); + .append("'); } private void write(UnparsedTextList texts, int level) { @@ -427,7 +419,7 @@ private void write(UnparsedTextList texts, int level) { break; default: prefix = "\t"; - break; //level 1 is catched here + break; // level 1 is catched here } // write the unparsed texts (if any) diff --git a/src/main/java/com/prowidesoftware/swift/io/writer/package-info.java b/src/main/java/com/prowidesoftware/swift/io/writer/package-info.java index c79f92a1c..a1f0cf35d 100644 --- a/src/main/java/com/prowidesoftware/swift/io/writer/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/io/writer/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Classes to serialize SwiftMessage object into a String with SWIFT FIN or XML formats */ -package com.prowidesoftware.swift.io.writer; \ No newline at end of file +package com.prowidesoftware.swift.io.writer; diff --git a/src/main/java/com/prowidesoftware/swift/model/AbstractMessage.java b/src/main/java/com/prowidesoftware/swift/model/AbstractMessage.java index 4a192c65f..78d35e60d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/AbstractMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/AbstractMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,7 @@ public abstract class AbstractMessage { /** * Protected constructor necessary for jaxb in MX. */ - protected AbstractMessage() { - } + protected AbstractMessage() {} /** * Constructor for an {@link MessageStandardType#MT} or {@link MessageStandardType#MX} message. diff --git a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java index a1d817cb9..cb89915c5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,6 @@ import com.prowidesoftware.swift.utils.Lib; import jakarta.persistence.*; import jakarta.xml.bind.annotation.XmlTransient; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -34,6 +30,8 @@ import java.math.BigDecimal; import java.text.NumberFormat; import java.util.*; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; /** * Base entity for MT and MX message persistence. @@ -59,14 +57,16 @@ public abstract class AbstractSwiftMessage implements Serializable, JsonSerializ * * @since 7.8.8 */ - protected final static String IDENTIFIER_ACK = "ACK"; + protected static final String IDENTIFIER_ACK = "ACK"; /** * Identifier constant for non-acknowledge service messages * * @since 7.8.8 */ - protected final static String IDENTIFIER_NAK = "NAK"; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(AbstractSwiftMessage.class.getName()); + protected static final String IDENTIFIER_NAK = "NAK"; + + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(AbstractSwiftMessage.class.getName()); private static final long serialVersionUID = 3769865560736793606L; /** @@ -121,7 +121,7 @@ public abstract class AbstractSwiftMessage implements Serializable, JsonSerializ @CollectionTable(name = "swift_msg_properties", joinColumns = @JoinColumn(name = "id")) @MapKeyColumn(name = "property_key", length = 200) @Column(name = "property_value") - @Lob //only applies to the value + @Lob // only applies to the value private Map properties = new HashMap<>(); @Column(length = 100) @@ -160,8 +160,7 @@ public abstract class AbstractSwiftMessage implements Serializable, JsonSerializ * * @since 7.7 */ - public AbstractSwiftMessage() { - } + public AbstractSwiftMessage() {} /** * @deprecated Use {@link #AbstractSwiftMessage(String, FileFormat, MessageMetadataStrategy)} instead @@ -195,7 +194,8 @@ protected AbstractSwiftMessage(final String content, final FileFormat fileFormat * @param metadataStrategy the specific metadata extraction to apply * @since 9.1.4 */ - protected AbstractSwiftMessage(final String content, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) { + protected AbstractSwiftMessage( + final String content, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) { Objects.requireNonNull(metadataStrategy, "the strategy for metadata extraction cannot be null"); this.message = content; this.fileFormat = fileFormat; @@ -236,7 +236,9 @@ protected AbstractSwiftMessage(final InputStream stream, final FileFormat fileFo * @param metadataStrategy the specific metadata extraction to apply * @since 9.1.4 */ - protected AbstractSwiftMessage(final InputStream stream, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) throws IOException { + protected AbstractSwiftMessage( + final InputStream stream, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) + throws IOException { Objects.requireNonNull(metadataStrategy, "the strategy for metadata extraction cannot be null"); this.message = Lib.readStream(stream); this.fileFormat = fileFormat; @@ -280,7 +282,9 @@ protected AbstractSwiftMessage(final File file, final FileFormat fileFormat) thr * @throws IOException on error during file reading * @since 9.1.4 */ - protected AbstractSwiftMessage(final File file, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) throws IOException { + protected AbstractSwiftMessage( + final File file, final FileFormat fileFormat, final MessageMetadataStrategy metadataStrategy) + throws IOException { Objects.requireNonNull(file, "the file parameter cannot be null"); Objects.requireNonNull(metadataStrategy, "the strategy for metadata extraction cannot be null"); this.message = Lib.readFile(file); @@ -387,7 +391,7 @@ public void setIdentifier(String identifier) { * * @see SwiftMessageUtils#calculateChecksum(SwiftMessage) */ - //TODO implement the same for MX, computing hash on XSLT normalized version of the XML + // TODO implement the same for MX, computing hash on XSLT normalized version of the XML public String getChecksum() { return checksum; } @@ -411,7 +415,7 @@ public void setChecksum(String checksum) { * @see SwiftMessageUtils#calculateChecksum(SwiftBlock4) * @since 7.9.5 */ - //TODO implement the same for MX, computing hash on XSLT normalized version of the XML + // TODO implement the same for MX, computing hash on XSLT normalized version of the XML public String getChecksumBody() { return checksumBody; } @@ -782,7 +786,9 @@ public String getLastData(String... statuses) { if (l != null) { for (int i = l.size() - 1; i >= 0; i--) { String d = l.get(i).getData(); - if (d != null && (statuses == null || ArrayUtils.contains(statuses, l.get(i).getName()))) { + if (d != null + && (statuses == null + || ArrayUtils.contains(statuses, l.get(i).getName()))) { return d; } } @@ -1019,7 +1025,12 @@ public void copyTo(AbstractSwiftMessage msg) { msg.setStatusTrail(null); for (SwiftMessageStatusInfo status : getStatusTrail()) { - msg.addStatus(new SwiftMessageStatusInfo(status.getComments(), status.getCreationDate(), status.getCreationUser(), status.getName(), status.getData())); + msg.addStatus(new SwiftMessageStatusInfo( + status.getComments(), + status.getCreationDate(), + status.getCreationUser(), + status.getName(), + status.getData())); } msg.setStatus(getStatus()); @@ -1304,32 +1315,53 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof AbstractSwiftMessage)) return false; AbstractSwiftMessage that = (AbstractSwiftMessage) o; - return Objects.equals(message, that.message) && - Objects.equals(identifier, that.identifier) && - Objects.equals(sender, that.sender) && - Objects.equals(receiver, that.receiver) && - direction == that.direction && - Objects.equals(checksum, that.checksum) && - Objects.equals(checksumBody, that.checksumBody) && - Objects.equals(lastModified, that.lastModified) && - Objects.equals(creationDate, that.creationDate) && - Objects.equals(statusTrail, that.statusTrail) && - Objects.equals(status, that.status) && - Objects.equals(notes, that.notes) && - Objects.equals(properties, that.properties) && - Objects.equals(filename, that.filename) && - fileFormat == that.fileFormat && - Objects.equals(reference, that.reference) && - Objects.equals(currency, that.currency) && - Objects.equals(amount, that.amount) && - Objects.equals(revisions, that.revisions) && - Objects.equals(valueDate, that.valueDate) && - Objects.equals(tradeDate, that.tradeDate); + return Objects.equals(message, that.message) + && Objects.equals(identifier, that.identifier) + && Objects.equals(sender, that.sender) + && Objects.equals(receiver, that.receiver) + && direction == that.direction + && Objects.equals(checksum, that.checksum) + && Objects.equals(checksumBody, that.checksumBody) + && Objects.equals(lastModified, that.lastModified) + && Objects.equals(creationDate, that.creationDate) + && Objects.equals(statusTrail, that.statusTrail) + && Objects.equals(status, that.status) + && Objects.equals(notes, that.notes) + && Objects.equals(properties, that.properties) + && Objects.equals(filename, that.filename) + && fileFormat == that.fileFormat + && Objects.equals(reference, that.reference) + && Objects.equals(currency, that.currency) + && Objects.equals(amount, that.amount) + && Objects.equals(revisions, that.revisions) + && Objects.equals(valueDate, that.valueDate) + && Objects.equals(tradeDate, that.tradeDate); } @Override public int hashCode() { - return Objects.hash(message, identifier, sender, receiver, direction, checksum, checksumBody, lastModified, creationDate, statusTrail, status, notes, properties, filename, fileFormat, reference, currency, amount, revisions, valueDate, tradeDate); + return Objects.hash( + message, + identifier, + sender, + receiver, + direction, + checksum, + checksumBody, + lastModified, + creationDate, + statusTrail, + status, + notes, + properties, + filename, + fileFormat, + reference, + currency, + amount, + revisions, + valueDate, + tradeDate); } /** @@ -1440,9 +1472,7 @@ public String toJson() { * @since 7.10.6 */ protected String toJsonImpl() { - final Gson gson = new GsonBuilder() - .setPrettyPrinting() - .create(); + final Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(this); } @@ -1467,5 +1497,4 @@ public String getMessageType() { return getIdentifier(); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/BIC.java b/src/main/java/com/prowidesoftware/swift/model/BIC.java index 7fe35730c..993765fda 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BIC.java +++ b/src/main/java/com/prowidesoftware/swift/model/BIC.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,8 @@ package com.prowidesoftware.swift.model; import com.prowidesoftware.swift.utils.IsoUtils; -import org.apache.commons.lang3.StringUtils; - import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Helper class to process BIC information. @@ -90,8 +89,7 @@ public BIC(final String bic) { /** * Default constructor */ - public BIC() { - } + public BIC() {} protected void parse(final String bic) { if (bic != null) { @@ -135,36 +133,28 @@ public BicValidationResult validate() { return BicValidationResult.INVALID_LENGTH; } if (this.institution.length() != 4) { - return BicValidationResult.INVALID_INSTITUTION_LENGTH - .setFound(this.institution); + return BicValidationResult.INVALID_INSTITUTION_LENGTH.setFound(this.institution); } if (this.country.length() != 2) { - return BicValidationResult.INVALID_COUNTRY_LENGTH - .setFound(this.country); + return BicValidationResult.INVALID_COUNTRY_LENGTH.setFound(this.country); } if (this.location.length() != 2) { - return BicValidationResult.INVALID_LOCATION_LENGTH - .setFound(this.location); + return BicValidationResult.INVALID_LOCATION_LENGTH.setFound(this.location); } if (this.branch != null && this.branch.length() != 3) { - return BicValidationResult.INVALID_BRANCH_LENGTH - .setFound(this.branch); + return BicValidationResult.INVALID_BRANCH_LENGTH.setFound(this.branch); } if (!isUpperCase(this.institution)) { - return BicValidationResult.INVALID_INSTITUTION_CHARSET - .setFound(this.institution); + return BicValidationResult.INVALID_INSTITUTION_CHARSET.setFound(this.institution); } if (!IsoUtils.getInstance().isValidISOCountry(this.country)) { - return BicValidationResult.INVALID_COUNTRY - .setFound(this.country); + return BicValidationResult.INVALID_COUNTRY.setFound(this.country); } if (!isUpperCaseOrDigit(this.location)) { - return BicValidationResult.INVALID_LOCATION_CHARSET - .setFound(this.location); + return BicValidationResult.INVALID_LOCATION_CHARSET.setFound(this.location); } if (this.branch != null && !isUpperCaseOrDigit(this.branch)) { - return BicValidationResult.INVALID_BRANCH_CHARSET - .setFound(this.branch); + return BicValidationResult.INVALID_BRANCH_CHARSET.setFound(this.branch); } return BicValidationResult.OK; } @@ -313,11 +303,11 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BIC bic = (BIC) o; - return Objects.equals(institution, bic.institution) && - Objects.equals(country, bic.country) && - Objects.equals(location, bic.location) && - Objects.equals(branch, bic.branch) && - Objects.equals(subtype, bic.subtype); + return Objects.equals(institution, bic.institution) + && Objects.equals(country, bic.country) + && Objects.equals(location, bic.location) + && Objects.equals(branch, bic.branch) + && Objects.equals(subtype, bic.subtype); } @Override @@ -368,7 +358,9 @@ public String distinguishedName() { public String distinguishedName(boolean includeDefaultBranch) { StringBuilder result = new StringBuilder(); if (includeDefaultBranch || !Objects.equals(getBranchOrDefault(), "XXX")) { - result.append("ou=").append(StringUtils.lowerCase(getBranchOrDefault())).append(","); + result.append("ou=") + .append(StringUtils.lowerCase(getBranchOrDefault())) + .append(","); } result.append("o=").append(StringUtils.lowerCase(getBic8())).append(",o=swift"); return result.toString(); @@ -443,5 +435,4 @@ public BIC asTestBic() { } return bic; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/BbanEntryType.java b/src/main/java/com/prowidesoftware/swift/model/BbanEntryType.java index 0dbe3f17e..a199039f0 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BbanEntryType.java +++ b/src/main/java/com/prowidesoftware/swift/model/BbanEntryType.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,8 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; - import java.lang.reflect.Type; - /** * Basic Bank Account Number Entry Types. * @@ -57,18 +55,16 @@ public static BbanEntryType fromString(String text) { public String getText() { return this.text; } - } class BbanEntryTypeDeserializer implements JsonDeserializer { @Override - public BbanEntryType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + public BbanEntryType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { BbanEntryType[] scopes = BbanEntryType.values(); for (BbanEntryType scope : scopes) { - if (scope.getText().equals(json.getAsString())) - return scope; + if (scope.getText().equals(json.getAsString())) return scope; } return null; } } - diff --git a/src/main/java/com/prowidesoftware/swift/model/BbanStructureDTO.java b/src/main/java/com/prowidesoftware/swift/model/BbanStructureDTO.java index 556c53f28..983b54b6e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BbanStructureDTO.java +++ b/src/main/java/com/prowidesoftware/swift/model/BbanStructureDTO.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ import java.util.List; - /** * Container for a specific country BBAN structure. * @@ -74,5 +73,4 @@ public String getCountry_coode() { public void setCountry_coode(String country_coode) { this.country_code = country_coode; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/BbanStructureEntryDTO.java b/src/main/java/com/prowidesoftware/swift/model/BbanStructureEntryDTO.java index 9838c69a6..d7b63a8eb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BbanStructureEntryDTO.java +++ b/src/main/java/com/prowidesoftware/swift/model/BbanStructureEntryDTO.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,6 @@ public class BbanStructureEntryDTO { @Expose private int length; - /** * Gets entry type. * @@ -101,5 +100,4 @@ public int getLength() { public void setLength(int length) { this.length = length; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/BbanStructureValidations.java b/src/main/java/com/prowidesoftware/swift/model/BbanStructureValidations.java index 086cc6d21..fb62ed89e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BbanStructureValidations.java +++ b/src/main/java/com/prowidesoftware/swift/model/BbanStructureValidations.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,13 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.prowidesoftware.swift.utils.Lib; -import org.apache.commons.lang3.StringUtils; - import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; - +import org.apache.commons.lang3.StringUtils; /** * This singleton handles all the available BBAN structure entries. @@ -40,7 +38,8 @@ * @since 7.9.7 */ public final class BbanStructureValidations { - private static transient final java.util.logging.Logger log = java.util.logging.Logger.getLogger(BbanStructureValidations.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(BbanStructureValidations.class.getName()); private static final Type REVIEW_TYPE = new TypeToken>() {}.getType(); private static final BbanStructureValidations INSTANCE = new BbanStructureValidations(); private static final String JSON_FILE = "BbanStructureValidations.json"; @@ -55,7 +54,11 @@ private BbanStructureValidations() { try { reader = Lib.readResource(JSON_FILE, null, BbanStructureValidations.class); } catch (IOException e) { - log.log(Level.SEVERE, "Cannot load " + JSON_FILE + " from classpath, the BBAN structure validations will be initialized empty", e); + log.log( + Level.SEVERE, + "Cannot load " + JSON_FILE + + " from classpath, the BBAN structure validations will be initialized empty", + e); } if (reader != null) { this.bbanStructures = gson.fromJson(reader, REVIEW_TYPE); @@ -143,5 +146,4 @@ public BbanStructureValidations add(final BbanStructureDTO bbanStructure) { this.bbanStructures.add(bbanStructure); return this; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/BicValidationResult.java b/src/main/java/com/prowidesoftware/swift/model/BicValidationResult.java index 275e6dc82..18c2f7cc4 100644 --- a/src/main/java/com/prowidesoftware/swift/model/BicValidationResult.java +++ b/src/main/java/com/prowidesoftware/swift/model/BicValidationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,8 @@ public enum BicValidationResult { OK("The BIC code is valid"), - INVALID_LENGTH("The BIC code must contain at least 8 characters with the institution (4), country (2) and location code (2)"), + INVALID_LENGTH( + "The BIC code must contain at least 8 characters with the institution (4), country (2) and location code (2)"), INVALID_INSTITUTION_LENGTH("The institution code must contain 4 characters and ${length} were found in ${found}"), INVALID_COUNTRY_LENGTH("The country code must contain 2 characters and ${length} were found in ${found}"), INVALID_LOCATION_LENGTH("The location code must contain 2 characters and ${length} were found in ${found}"), @@ -38,7 +39,7 @@ public enum BicValidationResult { INVALID_BRANCH_CHARSET("The branch code can only contain uppercase letters or digits and ${found} was found"); private final String message; - private String found; + private String found; BicValidationResult(final String message) { this.message = message; @@ -60,10 +61,9 @@ public String message() { * @param found content * @return this */ - //TODO: enums should be immutable + // TODO: enums should be immutable BicValidationResult setFound(final String found) { this.found = found; return this; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/FileFormat.java b/src/main/java/com/prowidesoftware/swift/model/FileFormat.java index d00a6a2e4..c5f3b3fa8 100644 --- a/src/main/java/com/prowidesoftware/swift/model/FileFormat.java +++ b/src/main/java/com/prowidesoftware/swift/model/FileFormat.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/IBAN.java b/src/main/java/com/prowidesoftware/swift/model/IBAN.java index bac5ebd7a..ea913b30f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/IBAN.java +++ b/src/main/java/com/prowidesoftware/swift/model/IBAN.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,8 @@ */ package com.prowidesoftware.swift.model; -import org.apache.commons.lang3.StringUtils; - import java.util.logging.Level; +import org.apache.commons.lang3.StringUtils; /** * Utility class to validate IBAN codes. @@ -40,7 +39,8 @@ public class IBAN { static final int COUNTRY_CODE_LENGTH = 2; static final int CHECK_DIGIT_LENGTH = 2; - private static transient final java.util.logging.Logger log = java.util.logging.Logger.getLogger(IBAN.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(IBAN.class.getName()); private static final int COUNTRY_CODE_INDEX = 0; private static final int CHECK_DIGIT_INDEX = COUNTRY_CODE_LENGTH; private static final int BBAN_INDEX = CHECK_DIGIT_INDEX + CHECK_DIGIT_LENGTH; @@ -170,7 +170,8 @@ public IbanValidationResult validate() { * load specific structure for country */ final String country = getCountryCode(code); - final BbanStructureDTO structure = BbanStructureValidations.getInstance().forCountry(country); + final BbanStructureDTO structure = + BbanStructureValidations.getInstance().forCountry(country); if (structure == null) { result = IbanValidationResult.MISSING_BBAN_CONFIGURATION; result.setFound(country); @@ -285,5 +286,4 @@ public String getCountryCode() { } return null; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/IbanValidationResult.java b/src/main/java/com/prowidesoftware/swift/model/IbanValidationResult.java index 120fde25c..19bfc0e09 100644 --- a/src/main/java/com/prowidesoftware/swift/model/IbanValidationResult.java +++ b/src/main/java/com/prowidesoftware/swift/model/IbanValidationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,8 @@ public enum IbanValidationResult { MISSING_COUNTRY_CODE("The IBAN must start with the two letters ISO country code"), INVALID_COUNTRY_CODE_CHARSET("The country code must contain upper case letters and ${found} was found"), - INVALID_COUNTRY_CODE("The country code ${found} is not a valid ISO country code or the country code is not configured for IBAN validations"), + INVALID_COUNTRY_CODE( + "The country code ${found} is not a valid ISO country code or the country code is not configured for IBAN validations"), INVALID_CHARACTERS("Invalid character '${found}' found"), MISSING_CHECK_DIGITS("Missing check digits"), @@ -42,17 +43,19 @@ public enum IbanValidationResult { IVALID_CHECK_DIGITS("The expected computed check digit is ${expectedCheckDigit} and ${found} was found"), MISSING_BBAN("Missing custom account number (BBAN)"), - BBAN_MAX_LENGTH("The max length for the custom account number (BBAN) is ${expectedLength} and found ${foundLength}"), + BBAN_MAX_LENGTH( + "The max length for the custom account number (BBAN) is ${expectedLength} and found ${foundLength}"), MISSING_BBAN_CONFIGURATION("Missing custom account number (BBAN) configuration for country ${found}"), - BBAN_INVALID_LENGTH("Expected a ${expectedLength} characters length for the custom account number (BBAN) and found ${foundLength} in ${found}"), + BBAN_INVALID_LENGTH( + "Expected a ${expectedLength} characters length for the custom account number (BBAN) and found ${foundLength} in ${found}"), BBAN_INVALID_UPPER_CASE_LETTERS("The ${bbanEntryType} ${found} must contain only upper case letters"), BBAN_INVALID_DIGITS_OR_LETTERS("The ${bbanEntryType} ${found} must contain only digits or upper case letters"), BBAN_INVALID_DIGITS("The ${bbanEntryType} ${found} must contain only digits"), UNKNOWN("Unknown exception validating IBAN"); - private final String message; + private final String message; private final Map vars = new HashMap<>(); IbanValidationResult(final String message) { @@ -73,7 +76,7 @@ public String message() { /** * Sets a "found" variable for messages text */ - //TODO enums should be immutable + // TODO enums should be immutable void setFound(final String found) { this.vars.put("found", found); } @@ -81,7 +84,7 @@ void setFound(final String found) { /** * Sets a "expectedLength" variable for messages text */ - //TODO enums should be immutable + // TODO enums should be immutable void setExpectedLength(final int expectedLength) { this.vars.put("expectedLength", String.valueOf(expectedLength)); } @@ -89,7 +92,7 @@ void setExpectedLength(final int expectedLength) { /** * Sets a "foundLength" variable for messages text */ - //TODO enums should be immutable + // TODO enums should be immutable void setFoundLength(final int foundLength) { this.vars.put("foundLength", String.valueOf(foundLength)); } @@ -97,7 +100,7 @@ void setFoundLength(final int foundLength) { /** * Sets a "bbanEntryType" variable for messages text */ - //TODO enums should be immutable + // TODO enums should be immutable void setBbanEntryType(final BbanEntryType type) { this.vars.put("bbanEntryType", type.name()); } @@ -105,7 +108,7 @@ void setBbanEntryType(final BbanEntryType type) { /** * Sets a "expectedCheckDigit" variable for messages text */ - //TODO enums should be immutable + // TODO enums should be immutable void setExpectedCheckDigit(final String expectedCheckDigit) { this.vars.put("expectedCheckDigit", expectedCheckDigit); } @@ -116,5 +119,4 @@ void setExpectedCheckDigit(final String expectedCheckDigit) { public Map vars() { return this.vars; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/IbanValidationUtils.java b/src/main/java/com/prowidesoftware/swift/model/IbanValidationUtils.java index 3f8b665ce..5d67ad431 100644 --- a/src/main/java/com/prowidesoftware/swift/model/IbanValidationUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/IbanValidationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,9 +50,9 @@ static IbanValidationResult validateCountryCode(final String iban) { final String countryCode = IBAN.getCountryCode(iban); // check case sensitivity - if (!countryCode.equals(countryCode.toUpperCase()) || - !Character.isLetter(countryCode.charAt(0)) || - !Character.isLetter(countryCode.charAt(1))) { + if (!countryCode.equals(countryCode.toUpperCase()) + || !Character.isLetter(countryCode.charAt(0)) + || !Character.isLetter(countryCode.charAt(1))) { IbanValidationResult result = IbanValidationResult.INVALID_COUNTRY_CODE_CHARSET; result.setFound(countryCode); return result; @@ -81,8 +81,7 @@ static IbanValidationResult validateCheckDigitPresence(final String iban) { final String checkDigit = IBAN.getCheckDigits(iban); // check digits - if (!Character.isDigit(checkDigit.charAt(0)) || - !Character.isDigit(checkDigit.charAt(1))) { + if (!Character.isDigit(checkDigit.charAt(0)) || !Character.isDigit(checkDigit.charAt(1))) { IbanValidationResult result = IbanValidationResult.INVALID_CHECK_DIGITS_FORMAT; result.setFound(checkDigit); return result; @@ -153,7 +152,6 @@ static IbanValidationResult validateBban(final String bban, final BbanStructureD if (result != null) { return result; } - } return null; } @@ -179,7 +177,8 @@ private static int getBbanLengh(BbanStructureDTO bbanStructure) { * @return problem found or null if OK * @since 7.9.7 */ - private static IbanValidationResult validateBbanEntryCharacterType(final BbanStructureEntryDTO entry, final String entryValue) { + private static IbanValidationResult validateBbanEntryCharacterType( + final BbanStructureEntryDTO entry, final String entryValue) { if (SwiftCharsetUtils.is(entryValue, entry.getCharacterType()) != SwiftCharsetUtils.OK) { IbanValidationResult result = null; switch (entry.getCharacterType()) { @@ -195,7 +194,6 @@ private static IbanValidationResult validateBbanEntryCharacterType(final BbanStr default: break; - } if (result != null) { result.setFound(entryValue); @@ -289,5 +287,4 @@ private static int calculateMod(final String iban) { } return (int) (total % MOD); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/model/LogicalTerminalAddress.java b/src/main/java/com/prowidesoftware/swift/model/LogicalTerminalAddress.java index 976d00051..7de289f49 100644 --- a/src/main/java/com/prowidesoftware/swift/model/LogicalTerminalAddress.java +++ b/src/main/java/com/prowidesoftware/swift/model/LogicalTerminalAddress.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,8 @@ */ package com.prowidesoftware.swift.model; -import org.apache.commons.lang3.StringUtils; - import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Identifies a logical channel connection to SWIFT, and the network uses it for addressing. diff --git a/src/main/java/com/prowidesoftware/swift/model/MIR.java b/src/main/java/com/prowidesoftware/swift/model/MIR.java index 1c2889d57..87e055c17 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MIR.java +++ b/src/main/java/com/prowidesoftware/swift/model/MIR.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.prowidesoftware.swift.model; import com.prowidesoftware.swift.utils.SwiftFormatUtils; - import java.util.Calendar; import java.util.Objects; @@ -52,7 +51,8 @@ * @since 6.0 */ public class MIR { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(MIR.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(MIR.class.getName()); /** * 6 characters string containing the date field of the MIR. */ @@ -119,8 +119,7 @@ public MIR(String value) { /** * Default constructor */ - public MIR() { - } + public MIR() {} /** * @return the date @@ -212,10 +211,10 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MIR mir = (MIR) o; - return Objects.equals(date, mir.date) && - Objects.equals(logicalTerminal, mir.logicalTerminal) && - Objects.equals(sessionNumber, mir.sessionNumber) && - Objects.equals(sequenceNumber, mir.sequenceNumber); + return Objects.equals(date, mir.date) + && Objects.equals(logicalTerminal, mir.logicalTerminal) + && Objects.equals(sessionNumber, mir.sessionNumber) + && Objects.equals(sequenceNumber, mir.sequenceNumber); } @Override @@ -233,4 +232,4 @@ public int hashCode() { public final Calendar getDateAsCalendar() { return SwiftFormatUtils.getDate2(this.date); } -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/model/MOR.java b/src/main/java/com/prowidesoftware/swift/model/MOR.java index e04af951f..27b51c7a2 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MOR.java +++ b/src/main/java/com/prowidesoftware/swift/model/MOR.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.model; - /** * This class models and parses the Message Output Reference (MOR). * @@ -25,7 +24,8 @@ */ public class MOR extends MIR { @SuppressWarnings("unused") - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(MOR.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(MOR.class.getName()); public MOR(String date, String logicalTerminal, String sessionNumber, String sequenceNumber) { super(date, logicalTerminal, sessionNumber, sequenceNumber); @@ -35,8 +35,7 @@ public MOR(String value) { super(value); } - public MOR() { - } + public MOR() {} /** * @see #getMIR() diff --git a/src/main/java/com/prowidesoftware/swift/model/MessageDirection.java b/src/main/java/com/prowidesoftware/swift/model/MessageDirection.java index 99cc5761f..0e41a14aa 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MessageDirection.java +++ b/src/main/java/com/prowidesoftware/swift/model/MessageDirection.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/MessageIOType.java b/src/main/java/com/prowidesoftware/swift/model/MessageIOType.java index e00d6d3b2..231af02e9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MessageIOType.java +++ b/src/main/java/com/prowidesoftware/swift/model/MessageIOType.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/MessageMetadataStrategy.java b/src/main/java/com/prowidesoftware/swift/model/MessageMetadataStrategy.java index 59d3566d2..fc33a357a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MessageMetadataStrategy.java +++ b/src/main/java/com/prowidesoftware/swift/model/MessageMetadataStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.model; - import java.util.Calendar; import java.util.Optional; @@ -49,5 +48,4 @@ public interface MessageMetadataStrategy { * Extracts the message trade date (only meaningful for some types of messages) */ Optional tradeDate(AbstractMessage message); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/MessageStandardType.java b/src/main/java/com/prowidesoftware/swift/model/MessageStandardType.java index 93dc658d4..769b70319 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MessageStandardType.java +++ b/src/main/java/com/prowidesoftware/swift/model/MessageStandardType.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/Money.java b/src/main/java/com/prowidesoftware/swift/model/Money.java index 666cbf234..f3ba1f334 100644 --- a/src/main/java/com/prowidesoftware/swift/model/Money.java +++ b/src/main/java/com/prowidesoftware/swift/model/Money.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,12 @@ import com.prowidesoftware.swift.model.field.AmountContainer; import com.prowidesoftware.swift.model.field.CurrencyContainer; import com.prowidesoftware.swift.model.field.Field; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.math.BigDecimal; import java.util.Currency; import java.util.Objects; import java.util.logging.Logger; +import org.apache.commons.lang3.StringUtils; /** * A simple POJO to represent money, an amount associated with a currency. @@ -197,7 +195,8 @@ static Money ofSum(Field... fields) { } else if (StringUtils.equals(currency, money.getCurrency())) { total = total.add(money.getAmount()); } else { - log.warning("cannot sum amounts with different currencies, expected " + currency + " and found " + money.getCurrency() + " in field " + field.getName() + ":" + field.getValue()); + log.warning("cannot sum amounts with different currencies, expected " + currency + " and found " + + money.getCurrency() + " in field " + field.getName() + ":" + field.getValue()); return null; } } @@ -215,5 +214,4 @@ public String getCurrency() { public BigDecimal getAmount() { return amount; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/MtId.java b/src/main/java/com/prowidesoftware/swift/model/MtId.java index 31bd76563..7a0b9ccbc 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MtId.java +++ b/src/main/java/com/prowidesoftware/swift/model/MtId.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,10 @@ import com.prowidesoftware.swift.model.field.Field32A; import com.prowidesoftware.swift.model.mt.MTVariant; -import org.apache.commons.lang3.StringUtils; - import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; /** * Structured identification of MT message types, composed by the business process, actual type and variant. @@ -41,8 +40,7 @@ public class MtId { /** * @since @since 8.0.3 */ - public MtId() { - } + public MtId() {} /** * Parses a string identifier into a structured MT identifier @@ -176,9 +174,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MtId mtId = (MtId) o; - return Objects.equals(businessProcess, mtId.businessProcess) && - Objects.equals(messageType, mtId.messageType) && - Objects.equals(variant, mtId.variant); + return Objects.equals(businessProcess, mtId.businessProcess) + && Objects.equals(messageType, mtId.messageType) + && Objects.equals(variant, mtId.variant); } @Override @@ -210,7 +208,10 @@ public String category() { * @since 9.2.14 */ public String namespaceURI() { - return new StringBuilder("urn:swift:xsd:").append(id()).append(".").append(Field32A.SRU).toString(); + return new StringBuilder("urn:swift:xsd:") + .append(id()) + .append(".") + .append(Field32A.SRU) + .toString(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java index 6bfb332dd..4c1b7fd2b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,6 @@ import jakarta.persistence.Column; import jakarta.persistence.DiscriminatorValue; import jakarta.persistence.Entity; -import org.apache.commons.lang3.EnumUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -38,7 +34,8 @@ import java.util.Objects; import java.util.Optional; import java.util.logging.Level; - +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; /** * MT messages entity for JPA persistence. @@ -50,7 +47,8 @@ @Entity(name = "mt") @DiscriminatorValue("mt") public class MtSwiftMessage extends AbstractSwiftMessage { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(MtSwiftMessage.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(MtSwiftMessage.class.getName()); private static final long serialVersionUID = -5972656648349958815L; @Column(length = 35) @@ -68,8 +66,7 @@ public class MtSwiftMessage extends AbstractSwiftMessage { @Column(length = 31, name = "uuid") private String uuid; - public MtSwiftMessage() { - } + public MtSwiftMessage() {} /** * Calls {@link #MtSwiftMessage(String, MessageMetadataStrategy)} with the {@link DefaultMtMetadataStrategy} @@ -250,7 +247,8 @@ protected void updateFromMessage(MessageMetadataStrategy metadataStrategy) throw Objects.requireNonNull(metadataStrategy, "the strategy for metadata extraction cannot be null"); Objects.requireNonNull(getMessage(), "the raw message attribute cannot be null"); if (getFileFormat() != FileFormat.FIN) { - throw new IllegalArgumentException("expected source format " + FileFormat.FIN + " and found " + getFileFormat()); + throw new IllegalArgumentException( + "expected source format " + FileFormat.FIN + " and found " + getFileFormat()); } SwiftMessage model = null; try { @@ -622,11 +620,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; MtSwiftMessage that = (MtSwiftMessage) o; - return Objects.equals(pde, that.pde) && - Objects.equals(pdm, that.pdm) && - Objects.equals(mir, that.mir) && - Objects.equals(mur, that.mur) && - Objects.equals(uuid, that.uuid); + return Objects.equals(pde, that.pde) + && Objects.equals(pdm, that.pdm) + && Objects.equals(mir, that.mir) + && Objects.equals(mur, that.mur) + && Objects.equals(uuid, that.uuid); } @Override @@ -700,5 +698,4 @@ public void updateMetadata(MessageMetadataStrategy strategy) { Objects.requireNonNull(strategy, "the strategy for metadata extraction cannot be null"); applyStrategy(modelMessage(), strategy); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock.java index 0bdbbc659..c92d19b4b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ */ package com.prowidesoftware.swift.model; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ToStringBuilder; - import java.io.Serializable; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Base class for a generic SWIFT block.
    @@ -34,7 +33,7 @@ * * @author sebastian */ -//TODO: add parameter checks (Validate.*) and complete javadocs +// TODO: add parameter checks (Validate.*) and complete javadocs public abstract class SwiftBlock implements Serializable { private static final long serialVersionUID = -6993261477630953757L; @@ -60,8 +59,7 @@ public abstract class SwiftBlock implements Serializable { * Default constructor, shouldn't be used normally. * DO NOT USE: present only for subclasses */ - protected SwiftBlock() { - } + protected SwiftBlock() {} /** * Constructor for an unparsed text list diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1.java index 4b32a0c8a..9a6529b7c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,11 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.prowidesoftware.swift.model.mt.ServiceIdType; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.Arrays; import java.util.Objects; import java.util.logging.Level; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT Basic Header Block (block 1). @@ -38,7 +37,7 @@ * @author sebastian * @since 4.0 */ -//TODO: add parameter checks (Validate.*) and complete javadocs +// TODO: add parameter checks (Validate.*) and complete javadocs public class SwiftBlock1 extends SwiftValueBlock implements Serializable { /** * Constant for FIN messages in application id @@ -58,7 +57,9 @@ public class SwiftBlock1 extends SwiftValueBlock implements Serializable { * @since 4.1 */ public static final transient String APPLICATION_ID_LOGINS = "L"; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock1.class.getName()); + + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock1.class.getName()); private static final long serialVersionUID = 4229511645041690763L; /** * String of 1 character containing the Application ID as follows:
    @@ -136,7 +137,12 @@ public class SwiftBlock1 extends SwiftValueBlock implements Serializable { * @param sessionNumber the session number * @param sequenceNumber the message sequence number */ - public SwiftBlock1(final String applicationId, final String serviceId, final String logicalTerminal, final String sessionNumber, final String sequenceNumber) { + public SwiftBlock1( + final String applicationId, + final String serviceId, + final String logicalTerminal, + final String sessionNumber, + final String sequenceNumber) { this.applicationId = applicationId; this.serviceId = serviceId; this.logicalTerminal = logicalTerminal; @@ -147,8 +153,7 @@ public SwiftBlock1(final String applicationId, final String serviceId, final Str /** * Default constructor */ - public SwiftBlock1() { - } + public SwiftBlock1() {} /** * Creates the block with lenient false, meaning it expects a fixed length value. @@ -182,7 +187,12 @@ public SwiftBlock1(final String value, boolean lenient) { * @since 7.10.4 */ public SwiftBlock1(SwiftBlock1 block) { - this(block.getApplicationId(), block.getServiceId(), block.getLogicalTerminal(), block.getSessionNumber(), block.getSequenceNumber()); + this( + block.getApplicationId(), + block.getServiceId(), + block.getLogicalTerminal(), + block.getSessionNumber(), + block.getSequenceNumber()); } /** @@ -406,7 +416,11 @@ public void setSequenceNumber(final String sequenceNumber) { */ @Override public boolean isEmpty() { - return applicationId == null && serviceId == null && logicalTerminal == null && sessionNumber == null && sequenceNumber == null; + return applicationId == null + && serviceId == null + && logicalTerminal == null + && sessionNumber == null + && sequenceNumber == null; } /** @@ -480,7 +494,7 @@ public void setBlockValue(final String value) { */ public void setValue(final String value, boolean lenient) { if (lenient) { - //leave all attributes as null (cleaning defaults) + // leave all attributes as null (cleaning defaults) clean(); } else { // check parameters @@ -494,13 +508,23 @@ public void setValue(final String value, boolean lenient) { // figure out the starting point if (value.startsWith("1")) { if (!lenient) { - Validate.isTrue(value.startsWith("1:"), "expected '1:' at the beginning of value and found '" + value.charAt(0) + "'"); - Validate.isTrue(slen == 26 || slen == 27, "block value " + value + " cannot be parsed because it has an invalid size, expected 26 or 27 and found " + value.length()); + Validate.isTrue( + value.startsWith("1:"), + "expected '1:' at the beginning of value and found '" + value.charAt(0) + "'"); + Validate.isTrue( + slen == 26 || slen == 27, + "block value " + value + + " cannot be parsed because it has an invalid size, expected 26 or 27 and found " + + value.length()); } offset = 2; } else { if (!lenient) { - Validate.isTrue(slen == 24 || slen == 25, "block value " + value + " cannot be parsed because it has an invalid size, expected 24 or 25 and found " + value.length()); + Validate.isTrue( + slen == 24 || slen == 25, + "block value " + value + + " cannot be parsed because it has an invalid size, expected 24 or 25 and found " + + value.length()); } } @@ -513,7 +537,7 @@ public void setValue(final String value, boolean lenient) { this.setServiceId(this.getValuePart(value, offset, len)); offset += len; - //LT address must be fixed to 12 characters padding both the LT id and the branch with X if necessary + // LT address must be fixed to 12 characters padding both the LT id and the branch with X if necessary len = 12; this.setLogicalTerminal(this.getValuePart(value, offset, len)); offset += len; @@ -523,10 +547,10 @@ public void setValue(final String value, boolean lenient) { offset += len; if (lenient) { - //get all remaining text + // get all remaining text this.setSequenceNumber(this.getValuePart(value, offset)); } else { - //get text between size boundaries + // get text between size boundaries len = 6; this.setSequenceNumber(this.getValuePart(value, offset, len)); } @@ -552,11 +576,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; SwiftBlock1 that = (SwiftBlock1) o; - return Objects.equals(applicationId, that.applicationId) && - Objects.equals(serviceId, that.serviceId) && - Objects.equals(logicalTerminal, that.logicalTerminal) && - Objects.equals(sessionNumber, that.sessionNumber) && - Objects.equals(sequenceNumber, that.sequenceNumber); + return Objects.equals(applicationId, that.applicationId) + && Objects.equals(serviceId, that.serviceId) + && Objects.equals(logicalTerminal, that.logicalTerminal) + && Objects.equals(sessionNumber, that.sessionNumber) + && Objects.equals(sequenceNumber, that.sequenceNumber); } @Override @@ -650,7 +674,8 @@ public ServiceIdType getServiceIdType() { try { return ServiceIdType.valueOf("_" + this.serviceId); } catch (Exception e) { - final String text = "Block1 serviceId contains an invalid value [" + this.serviceId + "]. The expected values are " + Arrays.toString(ServiceIdType.values()); + final String text = "Block1 serviceId contains an invalid value [" + this.serviceId + + "]. The expected values are " + Arrays.toString(ServiceIdType.values()); log.warning(text); log.log(Level.FINEST, text, e); return null; diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1Field.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1Field.java index c379e5243..10e87f4b1 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1Field.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock1Field.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2.java index 3ef56dcf5..186fb2349 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,12 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.builder.ToStringBuilder; - import java.io.Serializable; import java.util.Arrays; import java.util.Objects; import java.util.logging.Level; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Base class for SWIFT Application Header Block (block 2) @@ -41,7 +40,8 @@ * @since 4.0 */ public abstract class SwiftBlock2 extends SwiftValueBlock implements Serializable { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock2.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock2.class.getName()); private static final long serialVersionUID = 7994472954593732477L; /** @@ -61,8 +61,7 @@ public abstract class SwiftBlock2 extends SwiftValueBlock implements Serializabl /** * Default Constructor */ - public SwiftBlock2() { - } + public SwiftBlock2() {} /** * Sets the block number. Will cause an exception unless setting block number to 2. @@ -169,7 +168,8 @@ public MessagePriority getMessagePriorityType() { try { return MessagePriority.valueOf(this.messagePriority); } catch (Exception e) { - final String text = "Block2 messagePriority contains an invalid value [" + this.messagePriority + "]. The expected values are " + Arrays.toString(MessagePriority.values()); + final String text = "Block2 messagePriority contains an invalid value [" + this.messagePriority + + "]. The expected values are " + Arrays.toString(MessagePriority.values()); log.warning(text); log.log(Level.FINEST, text, e); } @@ -211,8 +211,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; SwiftBlock2 that = (SwiftBlock2) o; - return Objects.equals(messagePriority, that.messagePriority) && - Objects.equals(messageType, that.messageType); + return Objects.equals(messagePriority, that.messagePriority) && Objects.equals(messageType, that.messageType); } @Override diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Adapter.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Adapter.java index 454edf544..d52b011e6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Adapter.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Adapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,8 @@ package com.prowidesoftware.swift.model; import com.google.gson.*; - import java.lang.reflect.Type; - public class SwiftBlock2Adapter implements JsonSerializer, JsonDeserializer { private static final String DIRECTION = "direction"; @@ -36,7 +34,8 @@ private static void setSwiftBlock2Properties(SwiftBlock2 sb, JsonObject jsonObje } @Override - public JsonElement serialize(final SwiftBlock2 swiftBlock2, Type type, final JsonSerializationContext jsonSerializationContext) { + public JsonElement serialize( + final SwiftBlock2 swiftBlock2, Type type, final JsonSerializationContext jsonSerializationContext) { JsonElement object = jsonSerializationContext.serialize(swiftBlock2); @@ -54,10 +53,13 @@ public JsonElement serialize(final SwiftBlock2 swiftBlock2, Type type, final Jso } @Override - public SwiftBlock2 deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + public SwiftBlock2 deserialize( + JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException { JsonObject jsonObject = jsonElement.getAsJsonObject(); - if (jsonObject.get(DIRECTION) != null && jsonObject.get(DIRECTION).getAsString().equals("O")) { + if (jsonObject.get(DIRECTION) != null + && jsonObject.get(DIRECTION).getAsString().equals("O")) { return getSwiftBlock2OutputObject(jsonObject); } else { // defult to INPUT @@ -73,7 +75,8 @@ private SwiftBlock2Output getSwiftBlock2OutputObject(JsonObject jsonObject) { // specific data for OUTPUT if (jsonObject.get("senderInputTime") != null) { - swiftBlock2Output.setSenderInputTime(jsonObject.get("senderInputTime").getAsString()); + swiftBlock2Output.setSenderInputTime( + jsonObject.get("senderInputTime").getAsString()); } if (jsonObject.get("MIRDate") != null) { @@ -81,23 +84,28 @@ private SwiftBlock2Output getSwiftBlock2OutputObject(JsonObject jsonObject) { } if (jsonObject.get("MIRLogicalTerminal") != null) { - swiftBlock2Output.setMIRLogicalTerminal(jsonObject.get("MIRLogicalTerminal").getAsString()); + swiftBlock2Output.setMIRLogicalTerminal( + jsonObject.get("MIRLogicalTerminal").getAsString()); } if (jsonObject.get("MIRSessionNumber") != null) { - swiftBlock2Output.setMIRSessionNumber(jsonObject.get("MIRSessionNumber").getAsString()); + swiftBlock2Output.setMIRSessionNumber( + jsonObject.get("MIRSessionNumber").getAsString()); } if (jsonObject.get("MIRSequenceNumber") != null) { - swiftBlock2Output.setMIRSequenceNumber(jsonObject.get("MIRSequenceNumber").getAsString()); + swiftBlock2Output.setMIRSequenceNumber( + jsonObject.get("MIRSequenceNumber").getAsString()); } if (jsonObject.get("receiverOutputDate") != null) { - swiftBlock2Output.setReceiverOutputDate(jsonObject.get("receiverOutputDate").getAsString()); + swiftBlock2Output.setReceiverOutputDate( + jsonObject.get("receiverOutputDate").getAsString()); } if (jsonObject.get("receiverOutputTime") != null) { - swiftBlock2Output.setReceiverOutputTime(jsonObject.get("receiverOutputTime").getAsString()); + swiftBlock2Output.setReceiverOutputTime( + jsonObject.get("receiverOutputTime").getAsString()); } return swiftBlock2Output; @@ -111,18 +119,20 @@ private SwiftBlock2Input getSwiftBlock2InputObject(JsonObject jsonObject) { // specific data for INPUT if (jsonObject.get("receiverAddress") != null) { - swiftBlock2Input.setReceiverAddress(jsonObject.get("receiverAddress").getAsString()); + swiftBlock2Input.setReceiverAddress( + jsonObject.get("receiverAddress").getAsString()); } if (jsonObject.get("deliveryMonitoring") != null) { - swiftBlock2Input.setDeliveryMonitoring(jsonObject.get("deliveryMonitoring").getAsString()); + swiftBlock2Input.setDeliveryMonitoring( + jsonObject.get("deliveryMonitoring").getAsString()); } if (jsonObject.get("obsolescencePeriod") != null) { - swiftBlock2Input.setObsolescencePeriod(jsonObject.get("obsolescencePeriod").getAsString()); + swiftBlock2Input.setObsolescencePeriod( + jsonObject.get("obsolescencePeriod").getAsString()); } return swiftBlock2Input; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Field.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Field.java index a3d892762..4f5142cec 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Field.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Field.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Input.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Input.java index 592ffdda1..d77f5a38a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Input.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Input.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,10 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.Objects; import java.util.logging.Level; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT Application Header Block (block 2) @@ -49,10 +48,10 @@ */ // TODO: add parameter checks (Validate.*) and complete javadocs public class SwiftBlock2Input extends SwiftBlock2 implements Serializable { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock2.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock2.class.getName()); private static final long serialVersionUID = 6094810199379196198L; - /** * Receiver's address with X in position 9.
    * It is fixed at 12 characters; it must have X in position 9 @@ -90,7 +89,12 @@ public class SwiftBlock2Input extends SwiftBlock2 implements Serializable { * @param obsolescencePeriod the obsolescence period, measured in 5 minutes units (3 for priority U, 20 for priority N).
    * According to SWIFT documentation, this value is ignored by the system */ - public SwiftBlock2Input(final String messageType, final String receiverAddress, final String messagePriority, final String deliveryMonitoring, final String obsolescencePeriod) { + public SwiftBlock2Input( + final String messageType, + final String receiverAddress, + final String messagePriority, + final String deliveryMonitoring, + final String obsolescencePeriod) { this.input = true; this.messageType = messageType; this.receiverAddress = receiverAddress; @@ -130,8 +134,7 @@ public SwiftBlock2Input(final String value, boolean lenient) { /** * Default constructor */ - public SwiftBlock2Input() { - } + public SwiftBlock2Input() {} /** * Copy constructor @@ -140,7 +143,12 @@ public SwiftBlock2Input() { * @since 7.10.4 */ public SwiftBlock2Input(SwiftBlock2Input block) { - this(block.getMessageType(), block.getReceiverAddress(), block.getMessagePriority(), block.getDeliveryMonitoring(), block.getObsolescencePeriod()); + this( + block.getMessageType(), + block.getReceiverAddress(), + block.getMessagePriority(), + block.getDeliveryMonitoring(), + block.getObsolescencePeriod()); } /** @@ -295,7 +303,8 @@ public DeliveryMonitoring getDeliveryMonitoringType() { try { return DeliveryMonitoring.valueOf("_" + this.deliveryMonitoring); } catch (Exception e) { - final String text = "Block2 deliveryMonitoring contains an invalid value [" + this.deliveryMonitoring + "]"; + final String text = + "Block2 deliveryMonitoring contains an invalid value [" + this.deliveryMonitoring + "]"; log.warning(text); log.log(Level.FINEST, text, e); } @@ -333,7 +342,11 @@ public void setObsolescencePeriod(final String obsolescencePeriod) { */ @Override public boolean isEmpty() { - return messageType == null && receiverAddress == null && messagePriority == null && deliveryMonitoring == null && obsolescencePeriod == null; + return messageType == null + && receiverAddress == null + && messagePriority == null + && deliveryMonitoring == null + && obsolescencePeriod == null; } /** @@ -415,7 +428,7 @@ public void setBlockValue(final String value) { */ public void setValue(final String value, boolean lenient) { if (lenient) { - //leave all attributes as null (cleaning defaults) + // leave all attributes as null (cleaning defaults) clean(); } else { // check parameters @@ -428,7 +441,10 @@ public void setValue(final String value, boolean lenient) { if (!lenient) { // check parameters Objects.requireNonNull(value, "value must not be null"); - Validate.isTrue(slen >= 16 && slen <= 23, "expected a string value of 17 up to 23 chars and obtained a " + slen + " chars string: '" + value + "'"); + Validate.isTrue( + slen >= 16 && slen <= 23, + "expected a string value of 17 up to 23 chars and obtained a " + slen + " chars string: '" + + value + "'"); } // figure out the starting point and check the input value has proper optional @@ -440,7 +456,8 @@ public void setValue(final String value, boolean lenient) { slen -= offset; if (!lenient) { if (slen != 16 && slen != 17 && slen != 18 && slen != 21) { - throw new IllegalArgumentException("Value must match: I
    [[[]]]"); + throw new IllegalArgumentException( + "Value must match: I
    [[[]]]"); } } offset++; // skip the input mark @@ -463,13 +480,12 @@ public void setValue(final String value, boolean lenient) { offset += len; // optional if (lenient) { - //get all remaining text + // get all remaining text this.setObsolescencePeriod(this.getValuePart(value, offset)); } else { len = 3; this.setObsolescencePeriod(this.getValuePart(value, offset, len)); } - } } @@ -493,9 +509,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; SwiftBlock2Input that = (SwiftBlock2Input) o; - return Objects.equals(receiverAddress, that.receiverAddress) && - Objects.equals(deliveryMonitoring, that.deliveryMonitoring) && - Objects.equals(obsolescencePeriod, that.obsolescencePeriod); + return Objects.equals(receiverAddress, that.receiverAddress) + && Objects.equals(deliveryMonitoring, that.deliveryMonitoring) + && Objects.equals(obsolescencePeriod, that.obsolescencePeriod); } @Override diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2InputField.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2InputField.java index 2b6c22023..c2abd3063 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2InputField.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2InputField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Output.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Output.java index b9c36dea9..371dda1fa 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Output.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2Output.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,11 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.time.DateFormatUtils; - import java.io.Serializable; import java.util.Calendar; import java.util.Objects; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.time.DateFormatUtils; /** * Base class for SWIFT Application Header Block (block 2) @@ -104,7 +103,16 @@ public class SwiftBlock2Output extends SwiftBlock2 implements Serializable { * @param receiverOutputTime receiver time * @param messagePriority the message priority (S=system, U=urgent, N=normal) */ - public SwiftBlock2Output(final String messageType, final String senderInputTime, final String MIRDate, final String MIRLogicalTerminal, final String MIRSessionNumber, final String MIRSequenceNumber, final String receiverOutputDate, final String receiverOutputTime, final String messagePriority) { + public SwiftBlock2Output( + final String messageType, + final String senderInputTime, + final String MIRDate, + final String MIRLogicalTerminal, + final String MIRSessionNumber, + final String MIRSequenceNumber, + final String receiverOutputDate, + final String receiverOutputTime, + final String messagePriority) { this.output = true; this.messageType = messageType; this.senderInputTime = senderInputTime; @@ -146,8 +154,7 @@ public SwiftBlock2Output(final String value, boolean lenient) { /** * Default Constructor */ - public SwiftBlock2Output() { - } + public SwiftBlock2Output() {} /** * Copy constructor @@ -156,7 +163,16 @@ public SwiftBlock2Output() { * @since 7.10.4 */ public SwiftBlock2Output(SwiftBlock2Output block) { - this(block.getMessageType(), block.getSenderInputTime(), block.getMIRDate(), block.getMIRLogicalTerminal(), block.getMIRSessionNumber(), block.getMIRSequenceNumber(), block.getReceiverOutputDate(), block.getReceiverOutputTime(), block.getMessagePriority()); + this( + block.getMessageType(), + block.getSenderInputTime(), + block.getMIRDate(), + block.getMIRLogicalTerminal(), + block.getMIRSessionNumber(), + block.getMIRSequenceNumber(), + block.getReceiverOutputDate(), + block.getReceiverOutputTime(), + block.getMessagePriority()); } /** @@ -371,7 +387,9 @@ public void setMIR(final String mir) { public void setMIR(final String mir, boolean lenient) { if (!lenient) { Objects.requireNonNull(mir); - Validate.isTrue(mir.length() == 28, "expected a 28 characters string for MIR value and found a " + mir.length() + " string:" + mir); + Validate.isTrue( + mir.length() == 28, + "expected a 28 characters string for MIR value and found a " + mir.length() + " string:" + mir); } if (mir != null) { int offset = 0; @@ -390,7 +408,7 @@ public void setMIR(final String mir, boolean lenient) { offset += len; if (lenient) { - //get all remaining text + // get all remaining text this.setMIRSequenceNumber(getValuePart(mir, offset, mir.length())); } else { len = 6; @@ -456,7 +474,12 @@ public void setReceiverOutputDateTime(Calendar cal) { */ @Override public boolean isEmpty() { - return messageType == null && senderInputTime == null && getMIR() == null && receiverOutputDate == null && receiverOutputTime == null && messagePriority == null; + return messageType == null + && senderInputTime == null + && getMIR() == null + && receiverOutputDate == null + && receiverOutputTime == null + && messagePriority == null; } /** @@ -540,7 +563,7 @@ public void setBlockValue(final String value) { */ public void setValue(final String value, boolean lenient) { if (lenient) { - //leave all attributes as null (cleaning defaults) + // leave all attributes as null (cleaning defaults) clean(); } else { // check parameters @@ -554,7 +577,10 @@ public void setValue(final String value, boolean lenient) { if (!lenient) { // check parameters Objects.requireNonNull(value, "value must not be null"); - Validate.isTrue(slen == 46 || slen == 48 || slen == 47 || slen == 49, "expected a string value of 46 and up to 49 chars and obtained a " + slen + " chars string: '" + value + "'"); + Validate.isTrue( + slen == 46 || slen == 48 || slen == 47 || slen == 49, + "expected a string value of 46 and up to 49 chars and obtained a " + slen + " chars string: '" + + value + "'"); } // figure out the starting point and check the input value has proper optional @@ -591,13 +617,12 @@ public void setValue(final String value, boolean lenient) { offset += len; if (lenient) { - //get all remaining text + // get all remaining text this.setMessagePriority(this.getValuePart(value, offset)); } else { len = 1; this.setMessagePriority(this.getValuePart(value, offset, len)); } - } } @@ -607,18 +632,26 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; SwiftBlock2Output that = (SwiftBlock2Output) o; - return Objects.equals(senderInputTime, that.senderInputTime) && - Objects.equals(MIRDate, that.MIRDate) && - Objects.equals(MIRLogicalTerminal, that.MIRLogicalTerminal) && - Objects.equals(MIRSessionNumber, that.MIRSessionNumber) && - Objects.equals(MIRSequenceNumber, that.MIRSequenceNumber) && - Objects.equals(receiverOutputDate, that.receiverOutputDate) && - Objects.equals(receiverOutputTime, that.receiverOutputTime); + return Objects.equals(senderInputTime, that.senderInputTime) + && Objects.equals(MIRDate, that.MIRDate) + && Objects.equals(MIRLogicalTerminal, that.MIRLogicalTerminal) + && Objects.equals(MIRSessionNumber, that.MIRSessionNumber) + && Objects.equals(MIRSequenceNumber, that.MIRSequenceNumber) + && Objects.equals(receiverOutputDate, that.receiverOutputDate) + && Objects.equals(receiverOutputTime, that.receiverOutputTime); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), senderInputTime, MIRDate, MIRLogicalTerminal, MIRSessionNumber, MIRSequenceNumber, receiverOutputDate, receiverOutputTime); + return Objects.hash( + super.hashCode(), + senderInputTime, + MIRDate, + MIRLogicalTerminal, + MIRSessionNumber, + MIRSequenceNumber, + receiverOutputDate, + receiverOutputTime); } /** @@ -652,7 +685,6 @@ public String field(SwiftBlock2OutputField field) { return getReceiverOutputTime(); default: return null; - } } @@ -696,5 +728,4 @@ public void setField(SwiftBlock2OutputField field, final String value) { break; } } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2OutputField.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2OutputField.java index ded22550f..dc20d86c6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2OutputField.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock2OutputField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3.java index f6b3baa28..576e61ab4 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.prowidesoftware.swift.model.field.Field108; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; import java.util.Objects; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT User Header Block (block 3). @@ -34,13 +33,13 @@ */ public class SwiftBlock3 extends SwiftTagListBlock implements Serializable { private static final long serialVersionUID = 4377884587811023149L; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock3.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock3.class.getName()); /** * Default constructor */ - public SwiftBlock3() { - } + public SwiftBlock3() {} /** * Constructor with tag initialization @@ -134,7 +133,8 @@ public Boolean isSTP() { * @since 7.8.8 */ public void generateMUR(boolean overwriteIfExist) { - final String MUR = new SimpleDateFormat("yyMMddHHmmssSSSS").format(Calendar.getInstance().getTime()); + final String MUR = new SimpleDateFormat("yyMMddHHmmssSSSS") + .format(Calendar.getInstance().getTime()); Tag t = getTagByName("108"); if (t == null) { builder().setField108(new Field108(MUR)); @@ -151,5 +151,4 @@ public void generateMUR(boolean overwriteIfExist) { public SwiftBlock3Builder builder() { return new SwiftBlock3Builder(this); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3Builder.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3Builder.java index 85f76631a..278101119 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3Builder.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock3Builder.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.prowidesoftware.swift.model; import com.prowidesoftware.swift.model.field.*; - import java.util.List; import java.util.Objects; @@ -31,7 +30,8 @@ * @since 7.10.0 */ public class SwiftBlock3Builder { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock3Builder.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock3Builder.class.getName()); private Tag field103 = null; private Tag field113 = null; @@ -273,5 +273,4 @@ public SwiftBlock3Builder setField(Field field) { } return this; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock4.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock4.java index adc4ef59c..6ffde869e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock4.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock4.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Stack; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT Body Block (block 4).
    @@ -43,8 +42,7 @@ public class SwiftBlock4 extends SwiftTagListBlock implements Serializable { /** * Default constructor */ - public SwiftBlock4() { - } + public SwiftBlock4() {} /** * Constructor with tag initialization @@ -112,10 +110,10 @@ public static SwiftBlock4 removeEmptySequences(final SwiftBlock4 b4) { // TODO find replacement for Stack final Stack stack = new Stack<>(); for (Tag t : b4.getTags()) { - if (!stack.isEmpty() && - StringUtils.equals(t.getName(), "16S") && - StringUtils.equals(stack.peek().getName(), "16R") && - StringUtils.equals(stack.peek().getValue(), t.getValue())) { + if (!stack.isEmpty() + && StringUtils.equals(t.getName(), "16S") + && StringUtils.equals(stack.peek().getName(), "16R") + && StringUtils.equals(stack.peek().getValue(), t.getValue())) { /* * found an empty 16R 16S pair */ @@ -124,8 +122,8 @@ public static SwiftBlock4 removeEmptySequences(final SwiftBlock4 b4) { /* * found two consecutive 15a */ - stack.pop(); //remove the previous seq start - stack.push(t); //keep this new sequence for the moment + stack.pop(); // remove the previous seq start + stack.push(t); // keep this new sequence for the moment } else { stack.push(t); } @@ -199,5 +197,4 @@ public Integer getNumber() { public String getName() { return "4"; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5.java index 444de3aeb..e496b19a2 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,12 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.List; import java.util.Objects; import java.util.Optional; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT Trailer Block (block 5). @@ -36,14 +35,15 @@ */ public class SwiftBlock5 extends SwiftTagListBlock implements Serializable { @SuppressWarnings("unused") - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftBlock5.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftBlock5.class.getName()); + private static final long serialVersionUID = 3114133378482486859L; /** * Default constructor */ - public SwiftBlock5() { - } + public SwiftBlock5() {} /** * Constructor with tag initialization @@ -161,5 +161,4 @@ public Optional getTag(SwiftBlock5Field field) { public SwiftBlock5 setPDE() { return setTag(SwiftBlock5Field.PDE, null); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5Field.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5Field.java index f6b0ec332..8777faeb5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5Field.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlock5Field.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,14 @@ * @since 8.0.2 */ public enum SwiftBlock5Field { - MAC("Message Authentication Code calculated based on the entire contents of the message using a pre-exchanged key and a secret algorithm."), + MAC( + "Message Authentication Code calculated based on the entire contents of the message using a pre-exchanged key and a secret algorithm."), CHK("Checksum calculated for all message types."), PDE("Possible Duplicate Emission added if user thinks the same message was sent previously."), - PDM("Possible Duplicate Message added to any output message being resent because a prior delivery may not be valid."), - DLM("Delayed Message added if the message has not been delivered within the expected minutes according to the message priority."), + PDM( + "Possible Duplicate Message added to any output message being resent because a prior delivery may not be valid."), + DLM( + "Delayed Message added if the message has not been delivered within the expected minutes according to the message priority."), MRF("The Message Reference specifies the reference of the original user message."), TNG("Test & Training Message, only in test and training mode"), SYS("System Originated Message added for system message or service message, cotaining the MIR of the request."); @@ -40,5 +43,4 @@ public enum SwiftBlock5Field { public String description() { return this.description; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftBlockUser.java b/src/main/java/com/prowidesoftware/swift/model/SwiftBlockUser.java index cae8e947a..09f0523d2 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftBlockUser.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftBlockUser.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,11 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.prowidesoftware.deprecation.DeprecationUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.List; import java.util.Objects; import java.util.logging.Level; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT User "ad-hoc" Blocks (blocks with number other than 1-5 or names).
    @@ -42,7 +41,8 @@ public class SwiftBlockUser extends SwiftTagListBlock implements Serializable { private static final long serialVersionUID = -6506492203870561424L; private static final String MESSAGE_VALIDATOR = "parameter 'blockNumber' cannot be null"; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(DeprecationUtils.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(DeprecationUtils.class.getName()); /** * Indicates the position of this user block in a message when persisted. @@ -81,7 +81,8 @@ public SwiftBlockUser() { public SwiftBlockUser(Integer blockNumber) { // sanity check Objects.requireNonNull(blockNumber, MESSAGE_VALIDATOR); - Validate.isTrue(SwiftBlockUser.isValidName(blockNumber), "'blockNumber' is not a valid User Defined Block number"); + Validate.isTrue( + SwiftBlockUser.isValidName(blockNumber), "'blockNumber' is not a valid User Defined Block number"); this.setBlockNumber(blockNumber); } @@ -99,7 +100,8 @@ public SwiftBlockUser(Integer blockNumber) { public SwiftBlockUser(Integer blockNumber, List tags) { // sanity check Objects.requireNonNull(blockNumber, MESSAGE_VALIDATOR); - Validate.isTrue(SwiftBlockUser.isValidName(blockNumber), "'blockNumber' is not a valid User Defined Block number"); + Validate.isTrue( + SwiftBlockUser.isValidName(blockNumber), "'blockNumber' is not a valid User Defined Block number"); this.setBlockNumber(blockNumber); this.addTags(tags); @@ -148,7 +150,7 @@ public SwiftBlockUser(String blockName, List tags) { * @return true if the block name and number are valid * @since 5.0 */ - static public Boolean isValidName(String blockName, Integer blockNumber) { + public static Boolean isValidName(String blockName, Integer blockNumber) { return SwiftBlockUser.isValidName(blockName) && SwiftBlockUser.isValidName(blockNumber); } @@ -159,28 +161,24 @@ static public Boolean isValidName(String blockName, Integer blockNumber) { * @return true if the block name and number are valid * @since 5.0 */ - static public Boolean isValidName(String blockName) { + public static Boolean isValidName(String blockName) { // name and number must be defined - if (blockName == null) - return Boolean.FALSE; + if (blockName == null) return Boolean.FALSE; // try as a number try { Integer num = Integer.decode(blockName); - if (!SwiftBlockUser.isValidName(num)) - return Boolean.FALSE; + if (!SwiftBlockUser.isValidName(num)) return Boolean.FALSE; } catch (NumberFormatException nfe) { // do nothing (it was not a number) } // for named blocks, the name must be only one letter - if (blockName.length() != 1) - return Boolean.FALSE; + if (blockName.length() != 1) return Boolean.FALSE; // only upper or lower case letters char c = Character.toLowerCase(blockName.charAt(0)); - if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z'))) - return Boolean.FALSE; + if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z'))) return Boolean.FALSE; return Boolean.TRUE; } @@ -193,14 +191,12 @@ static public Boolean isValidName(String blockName) { * @return true if the block name and number are valid * @since 5.0 */ - static public Boolean isValidName(Integer blockNumber) { + public static Boolean isValidName(Integer blockNumber) { // name and number must be defined - if (blockNumber == null) - return Boolean.FALSE; + if (blockNumber == null) return Boolean.FALSE; // block number must not be 1-5 - if ((blockNumber != -1) && (1 <= blockNumber && blockNumber <= 5)) - return Boolean.FALSE; + if ((blockNumber != -1) && (1 <= blockNumber && blockNumber <= 5)) return Boolean.FALSE; return Boolean.TRUE; } @@ -263,7 +259,8 @@ public String getBlockName() { protected void setBlockName(String blockName) { // sanity check Objects.requireNonNull(blockName, "parameter 'blockName' cannot be null"); - Validate.isTrue(SwiftBlockUser.isValidName(blockName), "'" + blockName + "' is not a valid User Defined Block name"); + Validate.isTrue( + SwiftBlockUser.isValidName(blockName), "'" + blockName + "' is not a valid User Defined Block name"); // store the new name this.blockName = blockName; @@ -281,7 +278,9 @@ protected void setBlockName(String blockName) { protected void setBlockNumber(Integer blockNumber) { // sanity check Objects.requireNonNull(blockNumber, MESSAGE_VALIDATOR); - Validate.isTrue(SwiftBlockUser.isValidName(blockNumber).booleanValue(), "'" + blockNumber + "' is not a valid User Defined Block number"); + Validate.isTrue( + SwiftBlockUser.isValidName(blockNumber).booleanValue(), + "'" + blockNumber + "' is not a valid User Defined Block number"); this.blockName = blockNumber != null ? blockNumber.toString() : null; } @@ -324,8 +323,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; SwiftBlockUser tags = (SwiftBlockUser) o; - return Objects.equals(sortKey, tags.sortKey) && - Objects.equals(blockName, tags.blockName); + return Objects.equals(sortKey, tags.sortKey) && Objects.equals(blockName, tags.blockName); } @Override diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftCharset.java b/src/main/java/com/prowidesoftware/swift/model/SwiftCharset.java index 4f80bbaea..d820c31c8 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftCharset.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftCharset.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftCharsetUtils.java b/src/main/java/com/prowidesoftware/swift/model/SwiftCharsetUtils.java index 41b30ce8c..f07bdb44c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftCharsetUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftCharsetUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,11 +30,24 @@ public class SwiftCharsetUtils { public static final int OK = -1; private static final char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; - private static final char[] AZ = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; - private static final char[] azLowerCase = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; - private static final char[] specialCharacters_x = {'/', '-', '?', ':', '(', ')', '.', ',', '\'', '+', ' ', '\n', '\r'}; - private static final char[] specialCharacters_y = {' ', '.', ',', '-', '(', ')', '/', '=', '\'', '+', ':', '?', '!', '"', '%', '&', '*', ';', '<', '>'}; - private static final char[] specialCharacters_z = {'.', ',', '-', '(', ')', '/', '=', '\'', '+', ':', '?', '@', '#', ' ', '{', '!', '"', '%', '&', '*', ';', '<', '>', '_', '\n', '\r'}; + private static final char[] AZ = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z' + }; + private static final char[] azLowerCase = { + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z' + }; + private static final char[] specialCharacters_x = { + '/', '-', '?', ':', '(', ')', '.', ',', '\'', '+', ' ', '\n', '\r' + }; + private static final char[] specialCharacters_y = { + ' ', '.', ',', '-', '(', ')', '/', '=', '\'', '+', ':', '?', '!', '"', '%', '&', '*', ';', '<', '>' + }; + private static final char[] specialCharacters_z = { + '.', ',', '-', '(', ')', '/', '=', '\'', '+', ':', '?', '@', '#', ' ', '{', '!', '"', '%', '&', '*', ';', '<', + '>', '_', '\n', '\r' + }; // Suppress default constructor for noninstantiability private SwiftCharsetUtils() { @@ -94,7 +107,10 @@ public static int is_a(final String s) { * any character of the X permitted set (General FIN application set) upper case and lower case allowed */ public static boolean is_x(final char character) { - return isLowercaseLetter(character) || isUppercaseLetter(character) || isNumber(character) || is(character, specialCharacters_x); + return isLowercaseLetter(character) + || isUppercaseLetter(character) + || isNumber(character) + || is(character, specialCharacters_x); } /** @@ -130,7 +146,10 @@ public static int is_y(final String s) { * all characters included in the X and Y sets, plus a couple of special characters */ public static boolean is_z(final char character) { - return isLowercaseLetter(character) || isUppercaseLetter(character) || isNumber(character) || is(character, specialCharacters_z); + return isLowercaseLetter(character) + || isUppercaseLetter(character) + || isNumber(character) + || is(character, specialCharacters_z); } /** @@ -312,21 +331,27 @@ private static boolean is(final char c, final char[] charset) { * Gets SWIFT n charset; numeric digits (0 through 9) only. */ public static char[] get_n() { - return new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + return new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; } /** * Gets SWIFT a charset; alphabetic capital letters (A through Z), upper case only. */ public static char[] get_a() { - return new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; + return new char[] { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z' + }; } /** * Lower case a to z. */ private static char[] _get_az() { - return new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; + return new char[] { + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z' + }; } /** @@ -420,5 +445,4 @@ public static String filter(String s, SwiftCharset charset) { } return result.toString(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessage.java index b08d18fe6..e7eb1f821 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessage.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ import com.prowidesoftware.swift.model.field.*; import com.prowidesoftware.swift.model.mt.*; import com.prowidesoftware.swift.utils.IMessageVisitor; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.builder.ToStringBuilder; - import java.io.IOException; import java.io.Serializable; import java.io.StringWriter; import java.text.SimpleDateFormat; import java.util.*; import java.util.logging.Level; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Base class for swift messages. @@ -56,7 +55,8 @@ public class SwiftMessage implements Serializable, JsonSerializable { static final int JSON_VERSION = 2; private static final long serialVersionUID = 8094995269559985432L; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftMessage.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftMessage.class.getName()); private static final String INVALID_NAME_BLOCK = "Invalid name for User Defined Blocks ("; private static final String MESSAGE_IS_NOT_A_FRAGMENT = "message is not a fragment"; @@ -85,8 +85,7 @@ public class SwiftMessage implements Serializable, JsonSerializable { * * @see #SwiftMessage(boolean) */ - public SwiftMessage() { - } + public SwiftMessage() {} /** * Constructor that initializes blocks @@ -269,13 +268,13 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SwiftMessage that = (SwiftMessage) o; - return Objects.equals(block1, that.block1) && - Objects.equals(block2, that.block2) && - Objects.equals(block3, that.block3) && - Objects.equals(block4, that.block4) && - Objects.equals(block5, that.block5) && - Objects.equals(userBlocks, that.userBlocks) && - Objects.equals(unparsedTexts, that.unparsedTexts); + return Objects.equals(block1, that.block1) + && Objects.equals(block2, that.block2) + && Objects.equals(block3, that.block3) + && Objects.equals(block4, that.block4) + && Objects.equals(block5, that.block5) + && Objects.equals(userBlocks, that.userBlocks) + && Objects.equals(unparsedTexts, that.unparsedTexts); } @Override @@ -595,7 +594,8 @@ public void setBlock5(final SwiftBlock5 block5) { */ public int getUserBlockPosition(final String blockName) { // check parameters - if (StringUtils.isBlank(blockName) || //check user blocks array + if (StringUtils.isBlank(blockName) + || // check user blocks array this.userBlocks == null) { return -1; } @@ -1178,7 +1178,8 @@ public int getTypeInt() { public MessageIOType getDirection() { try { if (this.block2 == null) { - log.fine("Requesting direction on a message without block2, can't determine direction. set log level to finer to view more details"); + log.fine( + "Requesting direction on a message without block2, can't determine direction. set log level to finer to view more details"); log.finest("Message: " + this); } else { if (this.block2.isOutput()) { @@ -1423,7 +1424,8 @@ public String getUID(final Calendar created, final Long id) { suffix.append(StringUtils.leftPad(String.valueOf(id), 10, "0")); } if (suffix.length() == 0) { - log.warning("The computed suffix for message UID is blank, provide either the creation date or the numeric identifier as parameters for getUID"); + log.warning( + "The computed suffix for message UID is blank, provide either the creation date or the numeric identifier as parameters for getUID"); } return getUUID() + suffix; } @@ -1755,7 +1757,8 @@ public MTVariant getVariant() { */ public void setVariant(final MTVariant variant) { if (!variant.isValidationFlag()) { - log.warning("Field " + Field199.NAME + " should be used only for validation flags and not for " + variant.name()); + log.warning("Field " + Field199.NAME + " should be used only for validation flags and not for " + + variant.name()); } if (this.block3 == null) { this.block3 = new SwiftBlock3(); @@ -1913,5 +1916,4 @@ public String message() { IConversionService srv = new ConversionService(); return srv.getFIN(this); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageAdapter.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageAdapter.java index fa8ecd09f..44a6a3244 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageAdapter.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package com.prowidesoftware.swift.model; import com.google.gson.*; - import java.lang.reflect.Type; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -40,7 +39,7 @@ public JsonElement serialize(SwiftMessage src, Type typeOfSrc, JsonSerialization objectBlocks.add("block3", context.serialize(src.getBlock3())); objectBlocks.add("block4", context.serialize(src.getBlock4())); objectBlocks.add("block5", context.serialize(src.getBlock5())); - //TODO agregar user blocks + // TODO agregar user blocks object.add("data", objectBlocks); @@ -48,7 +47,9 @@ public JsonElement serialize(SwiftMessage src, Type typeOfSrc, JsonSerialization } @Override - public SwiftMessage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + public SwiftMessage deserialize( + JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException { JsonObject jsonArray = jsonElement.getAsJsonObject().get("data").getAsJsonObject(); diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java index becb700ae..c092a0a5f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.prowidesoftware.swift.model; import jakarta.persistence.*; - import java.util.Calendar; /** @@ -44,8 +43,7 @@ public class SwiftMessageNote { @Lob private String text; - public SwiftMessageNote() { - } + public SwiftMessageNote() {} public SwiftMessageNote(String creationUser, String text) { this.creationDate = Calendar.getInstance(); @@ -102,5 +100,4 @@ public String getText() { public void setText(String text) { this.text = text; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java index e34214528..855a6f90d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static jakarta.persistence.FetchType.LAZY; import jakarta.persistence.*; - import java.util.Calendar; import java.util.Objects; @@ -52,8 +51,7 @@ public class SwiftMessageRevision { @Basic(fetch = LAZY) private String json; - public SwiftMessageRevision() { - } + public SwiftMessageRevision() {} /** * Creates a message revision from a messages.
    @@ -78,9 +76,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SwiftMessageRevision that = (SwiftMessageRevision) o; - return Objects.equals(creationDate, that.creationDate) && - Objects.equals(creationUser, that.creationUser) && - Objects.equals(message, that.message); + return Objects.equals(creationDate, that.creationDate) + && Objects.equals(creationUser, that.creationUser) + && Objects.equals(message, that.message); } @Override @@ -127,5 +125,4 @@ public String getJson() { public void setJson(String json) { this.json = json; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java index c9b2bd2c0..c6dd7ee7b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static jakarta.persistence.FetchType.LAZY; import jakarta.persistence.*; - import java.util.Calendar; import java.util.Objects; @@ -37,7 +36,8 @@ @Table(name = "swift_msg_status") public class SwiftMessageStatusInfo implements Cloneable { @SuppressWarnings("unused") - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftMessageStatusInfo.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftMessageStatusInfo.class.getName()); @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -67,7 +67,7 @@ public class SwiftMessageStatusInfo implements Cloneable { * No arguments constructor */ public SwiftMessageStatusInfo() { - this.creationDate = Calendar.getInstance(); //this cannot be null, default to now + this.creationDate = Calendar.getInstance(); // this cannot be null, default to now } /** @@ -79,7 +79,8 @@ public SwiftMessageStatusInfo() { * @param name status name * @param data optional additional text data associated to the status processing */ - public SwiftMessageStatusInfo(String comments, Calendar creationDate, String creationUser, String name, String data) { + public SwiftMessageStatusInfo( + String comments, Calendar creationDate, String creationUser, String name, String data) { this(); this.comments = comments; this.creationDate = creationDate; @@ -150,10 +151,10 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SwiftMessageStatusInfo that = (SwiftMessageStatusInfo) o; - return Objects.equals(name, that.name) && - Objects.equals(comments, that.comments) && - Objects.equals(creationDate, that.creationDate) && - Objects.equals(creationUser, that.creationUser); + return Objects.equals(name, that.name) + && Objects.equals(comments, that.comments) + && Objects.equals(creationDate, that.creationDate) + && Objects.equals(creationUser, that.creationUser); } @Override @@ -230,5 +231,4 @@ public Object clone() { result.setName(getName()); return result; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageUtils.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageUtils.java index 77b56e2ee..86db3cfc9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,6 @@ import com.prowidesoftware.swift.io.writer.SwiftWriter; import com.prowidesoftware.swift.model.field.*; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.StringWriter; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; @@ -32,6 +29,8 @@ import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Utility methods that provide higher level access to {@link SwiftMessage} @@ -97,20 +96,23 @@ public static List currencyStrings(final SwiftMessage m) { * @throws IllegalArgumentException if the starting tag is not 16R or the ending tag is not the matching 16S * @since 7.8.1 */ - public static SwiftTagListBlock removeInnerSequences(final SwiftTagListBlock sequence) throws IllegalArgumentException { + public static SwiftTagListBlock removeInnerSequences(final SwiftTagListBlock sequence) + throws IllegalArgumentException { if (sequence == null || sequence.size() < 3) { return sequence; } final Tag start = sequence.getTag(0); final Tag end = sequence.getTag(sequence.size() - 1); if (!StringUtils.equals("16R", start.getName())) { - throw new IllegalArgumentException("Starting tag of sequence must be 16R (and was " + start.getName() + ")"); + throw new IllegalArgumentException( + "Starting tag of sequence must be 16R (and was " + start.getName() + ")"); } if (!StringUtils.equals("16S", end.getName())) { throw new IllegalArgumentException("Ending tag of sequence must be 16S (and was " + end.getName() + ")"); } if (!StringUtils.equals(start.getValue(), end.getValue())) { - throw new IllegalArgumentException("The qualifier of the starting block " + start + " must match the qualifier of the ending block " + end); + throw new IllegalArgumentException("The qualifier of the starting block " + start + + " must match the qualifier of the ending block " + end); } final SwiftTagListBlock result = new SwiftTagListBlock(); String qualifier = null; @@ -121,7 +123,9 @@ public static SwiftTagListBlock removeInnerSequences(final SwiftTagListBlock seq * found sequence start */ qualifier = t.getValue(); - } else if (qualifier != null && StringUtils.equals(t.getName(), "16S") && StringUtils.equals(t.getValue(), qualifier)) { + } else if (qualifier != null + && StringUtils.equals(t.getName(), "16S") + && StringUtils.equals(t.getValue(), qualifier)) { /* * found sequence end */ @@ -333,14 +337,14 @@ public static String calculateChecksum(final SwiftBlock4 b4) { * @return computed hash or null if exceptions are thrown reading bytes or processing the digest * @since 7.9.5 */ - //TODO add base 64 encoding on top when upgraded to Java 8 + // TODO add base 64 encoding on top when upgraded to Java 8 private static String md5(final String text) { try { byte[] bytesOfMessage = text.getBytes(StandardCharsets.UTF_8); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] thedigest = md.digest(bytesOfMessage); - //Converting the bytes to a Hex string + // Converting the bytes to a Hex string StringBuilder buff = new StringBuilder(); for (byte b : thedigest) { String conversion = Integer.toString(b & 0xFF, 16); @@ -549,7 +553,8 @@ public static SwiftTagListBlock join(final SwiftTagListBlock... sequences) { * @return the SwiftTagListBlock containing all parent sequences, the sequence requested and the contents * @since 7.8 */ - public static SwiftTagListBlock createSubsequenceWithParents(final Class mt, final String sequenceName, final Tag... tags) { + public static SwiftTagListBlock createSubsequenceWithParents( + final Class mt, final String sequenceName, final Tag... tags) { log.finer("Create sequence " + sequenceName); final SwiftTagListBlock result = new SwiftTagListBlock(); result.append(tags); @@ -561,17 +566,18 @@ public static SwiftTagListBlock createSubsequenceWithParents(final Class mt, final String sequenceName, final Tag... tags) { + public static SwiftTagListBlock createSequenceSingle( + final Class mt, final String sequenceName, final Tag... tags) { final String cn = mt.getName() + "$Sequence" + sequenceName; try { final Class subSequenceClass = Class.forName(cn); final Method method = subSequenceClass.getMethod("newInstance", Tag[].class); - return (SwiftTagListBlock) method.invoke(null, new Object[]{tags}); + return (SwiftTagListBlock) method.invoke(null, new Object[] {tags}); } catch (Exception e) { - String message = "Reflection error: mt=" + mt.getName() + ", sequenceName=" + sequenceName + ", tags=" + Arrays.toString(tags) + " - " + e.getMessage(); + String message = "Reflection error: mt=" + mt.getName() + ", sequenceName=" + sequenceName + ", tags=" + + Arrays.toString(tags) + " - " + e.getMessage(); log.log(Level.WARNING, message, e); throw new ProwideException(message); } @@ -606,9 +612,13 @@ public static Money money(final SwiftMessage m) { } if (m.isType(102, 103, 200, 202, 205, 256, 450, 455, 643, 644, 646, 734, 802, 900, 910)) { return Money.of(b4.getFieldByName("32A")); - } else if (m.isType(191, 291, 300, 304, 305, 320, 391, 491, 591, 691, 791, 891, 991, 340, 341, 350, 360, 361, 364, 365, 620, 700, 705, 710, 720, 732, 740, 742, 756)) { + } else if (m.isType( + 191, 291, 300, 304, 305, 320, 391, 491, 591, 691, 791, 891, 991, 340, 341, 350, 360, 361, 364, 365, 620, + 700, 705, 710, 720, 732, 740, 742, 756)) { return Money.of(b4.getFieldByName("32B")); - } else if (m.isType(321, 370, 508, 509, 535, 536, 537, 540, 541, 542, 543, 544, 545, 546, 547, 548, 558, 559, 569, 574, 575, 576, 578, 586)) { + } else if (m.isType( + 321, 370, 508, 509, 535, 536, 537, 540, 541, 542, 543, 544, 545, 546, 547, 548, 558, 559, 569, 574, 575, + 576, 578, 586)) { return Money.of(b4.getFieldByName("19A")); } else if (m.isType(330, 362)) { return Money.of(b4.getFieldByName("32H")); @@ -747,5 +757,4 @@ public final String reference() { protected Money money() { return money(msg); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftTagListBlock.java b/src/main/java/com/prowidesoftware/swift/model/SwiftTagListBlock.java index 3fbc7737e..a5e739c5c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftTagListBlock.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftTagListBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,13 @@ import com.prowidesoftware.swift.model.field.Field16R; import com.prowidesoftware.swift.model.field.Field16S; import com.prowidesoftware.swift.model.field.GenericField; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.*; import java.util.logging.Level; import java.util.stream.Collectors; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Base class for SWIFT blocks that contain and arbitrary set of fields (3, 4, 5 and user blocks).
    @@ -41,8 +40,10 @@ public class SwiftTagListBlock extends SwiftBlock implements Serializable, Itera * Immutableempty instance of this class. */ public static final SwiftTagListBlock EMPTY_LIST = emptyList(); + private static final long serialVersionUID = -3753513588165638610L; - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftTagListBlock.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftTagListBlock.class.getName()); private static final String TAG_VALIDATION_MESSAGE = "parameter 'tag' cannot not be null"; private static final String NAME_VALIDATION_MESSAGE = "parameter 'name' cannot not be null"; /** @@ -56,8 +57,7 @@ public class SwiftTagListBlock extends SwiftBlock implements Serializable, Itera * Default constructor, shouldn't be used normally. * present only for subclasses */ - public SwiftTagListBlock() { - } + public SwiftTagListBlock() {} /** * Intended to be used by search results in this class @@ -233,9 +233,7 @@ public Tag getTagByNumber(final int tagNumber) { * @return the tags matching the given number or an empty list if none is found. */ public List getTagsByNumber(final int tagNumber) { - return tags.stream() - .filter(tag -> tag.isNumber(tagNumber)) - .collect(Collectors.toList()); + return tags.stream().filter(tag -> tag.isNumber(tagNumber)).collect(Collectors.toList()); } /** @@ -279,9 +277,7 @@ public List getTagsByContent(final String content) { */ public String[] getTagValues(final String name) { Objects.requireNonNull(name, NAME_VALIDATION_MESSAGE); - return Arrays.stream(getTagsByName(name)) - .map(Tag::getValue) - .toArray(String[]::new); + return Arrays.stream(getTagsByName(name)).map(Tag::getValue).toArray(String[]::new); } /** @@ -291,8 +287,7 @@ public String[] getTagValues(final String name) { * @return a Map for the tags name and values */ public Map getTagMap() { - return tags.stream() - .collect(Collectors.toMap(Tag::getName, Tag::getValue, (k1, k2) -> k1, HashMap::new)); + return tags.stream().collect(Collectors.toMap(Tag::getName, Tag::getValue, (k1, k2) -> k1, HashMap::new)); } /** @@ -443,7 +438,8 @@ public Field getField(final int index) { public Field getFieldByName(final String name, final String component1, final String component2) { return getFieldsByName(name, component1).stream() .filter(field -> StringUtils.equals(field.getComponent(2), component2)) - .findFirst().orElse(null); + .findFirst() + .orElse(null); } /** @@ -461,7 +457,8 @@ public Field getFieldByQualifiers(final String name, final String qualifier, fin return getFieldsByName(name, qualifier).stream() .filter(GenericField.class::isInstance) .filter(f -> StringUtils.equals(((GenericField) f).getConditionalQualifier(), conditionalQualifier)) - .findFirst().orElse(null); + .findFirst() + .orElse(null); } /** @@ -473,7 +470,9 @@ public Field getFieldByQualifiers(final String name, final String qualifier, fin * @see #getTagByNumber(int) */ public Field getFieldByNumber(final int fieldNumber) { - return Optional.ofNullable(getTagByNumber(fieldNumber)).map(Tag::asField).orElse(null); + return Optional.ofNullable(getTagByNumber(fieldNumber)) + .map(Tag::asField) + .orElse(null); } /** @@ -508,7 +507,8 @@ public List getFieldsByNumber(final int fieldNumber) { public Field getFieldByNumber(final int fieldNumber, final String componentValue) { return getFieldsByNumber(fieldNumber).stream() .filter(field -> field.is(componentValue)) - .findFirst().orElse(null); + .findFirst() + .orElse(null); } /** @@ -542,9 +542,7 @@ public int countByName(final String name) { */ @Override public String toString() { - return getClass().getName() + "[" + - (tags == null ? "tags=null" : tags.toString()) + - "]"; + return getClass().getName() + "[" + (tags == null ? "tags=null" : tags.toString()) + "]"; } /** @@ -734,7 +732,7 @@ public List getSubBlocks(final Tag start, final Tag end) { } } } - //if necessary, we add the last found sub block + // if necessary, we add the last found sub block if (toAdd != null) { result.add(toAdd); } @@ -823,7 +821,8 @@ public List getSubBlocks(final int startTagNumber, final Stri * @param endTagLetter optional ending tag letter option * @return the found subblocks */ - private List _getSubBlocks(final int startTagNumber, final String startTagLetter, final int endTagNumber, final String endTagLetter) { + private List _getSubBlocks( + final int startTagNumber, final String startTagLetter, final int endTagNumber, final String endTagLetter) { final List result = new ArrayList<>(); SwiftTagListBlock toAdd = null; @@ -831,22 +830,22 @@ private List _getSubBlocks(final int startTagNumber, final St for (Tag t : this.tags) { if (blockFound) { toAdd.append(t); - if ((endTagLetter != null && StringUtils.equals(t.getName(), endTagNumber + endTagLetter)) || - (endTagLetter == null && t.isNumber(endTagNumber))) { + if ((endTagLetter != null && StringUtils.equals(t.getName(), endTagNumber + endTagLetter)) + || (endTagLetter == null && t.isNumber(endTagNumber))) { result.add(toAdd); blockFound = false; toAdd = null; } } else { - if ((startTagLetter != null && StringUtils.equals(t.getName(), startTagNumber + startTagLetter)) || - (startTagLetter == null && t.isNumber(startTagNumber))) { + if ((startTagLetter != null && StringUtils.equals(t.getName(), startTagNumber + startTagLetter)) + || (startTagLetter == null && t.isNumber(startTagNumber))) { toAdd = new SwiftTagListBlock(); toAdd.append(t); blockFound = true; } } } - //if necessary, we add the last found sub block + // if necessary, we add the last found sub block if (toAdd != null) { result.add(toAdd); } @@ -940,7 +939,9 @@ public SwiftTagListBlock sublist(final Integer start, final Integer end) { if (tags == null || tags.isEmpty()) { throw new IllegalStateException("No tags in this list"); } - if ((start != null && start < 0) || (end != null && (end + 1) > this.tags.size()) || (start != null && end != null && start > end)) { + if ((start != null && start < 0) + || (end != null && (end + 1) > this.tags.size()) + || (start != null && end != null && start > end)) { throw new IllegalArgumentException("start: " + start + ", end: " + end + ", size=" + this.tags.size()); } final SwiftTagListBlock result = new SwiftTagListBlock(); @@ -961,14 +962,18 @@ public SwiftTagListBlock sublist(final Integer start, final Integer end) { * @param searchBoundary mandatory limit search criteria. * @return the found subblocks */ - private SwiftTagListBlock _searchSubBlockByCriteria(final Tag tag, final boolean includeDelimiterInResult, SearchSelection searchSelection, SearchBoundary searchBoundary) { + private SwiftTagListBlock _searchSubBlockByCriteria( + final Tag tag, + final boolean includeDelimiterInResult, + SearchSelection searchSelection, + SearchBoundary searchBoundary) { SwiftTagListBlock result = new SwiftTagListBlock(); int index = getIndexByCriteria(searchBoundary, tag); if (index >= 0) { - //boundary tag found + // boundary tag found if (includeDelimiterInResult) { if (searchSelection == SearchSelection.AFTER) { result = getSubBlock(index, null); @@ -977,7 +982,9 @@ private SwiftTagListBlock _searchSubBlockByCriteria(final Tag tag, final boolean } } else { - boolean hasDelimiterCriteria = (searchSelection == SearchSelection.AFTER && index < this.tags.size() - 1) || (searchSelection == SearchSelection.BEFORE && index < this.tags.size()); + boolean hasDelimiterCriteria = + (searchSelection == SearchSelection.AFTER && index < this.tags.size() - 1) + || (searchSelection == SearchSelection.BEFORE && index < this.tags.size()); if (hasDelimiterCriteria) { if (searchSelection == SearchSelection.AFTER) { @@ -1028,7 +1035,8 @@ private int getIndexByCriteria(SearchBoundary criteria, final Tag tag) { */ public SwiftTagListBlock getSubBlockAfterFirst(final String tagname, final boolean includeBoundaryInResult) { final Tag tag = new Tag(tagname, ""); - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.FIRST_TAG_NAME); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.FIRST_TAG_NAME); } /** @@ -1045,7 +1053,8 @@ public SwiftTagListBlock getSubBlockAfterFirst(final String tagname, final boole * @since 7.9.3 */ public SwiftTagListBlock getSubBlockAfterFirst(final Tag tag, final boolean includeBoundaryInResult) { - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.FIRST_TAG_IGNORE_CR); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.FIRST_TAG_IGNORE_CR); } /** @@ -1060,7 +1069,8 @@ public SwiftTagListBlock getSubBlockAfterFirst(final Tag tag, final boolean incl */ public SwiftTagListBlock getSubBlockAfterLast(final String tagname, final boolean includeBoundaryInResult) { final Tag tag = new Tag(tagname, ""); - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.LAST_TAG_NAME); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.AFTER, SearchBoundary.LAST_TAG_NAME); } /** @@ -1075,7 +1085,8 @@ public SwiftTagListBlock getSubBlockAfterLast(final String tagname, final boolea */ public SwiftTagListBlock getSubBlockBeforeFirst(final String tagname, final boolean includeBoundaryInResult) { final Tag tag = new Tag(tagname, ""); - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.FIRST_TAG_NAME); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.FIRST_TAG_NAME); } /** @@ -1090,7 +1101,8 @@ public SwiftTagListBlock getSubBlockBeforeFirst(final String tagname, final bool * @since 9.2.9 */ public SwiftTagListBlock getSubBlockBeforeFirst(final Tag tag, final boolean includeBoundaryInResult) { - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.FIRST_TAG_IGNORE_CR); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.FIRST_TAG_IGNORE_CR); } /** @@ -1102,7 +1114,8 @@ public SwiftTagListBlock getSubBlockBeforeFirst(final Tag tag, final boolean inc */ public SwiftTagListBlock getSubBlockBeforeLast(final String tagname, final boolean includeBoundaryInResult) { final Tag tag = new Tag(tagname, ""); - return _searchSubBlockByCriteria(tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.LAST_TAG_NAME); + return _searchSubBlockByCriteria( + tag, includeBoundaryInResult, SearchSelection.BEFORE, SearchBoundary.LAST_TAG_NAME); } /** @@ -1312,8 +1325,10 @@ private int indexOfFirstValue(final String tagname, final String value, boolean if (this.tags != null && !this.tags.isEmpty()) { for (int i = 0; i < this.tags.size(); i++) { final Tag t = this.tags.get(i); - if ((ignoreCR && t.equalsIgnoreCR(new Tag(tagname, value))) || - (!ignoreCR && StringUtils.equals(tagname, t.getName()) && StringUtils.equals(value, t.getValue()))) { + if ((ignoreCR && t.equalsIgnoreCR(new Tag(tagname, value))) + || (!ignoreCR + && StringUtils.equals(tagname, t.getName()) + && StringUtils.equals(value, t.getValue()))) { return i; } } @@ -1536,7 +1551,8 @@ public SwiftTagListBlock filterByNameOrdered(final String... names) { * @param tail names of tags that are optional and belong to the sequence, the must be after endName * @return an empty list if none found or prerequisites not met */ - public List getSubBlocksDelimitedWithOptionalTail(final String[] start, final String[] end, final String[] tail) { + public List getSubBlocksDelimitedWithOptionalTail( + final String[] start, final String[] end, final String[] tail) { if (tags != null && !tags.isEmpty()) { final List result = new ArrayList<>(); int offset = 0; @@ -1633,7 +1649,8 @@ public SwiftTagListBlock getSubBlockByTagNames(final Integer startIndex, final S * @return the tag index of the last field added to the target block, useful to get multiple blocks * @since 7.10.4 */ - private int getSubBlockByTagNames(final SwiftTagListBlock target, final Integer startIndex, final String... searchTags) { + private int getSubBlockByTagNames( + final SwiftTagListBlock target, final Integer startIndex, final String... searchTags) { int tagsIndex = startIndex != null ? startIndex : 0; int searchIndex = 0; int lastAddedIndex = tagsIndex; @@ -1671,7 +1688,8 @@ private int getSubBlockByTagNames(final SwiftTagListBlock target, final Integer * @param tail names of tags that are optional and belong to the sequence, the must be after endName * @return the found block or null if prerequisites are not met */ - public SwiftTagListBlock getSubBlockDelimitedWithOptionalTail(final String[] start, final String[] end, final String[] tail) { + public SwiftTagListBlock getSubBlockDelimitedWithOptionalTail( + final String[] start, final String[] end, final String[] tail) { if (tags != null && !tags.isEmpty()) { final int s = indexOfAnyFirst(start); final int e = indexOfAnyFirstAfterIndex(s + 1, end); @@ -1986,24 +2004,24 @@ public SwiftTagListBlock clear() { @Override public String getName() { - //unused + // unused return null; } @Override public Integer getNumber() { - //unused + // unused return null; } @Override protected void setBlockName(final String blockName) { - //unused + // unused } @Override protected void setBlockNumber(final Integer blockNumber) { - //unused + // unused } public void visit(final TagVisitor visitor) { @@ -2110,5 +2128,4 @@ public void remove() { throw new UnsupportedOperationException("Can't remove on an empty iterator"); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftValueBlock.java b/src/main/java/com/prowidesoftware/swift/model/SwiftValueBlock.java index 6c90b7026..142da5e5a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftValueBlock.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftValueBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,15 +27,16 @@ */ public abstract class SwiftValueBlock extends SwiftBlock implements Serializable { private static final long serialVersionUID = -3680693640473937755L; + @SuppressWarnings("unused") - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftValueBlock.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftValueBlock.class.getName()); /** * Default constructor, shouldn't be used normally. * present only for subclasses */ - protected SwiftValueBlock() { - } + protected SwiftValueBlock() {} /** * This method should be overwritten by subclasses, calling @@ -44,7 +45,8 @@ protected SwiftValueBlock() { * @return N/A */ public String getBlockValue() { - throw new UnsupportedOperationException("cannot call getBlockValue on SwiftValueBlock, must be on specific subclasses"); + throw new UnsupportedOperationException( + "cannot call getBlockValue on SwiftValueBlock, must be on specific subclasses"); } /** @@ -54,7 +56,8 @@ public String getBlockValue() { * @param value unused */ public void setBlockValue(final String value) { - throw new UnsupportedOperationException("cannot call setBlockValue on SwiftValueBlock, must be on specific subclasses"); + throw new UnsupportedOperationException( + "cannot call setBlockValue on SwiftValueBlock, must be on specific subclasses"); } /** @@ -64,7 +67,8 @@ public void setBlockValue(final String value) { * @return the blocks value as a single string */ public String getValue() { - throw new UnsupportedOperationException("cannot call getValue on SwiftValueBlock, must be on specific subclasses"); + throw new UnsupportedOperationException( + "cannot call getValue on SwiftValueBlock, must be on specific subclasses"); } /** @@ -75,7 +79,8 @@ public String getValue() { * @param value the blocks value as a single string */ public void setValue(final String value) { - throw new UnsupportedOperationException("cannot call setValue on SwiftValueBlock, must be on specific subclasses"); + throw new UnsupportedOperationException( + "cannot call setValue on SwiftValueBlock, must be on specific subclasses"); } /** @@ -136,7 +141,6 @@ protected String getValuePart(final String value, final int start, int size) { return s; } - /** * Returns a fragment of the block value received from a starting index until the end of value * (or null if value is not large enough).
    diff --git a/src/main/java/com/prowidesoftware/swift/model/Tag.java b/src/main/java/com/prowidesoftware/swift/model/Tag.java index 57fdbb17f..a39b7a278 100644 --- a/src/main/java/com/prowidesoftware/swift/model/Tag.java +++ b/src/main/java/com/prowidesoftware/swift/model/Tag.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,9 @@ package com.prowidesoftware.swift.model; import com.prowidesoftware.swift.model.field.Field; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.io.Serializable; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Representation of an MT field in a message as a plain key/value tuple. @@ -49,8 +47,7 @@ public class Tag implements Serializable { /** * Default constructor. */ - public Tag() { - } + public Tag() {} /** * Copy constructor. @@ -99,8 +96,7 @@ public Tag(String inner) { this.value = inner.substring(i + 1); } } else { - if (inner.length() > 0) - this.value = inner; + if (inner.length() > 0) this.value = inner; } } @@ -220,8 +216,7 @@ public String toString() { * verifies that the unparsed text list exists */ protected void unparsedTextVerify() { - if (this.unparsedTexts == null) - this.unparsedTexts = new UnparsedTextList(); + if (this.unparsedTexts == null) this.unparsedTexts = new UnparsedTextList(); } /** @@ -254,8 +249,7 @@ public void setUnparsedTexts(UnparsedTextList texts) { public Integer getUnparsedTextsSize() { // no list => size is zero... - if (this.unparsedTexts == null) - return 0; + if (this.unparsedTexts == null) return 0; return this.unparsedTexts.size(); } @@ -335,9 +329,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tag tag = (Tag) o; - return Objects.equals(name, tag.name) && - Objects.equals(value, tag.value) && - Objects.equals(unparsedTexts, tag.unparsedTexts); + return Objects.equals(name, tag.name) + && Objects.equals(value, tag.value) + && Objects.equals(unparsedTexts, tag.unparsedTexts); } @Override @@ -354,20 +348,14 @@ public int hashCode() { * @since 7.9.3 */ public boolean equalsIgnoreCR(Tag other) { - if (other == null) - return false; - if (this == other) - return true; + if (other == null) return false; + if (this == other) return true; if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; + if (other.name != null) return false; + } else if (!name.equals(other.name)) return false; if (unparsedTexts == null) { - if (other.unparsedTexts != null) - return false; - } else if (!unparsedTexts.equals(other.unparsedTexts)) - return false; + if (other.unparsedTexts != null) return false; + } else if (!unparsedTexts.equals(other.unparsedTexts)) return false; if (value == null) { return other.value == null; } else return StringUtils.replace(value, "\r", "").equals(StringUtils.replace(other.value, "\r", "")); @@ -494,5 +482,4 @@ public boolean contains(String searchStr) { public Field asField() { return Field.getField(this); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/TagVisitor.java b/src/main/java/com/prowidesoftware/swift/model/TagVisitor.java index 97922a592..4fd9ba3e1 100644 --- a/src/main/java/com/prowidesoftware/swift/model/TagVisitor.java +++ b/src/main/java/com/prowidesoftware/swift/model/TagVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/UETRUtils.java b/src/main/java/com/prowidesoftware/swift/model/UETRUtils.java index 537713ae5..3902bc23b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/UETRUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/UETRUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,5 +33,4 @@ public static String generate() { UUID uuid = UUID.randomUUID(); return uuid.toString(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/UnparsedTextList.java b/src/main/java/com/prowidesoftware/swift/model/UnparsedTextList.java index 6b8d04aff..42c9d3cbd 100644 --- a/src/main/java/com/prowidesoftware/swift/model/UnparsedTextList.java +++ b/src/main/java/com/prowidesoftware/swift/model/UnparsedTextList.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,9 @@ package com.prowidesoftware.swift.model; import com.prowidesoftware.swift.io.ConversionService; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.builder.ToStringBuilder; - import java.io.Serializable; import java.util.*; +import org.apache.commons.lang3.builder.ToStringBuilder; /** *

    List of unparsed texts for messages, blocks or tags.
    @@ -85,8 +83,7 @@ public class UnparsedTextList implements Serializable { /** * Default Constructor */ - public UnparsedTextList() { - } + public UnparsedTextList() {} /** * Constructor from a collection of texts @@ -109,7 +106,7 @@ public UnparsedTextList(final Collection texts) { * @param text the text to analyze * @return true if the text is likely to be a SWIFT message */ - static public Boolean isMessage(final String text) { + public static Boolean isMessage(final String text) { // sanity check and evaluation return text != null && text.contains("{1:"); } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/AmountContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/AmountContainer.java index 5a161b74f..7f3333283 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/AmountContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/AmountContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ import java.math.BigDecimal; - /** * Fields with an amount component. * diff --git a/src/main/java/com/prowidesoftware/swift/model/field/AmountResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/AmountResolver.java index 6ccb5e58e..0c13dd8b8 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/AmountResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/AmountResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ import com.prowidesoftware.swift.utils.ResolverUtils; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.apache.commons.lang3.Validate; - import java.math.BigDecimal; import java.util.List; import java.util.Objects; diff --git a/src/main/java/com/prowidesoftware/swift/model/field/BICContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/BICContainer.java index 6b0756468..a369e0c86 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/BICContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/BICContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.prowidesoftware.swift.model.field; import com.prowidesoftware.swift.model.BIC; - import java.util.List; /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/BICResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/BICResolver.java index 17ee032a4..26e62eae5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/BICResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/BICResolver.java @@ -3,7 +3,6 @@ import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.utils.ResolverUtils; import com.prowidesoftware.swift.utils.SwiftFormatUtils; - import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -47,5 +46,4 @@ public static List bics(final Field f) { .map(v -> v != null ? SwiftFormatUtils.getBIC(v) : null) .collect(Collectors.toList()); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/CurrencyContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/CurrencyContainer.java index d31896601..39e09ab87 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/CurrencyContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/CurrencyContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,5 +68,4 @@ public interface CurrencyContainer extends PatternContainer { * @see #initializeCurrencies(String) */ void initializeCurrencies(Currency cur); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/CurrencyResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/CurrencyResolver.java index 85827ce8d..86893c917 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/CurrencyResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/CurrencyResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.utils.ResolverUtils; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.apache.commons.lang3.Validate; - import java.util.Currency; import java.util.List; import java.util.Objects; @@ -49,7 +47,7 @@ public static List currencyStrings(final Field f) { * @deprecated Use {@link #currencyStrings(Field)} instead */ @Deprecated - @ProwideDeprecated(phase4= TargetYear.SRU2024) + @ProwideDeprecated(phase4 = TargetYear.SRU2024) public static List resolveComponentsPattern(String pattern, List components) { DeprecationUtils.phase3(CurrencyResolver.class, "resolveComponentsPattern", "Use currencyStrings instead"); return ResolverUtils.findWantedType(pattern, 'C', components); @@ -72,9 +70,7 @@ public static List currencies(final Field f) { List values = ResolverUtils.findWantedType(f.typesPattern(), 'C', f.getComponents()); // prepare the result and convert all that match - return values.stream() - .map(SwiftFormatUtils::getCurrency) - .collect(Collectors.toList()); + return values.stream().map(SwiftFormatUtils::getCurrency).collect(Collectors.toList()); } public static Currency resolveCurrency(CurrencyContainer o) { diff --git a/src/main/java/com/prowidesoftware/swift/model/field/DateContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/DateContainer.java index a5971005b..c4df59359 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/DateContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/DateContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,5 +34,4 @@ public interface DateContainer extends PatternContainer { * @return found dates or empty list */ List dates(); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/DateResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/DateResolver.java index 0619b9ae2..f2ab8f093 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/DateResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/DateResolver.java @@ -2,12 +2,11 @@ import com.prowidesoftware.swift.utils.ResolverUtils; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.apache.commons.lang3.tuple.Pair; - import java.util.Calendar; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; +import org.apache.commons.lang3.tuple.Pair; public class DateResolver { @@ -31,7 +30,8 @@ public static List dates(final Field f) { Objects.requireNonNull(f); // find all the non-null AMOUNT components - List> values = ResolverUtils.findWantedType(f.typesPattern(), "DEFYAUPJ", f.getComponents()); + List> values = + ResolverUtils.findWantedType(f.typesPattern(), "DEFYAUPJ", f.getComponents()); // prepare the result and convert all that match return values.stream() @@ -56,21 +56,30 @@ public static Calendar date(final Field f) { Objects.requireNonNull(f); // find the first DATE component - Pair value = ResolverUtils.findFirstWantedType(f.typesPattern(), "DEFYAUPJ", f.getComponents()); + Pair value = + ResolverUtils.findFirstWantedType(f.typesPattern(), "DEFYAUPJ", f.getComponents()); return value != null ? _convert(value.getKey(), value.getValue()) : null; } private static Calendar _convert(Character type, String value) { switch (type) { - case 'D': return SwiftFormatUtils.getDate4(value); - case 'E': return SwiftFormatUtils.getDate2(value); - case 'F': return SwiftFormatUtils.getDate1(value); - case 'Y': return SwiftFormatUtils.getYear(value); - case 'A': return SwiftFormatUtils.getDateTime(value); - case 'U': return SwiftFormatUtils.getDateTimeShortYear(value); - case 'P': return SwiftFormatUtils.getDayTime(value); - case 'J': return SwiftFormatUtils.getMonthDay(value); + case 'D': + return SwiftFormatUtils.getDate4(value); + case 'E': + return SwiftFormatUtils.getDate2(value); + case 'F': + return SwiftFormatUtils.getDate1(value); + case 'Y': + return SwiftFormatUtils.getYear(value); + case 'A': + return SwiftFormatUtils.getDateTime(value); + case 'U': + return SwiftFormatUtils.getDateTimeShortYear(value); + case 'P': + return SwiftFormatUtils.getDayTime(value); + case 'J': + return SwiftFormatUtils.getMonthDay(value); } return null; diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field.java b/src/main/java/com/prowidesoftware/swift/model/field/Field.java index 04c699c81..225a95ec5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,6 @@ import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.model.Tag; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.time.DateFormatUtils; - import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.math.BigDecimal; @@ -38,7 +34,9 @@ import java.util.*; import java.util.logging.Level; import java.util.stream.Collectors; - +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.time.DateFormatUtils; /** * Base class implemented by classes that provide general access to field components. @@ -103,7 +101,7 @@ protected Field(final Field source) { * @return the formatted amount as String */ protected static String formatNumber(final Object aValue) { - //create formatter for financial amounts + // create formatter for financial amounts final DecimalFormat fmt = new DecimalFormat("#,###.00"); final NumberFormat f = NumberFormat.getInstance(Locale.getDefault()); @@ -156,7 +154,7 @@ protected static String formatAccount(final String a) { * * @return BigDecimal value of number parameter */ - static public BigDecimal getAsBigDecimal(final Number number) { + public static BigDecimal getAsBigDecimal(final Number number) { if (number instanceof BigDecimal) { return (BigDecimal) number; } else if (number instanceof Long) { @@ -179,7 +177,7 @@ static public BigDecimal getAsBigDecimal(final Number number) { * @param t a tag with proper name and value content * @return a specific field object, ex: Field32A. Or null if exceptions occur during object creation. */ - static public Field getField(final Tag t) { + public static Field getField(final Tag t) { return getField(t.getName(), t.getValue()); } @@ -191,17 +189,20 @@ static public Field getField(final Tag t) { * @return a specific field object (example: Field32A) or null if exceptions occur during object creation. * @since 7.8 */ - static public Field getField(final String name, final String value) { + public static Field getField(final String name, final String value) { Object r = null; try { final Class c = Class.forName("com.prowidesoftware.swift.model.field.Field" + name); - @SuppressWarnings("rawtypes") final Class[] argsClass = {String.class}; - @SuppressWarnings("rawtypes") final Constructor ct = c.getConstructor(argsClass); + @SuppressWarnings("rawtypes") + final Class[] argsClass = {String.class}; + @SuppressWarnings("rawtypes") + final Constructor ct = c.getConstructor(argsClass); final Object[] arglist = {value}; r = ct.newInstance(arglist); } catch (final ClassNotFoundException e) { - log.warning("Field class for Field" + name - + " not found. This is normally caused by an unrecognized field in the message or a malformed message block structure."); + log.warning( + "Field class for Field" + name + + " not found. This is normally caused by an unrecognized field in the message or a malformed message block structure."); } catch (final Exception e) { log.log(Level.WARNING, "An error occurred while creating an instance of " + name, e); } @@ -213,7 +214,7 @@ static public Field getField(final String name, final String value) { * * @since 7.8 */ - static public String getLabel(final String fieldName, final String mt, final String sequence) { + public static String getLabel(final String fieldName, final String mt, final String sequence) { return getLabel(fieldName, mt, sequence, Locale.getDefault()); } @@ -240,7 +241,7 @@ static public String getLabel(final String fieldName, final String mt, final Str * @param locale the locale for which a resource bundle is desired * @return a resource bundle based label for the given locale or the tag name, or the resource key if not found */ - static public String getLabel(final String fieldName, final String mt, final String sequence, final Locale locale) { + public static String getLabel(final String fieldName, final String mt, final String sequence, final Locale locale) { return _getLabel(fieldName, mt, sequence, locale, "name"); } @@ -249,16 +250,18 @@ static public String getLabel(final String fieldName, final String mt, final Str * * @since 7.8.4 */ - static public String getLabelComponents(final String fieldName, final String mt, final String sequence, final Locale locale) { + public static String getLabelComponents( + final String fieldName, final String mt, final String sequence, final Locale locale) { Locale l = locale != null ? locale : Locale.getDefault(); return _getLabel(fieldName, mt, sequence, l, "components"); } - static private String _getLabel(final String fieldName, final String mt, final String sequence, final Locale locale, final String prop) { + private static String _getLabel( + final String fieldName, final String mt, final String sequence, final Locale locale, final String prop) { final String bundle = "pw_swift_labels"; String key = null; String result = null; - //try { + // try { final ResourceBundle labels = ResourceBundle.getBundle(bundle, locale); if (labels != null) { if (sequence != null && mt != null) { @@ -311,9 +314,9 @@ static private String _getLabel(final String fieldName, final String mt, final S result = getString(labels, key); } } - //} catch (MissingResourceException e) { + // } catch (MissingResourceException e) { // e.printStackTrace(); - //} + // } if (result != null) { return result; } @@ -362,15 +365,19 @@ public static boolean validName(final String name) { return false; } if (name.length() < 2 || name.length() > 3) { - //log.warning("field name must be present and have 2 or 3 characters length and found: "+field); + // log.warning("field name must be present and have 2 or 3 characters length and found: "+field); return false; } if (!StringUtils.isNumeric(name.substring(0, 2))) { - //log.warning("field name should start with a numeric prefix and found: "+field.substring(0, 2)); + // log.warning("field name should start with a numeric prefix and found: "+field.substring(0, 2)); return false; } - //log.warning("letter option if present should be a single capital letter or an 'a' for all letter options, and found: "+field.charAt(2)); - return name.length() != 3 || Character.isDigit(name.charAt(2)) || name.charAt(2) == 'a' || Character.isUpperCase(name.charAt(2)); + // log.warning("letter option if present should be a single capital letter or an 'a' for all letter options, and + // found: "+field.charAt(2)); + return name.length() != 3 + || Character.isDigit(name.charAt(2)) + || name.charAt(2) == 'a' + || Character.isUpperCase(name.charAt(2)); } /** @@ -392,7 +399,9 @@ public static Field fromJson(final String json) { Method method = c.getMethod("fromJson", String.class); return (Field) method.invoke(null, json); } catch (final ClassNotFoundException e) { - log.warning("Field class for Field" + name + " not found. This is normally caused by an unrecognized field in the message or a malformed message block structure."); + log.warning( + "Field class for Field" + name + + " not found. This is normally caused by an unrecognized field in the message or a malformed message block structure."); } catch (final Exception e) { log.log(Level.WARNING, "An error occured while creating an instance of " + name, e); } @@ -515,9 +524,10 @@ public void setComponents(final List components) { * @param value String value of the parsed component (without component separators ':', '/', '//') */ public void setComponent(final int number, final String value) { - Validate.isTrue(number > 0, "components are numerated starting at 1, cannot insert a component with number " + number); + Validate.isTrue( + number > 0, "components are numerated starting at 1, cannot insert a component with number " + number); - //internal position index is zero based + // internal position index is zero based final int position = number - 1; if (this.components == null) { @@ -537,7 +547,7 @@ public void setComponent(final int number, final String value) { * @return found component or null */ public String getComponent(final int number) { - //internal position index is zero based + // internal position index is zero based final int position = number - 1; if (this.components != null && position >= 0 && position < this.components.size()) { @@ -736,7 +746,8 @@ public Number getComponentAsNumber(final int component) { * @return s */ public String joinComponents(final int start, final boolean skipLast) { - // FIXME para que se crea el list intermedio toAdd? no le veo razon de ser, se podria iterar en el segundo loop directo sobre this.components + // FIXME para que se crea el list intermedio toAdd? no le veo razon de ser, se podria iterar en el segundo loop + // directo sobre this.components final List toAdd = new ArrayList<>(); for (int i = start; i < this.componentsSize(); i++) { if (StringUtils.isNotEmpty(this.components.get(i))) { @@ -1044,8 +1055,8 @@ protected String getLine(final Field cp, final Integer start, final Integer end, // return line subset return asString(hash, lines.subList(start - 1, trimmedEnd)); } else { - log.warning("invalid lines range [" + start + "-" + end - + "] the ending line number (" + end + ") must be greater or equal to the starting line number (" + start + ")"); + log.warning("invalid lines range [" + start + "-" + end + "] the ending line number (" + end + + ") must be greater or equal to the starting line number (" + start + ")"); } } else { // return a single line @@ -1162,7 +1173,7 @@ public String getComponentLabel(final String componentName) { * @since 7.8.4 */ public String getComponentLabel(final int number) { - //internal position index is zero based + // internal position index is zero based final int position = number - 1; final List labels = getComponentLabels(); if (labels != null && position >= 0 && position < labels.size()) { @@ -1178,7 +1189,6 @@ public String getComponentLabel(final int number) { */ protected abstract Map getComponentMap(); - /** * Returns a mapping between component labels and the internal component number. * Component labels are in lowercase and without spaces and separators. @@ -1225,8 +1235,8 @@ protected final Locale notNull(final Locale locale) { * For example Name And Address will be name-and-address key * in resource bundle */ - //public abstract List getComponentLabels(Locale locale); - //public String getComponentLabel(Locale locale); + // public abstract List getComponentLabels(Locale locale); + // public String getComponentLabel(Locale locale); /** * Appends a not null field component to the builder. @@ -1256,7 +1266,8 @@ protected void append(StringBuilder result, int component) { public String toJson() { String stdFormat = toJsonFormat(); if (this instanceof StructuredNarrativeField) { - return stdFormat.substring(0, stdFormat.length() - 1) + "," + toNarrativeFormat().substring(1); + return stdFormat.substring(0, stdFormat.length() - 1) + "," + + toNarrativeFormat().substring(1); } return stdFormat; } @@ -1281,5 +1292,4 @@ String toNarrativeFormat() { Gson gson = new Gson(); return gson.toJson(narrative); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java index d3c4c3a3c..0b94e7f36 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,36 +15,24 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; +import java.util.ArrayList; import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.MultiLineField; -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 11T. *

    @@ -72,15 +60,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field11T extends Field implements Serializable, DateContainer, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 11T. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 11T. + */ public static final String NAME = "11T"; /** * Same as NAME, intended to be clear when using static imports. @@ -92,36 +80,36 @@ public class Field11T extends Field implements Serializable, DateContainer, Mult */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S$"; + public static final String PARSER_PATTERN = "S$"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "NDH"; + public static final String COMPONENTS_PATTERN = "NDH"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "NDH"; + public static final String TYPES_PATTERN = "NDH"; - /** - * Component number for the Type subfield. - */ - public static final Integer TYPE = 1; + /** + * Component number for the Type subfield. + */ + public static final Integer TYPE = 1; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 2; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 2; - /** - * Component number for the Time subfield. - */ - public static final Integer TIME = 3; + /** + * Component number for the Time subfield. + */ + public static final Integer TIME = 3; /** * Default constructor. Creates a new field setting all components to null. @@ -150,7 +138,8 @@ public Field11T(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "11T")) { - throw new IllegalArgumentException("cannot create field 11T from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 11T from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -187,7 +176,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -220,12 +208,12 @@ public void parse(final String value) { @Override public String getValue() { final StringBuilder result = new StringBuilder(); - append(result, 1); - if (getComponent2() != null || getComponent3() != null) { - result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); - append(result, 2); - append(result, 3); - } + append(result, 1); + if (getComponent2() != null || getComponent3() != null) { + result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL); + append(result, 2); + append(result, 3); + } return result.toString(); } @@ -244,19 +232,20 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 11T"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent2AsCalendar(); if (cal != null) { return f.format(cal.getTime()); } } if (component == 3) { - //time: HH[mm] + // time: HH[mm] java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale)); java.util.Calendar cal = getComponent3AsCalendar(); if (cal != null) { @@ -697,7 +686,6 @@ public Field11T setTime(java.util.Calendar component3) { return setComponent3(component3); } - /** * Returns all components that can be converted to a Calendar * @@ -716,7 +704,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field11T.NAME @@ -899,6 +886,4 @@ public static Field11T fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java index 40ffe3205..2da396dc8 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 12H. *

    @@ -65,15 +55,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12H extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 12H. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 12H. + */ public static final String NAME = "12H"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,31 +75,31 @@ public class Field12H extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S[/S]"; + public static final String PARSER_PATTERN = "S[/S]"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SS"; + public static final String COMPONENTS_PATTERN = "SS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SS"; + public static final String TYPES_PATTERN = "SS"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 2; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -138,7 +128,8 @@ public Field12H(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "12H")) { - throw new IllegalArgumentException("cannot create field 12H from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 12H from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -175,7 +166,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -220,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 12H"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } return null; @@ -423,8 +413,6 @@ public Field12H setNarrative(String component2) { return setComponent2(component2); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field12H.NAME @@ -523,6 +511,4 @@ public static Field12H fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java index 0c3d3444c..fb5fc9c17 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,32 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 12K. *

    @@ -66,15 +57,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12K extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 12K. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 12K. + */ public static final String NAME = "12K"; /** * Same as NAME, intended to be clear when using static imports. @@ -86,31 +77,31 @@ public class Field12K extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "N"; + public static final String COMPONENTS_PATTERN = "N"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "N"; + public static final String TYPES_PATTERN = "N"; - /** - * Component number for the Number subfield. - */ - public static final Integer NUMBER = 1; + /** + * Component number for the Number subfield. + */ + public static final Integer NUMBER = 1; - /** - * Alternative (DEPRECATED) constant name for field's Number Component number. - * @see #NUMBER - */ + /** + * Alternative (DEPRECATED) constant name for field's Number Component number. + * @see #NUMBER + */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) public static final Integer VERSION = 1; @@ -142,7 +133,8 @@ public Field12K(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "12K")) { - throw new IllegalArgumentException("cannot create field 12K from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 12K from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +171,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -220,7 +211,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 12K"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -579,8 +570,6 @@ public Field12K setVersion(java.lang.Number component1) { return setNumber(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field12K.NAME @@ -679,6 +668,4 @@ public static Field12K fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java index 1bdb2a9fe..7027583f5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 12L. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12L extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 12L. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 12L. + */ public static final String NAME = "12L"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field12L extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field12L(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "12L")) { - throw new IllegalArgumentException("cannot create field 12L from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 12L from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 12L"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field12L setCode(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field12L.NAME @@ -460,6 +448,4 @@ public static Field12L fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java index ff91f4f06..f851a7b77 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 12R. *

    @@ -65,15 +55,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12R extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 12R. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 12R. + */ public static final String NAME = "12R"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,31 +75,31 @@ public class Field12R extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S[/S]"; + public static final String PARSER_PATTERN = "S[/S]"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SS"; + public static final String COMPONENTS_PATTERN = "SS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SS"; + public static final String TYPES_PATTERN = "SS"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 2; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -138,7 +128,8 @@ public Field12R(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "12R")) { - throw new IllegalArgumentException("cannot create field 12R from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 12R from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -175,7 +166,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -220,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 12R"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } return null; @@ -423,8 +413,6 @@ public Field12R setNarrative(String component2) { return setComponent2(component2); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field12R.NAME @@ -523,6 +511,4 @@ public static Field12R fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java index 590ef8302..e9ef0f250 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 12S. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12S extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 12S. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 12S. + */ public static final String NAME = "12S"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field12S extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field12S(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "12S")) { - throw new IllegalArgumentException("cannot create field 12S from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 12S from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 12S"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field12S setCode(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field12S.NAME @@ -460,6 +448,4 @@ public static Field12S fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java index 460639fd7..8ce89687c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 13E. *

    @@ -68,15 +57,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field13E extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 13E. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 13E. + */ public static final String NAME = "13E"; /** * Same as NAME, intended to be clear when using static imports. @@ -88,31 +77,31 @@ public class Field13E extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = ""; + public static final String PARSER_PATTERN = ""; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "DH"; + public static final String COMPONENTS_PATTERN = "DH"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "DH"; + public static final String TYPES_PATTERN = "DH"; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 1; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 1; - /** - * Component number for the Time subfield. - */ - public static final Integer TIME = 2; + /** + * Component number for the Time subfield. + */ + public static final Integer TIME = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -141,7 +130,8 @@ public Field13E(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "13E")) { - throw new IllegalArgumentException("cannot create field 13E from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 13E from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -178,7 +168,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -226,15 +215,16 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 13E"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); } } if (component == 2) { - //time: HH[mm] + // time: HH[mm] java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale)); java.util.Calendar cal = getComponent2AsCalendar(); if (cal != null) { @@ -514,7 +504,6 @@ public Field13E setTime(java.util.Calendar component2) { return setComponent2(component2); } - /** * Returns all components that can be converted to a Calendar * @@ -533,7 +522,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field13E.NAME @@ -632,6 +620,4 @@ public static Field13E fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java index e7b2b0443..d91c5aedb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 20E. *

    @@ -65,15 +55,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field20E extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 20E. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 20E. + */ public static final String NAME = "20E"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,31 +75,31 @@ public class Field20E extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S/S"; + public static final String PARSER_PATTERN = "S/S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SS"; + public static final String COMPONENTS_PATTERN = "SS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SS"; + public static final String TYPES_PATTERN = "SS"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; - /** - * Component number for the Reference subfield. - */ - public static final Integer REFERENCE = 2; + /** + * Component number for the Reference subfield. + */ + public static final Integer REFERENCE = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -138,7 +128,8 @@ public Field20E(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "20E")) { - throw new IllegalArgumentException("cannot create field 20E from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 20E from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -175,7 +166,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -219,11 +209,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 20E"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } return null; @@ -419,8 +409,6 @@ public Field20E setReference(String component2) { return setComponent2(component2); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field20E.NAME @@ -519,6 +507,4 @@ public static Field20E fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java index a53961b02..5de8be49c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 21S. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field21S extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 21S. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 21S. + */ public static final String NAME = "21S"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field21S extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Reference subfield. - */ - public static final Integer REFERENCE = 1; + /** + * Component number for the Reference subfield. + */ + public static final Integer REFERENCE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field21S(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "21S")) { - throw new IllegalArgumentException("cannot create field 21S from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 21S from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 21S"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field21S setReference(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field21S.NAME @@ -460,6 +448,4 @@ public static Field21S fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java index f9f700313..492a3c7da 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 21T. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field21T extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 21T. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 21T. + */ public static final String NAME = "21T"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field21T extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Reference subfield. - */ - public static final Integer REFERENCE = 1; + /** + * Component number for the Reference subfield. + */ + public static final Integer REFERENCE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field21T(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "21T")) { - throw new IllegalArgumentException("cannot create field 21T from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 21T from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 21T"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field21T setReference(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field21T.NAME @@ -460,6 +448,4 @@ public static Field21T fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java index e4d4dc8b1..7ee212674 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 25F. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field25F extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 25F. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 25F. + */ public static final String NAME = "25F"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field25F extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the TextPurpose subfield. - */ - public static final Integer TEXTPURPOSE = 1; + /** + * Component number for the TextPurpose subfield. + */ + public static final Integer TEXTPURPOSE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field25F(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "25F")) { - throw new IllegalArgumentException("cannot create field 25F from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 25F from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 25F"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field25F setTextPurpose(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field25F.NAME @@ -460,6 +448,4 @@ public static Field25F fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java b/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java index bbdd4bda2..7c061ea34 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 25G. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field25G extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 25G. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 25G. + */ public static final String NAME = "25G"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field25G extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field25G(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "25G")) { - throw new IllegalArgumentException("cannot create field 25G from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 25G from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 25G"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field25G setCode(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field25G.NAME @@ -460,6 +448,4 @@ public static Field25G fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java b/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java index 41c2b42eb..c33c4501a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,32 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 27A. *

    @@ -67,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field27A extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 27A. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 27A. + */ public static final String NAME = "27A"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,31 +78,31 @@ public class Field27A extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S/S"; + public static final String PARSER_PATTERN = "S/S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "NN"; + public static final String COMPONENTS_PATTERN = "NN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "NN"; + public static final String TYPES_PATTERN = "NN"; - /** - * Component number for the Number subfield. - */ - public static final Integer NUMBER = 1; + /** + * Component number for the Number subfield. + */ + public static final Integer NUMBER = 1; - /** - * Component number for the Total subfield. - */ - public static final Integer TOTAL = 2; + /** + * Component number for the Total subfield. + */ + public static final Integer TOTAL = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -140,7 +131,8 @@ public Field27A(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "27A")) { - throw new IllegalArgumentException("cannot create field 27A from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 27A from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -177,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +212,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 27A"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } return null; @@ -663,8 +654,6 @@ public Field27A setTotal(java.lang.Number component2) { return setComponent2(component2); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field27A.NAME @@ -763,6 +752,4 @@ public static Field27A fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java index a9645628c..f6a21b0e1 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 29D. *

    @@ -68,15 +57,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29D extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 29D. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 29D. + */ public static final String NAME = "29D"; /** * Same as NAME, intended to be clear when using static imports. @@ -88,26 +77,26 @@ public class Field29D extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S[$S]0-3"; + public static final String PARSER_PATTERN = "S[$S]0-3"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SSSS"; + public static final String COMPONENTS_PATTERN = "SSSS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SSSS"; + public static final String TYPES_PATTERN = "SSSS"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -136,7 +125,8 @@ public Field29D(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "29D")) { - throw new IllegalArgumentException("cannot create field 29D from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 29D from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -173,7 +163,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -215,19 +204,19 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 29D"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } if (component == 3) { - //default format (as is) + // default format (as is) return getComponent(3); } if (component == 4) { - //default format (as is) + // default format (as is) return getComponent(4); } return null; @@ -552,8 +541,6 @@ public Field29D setNarrativeLine4(String component4) { return setComponent4(component4); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field29D.NAME @@ -742,6 +729,4 @@ public static Field29D fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java index cff03bc0a..548b7e22d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 29F. *

    @@ -68,15 +57,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29F extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 29F. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 29F. + */ public static final String NAME = "29F"; /** * Same as NAME, intended to be clear when using static imports. @@ -88,26 +77,26 @@ public class Field29F extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S[$S]0-3"; + public static final String PARSER_PATTERN = "S[$S]0-3"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SSSS"; + public static final String COMPONENTS_PATTERN = "SSSS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SSSS"; + public static final String TYPES_PATTERN = "SSSS"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -136,7 +125,8 @@ public Field29F(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "29F")) { - throw new IllegalArgumentException("cannot create field 29F from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 29F from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -173,7 +163,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -215,19 +204,19 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 29F"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } if (component == 3) { - //default format (as is) + // default format (as is) return getComponent(3); } if (component == 4) { - //default format (as is) + // default format (as is) return getComponent(4); } return null; @@ -552,8 +541,6 @@ public Field29F setNarrativeLine4(String component4) { return setComponent4(component4); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field29F.NAME @@ -742,6 +729,4 @@ public static Field29F fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java index f83b7b054..479d3b69e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.BIC; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - -import com.prowidesoftware.swift.model.BIC; - -import com.prowidesoftware.swift.model.field.BICContainer; -import com.prowidesoftware.swift.model.field.BICResolver; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 29P. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29P extends Field implements Serializable, BICContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 29P. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 29P. + */ public static final String NAME = "29P"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,31 +76,31 @@ public class Field29P extends Field implements Serializable, BICContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "B"; + public static final String COMPONENTS_PATTERN = "B"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "B"; + public static final String TYPES_PATTERN = "B"; - /** - * Component number for the IdentifierCode subfield. - */ - public static final Integer IDENTIFIERCODE = 1; + /** + * Component number for the IdentifierCode subfield. + */ + public static final Integer IDENTIFIERCODE = 1; - /** - * Alternative (DEPRECATED) constant name for field's IdentifierCode Component number. - * @see #IDENTIFIERCODE - */ + /** + * Alternative (DEPRECATED) constant name for field's IdentifierCode Component number. + * @see #IDENTIFIERCODE + */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) public static final Integer BIC = 1; @@ -143,7 +132,8 @@ public Field29P(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "29P")) { - throw new IllegalArgumentException("cannot create field 29P from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 29P from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -180,7 +170,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,7 +210,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 29P"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -468,16 +457,14 @@ public Field29P setBIC(com.prowidesoftware.swift.model.BIC component1) { return setIdentifierCode(component1); } - public List bics() { return BICResolver.bics(this); } - public List bicStrings () { + public List bicStrings() { return BICResolver.bicStrings(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field29P.NAME @@ -576,6 +563,4 @@ public static Field29P fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java index 6781a5bae..039dcb75f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 29S. *

    @@ -65,15 +55,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29S extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 29S. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 29S. + */ public static final String NAME = "29S"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,31 +75,31 @@ public class Field29S extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S/S"; + public static final String PARSER_PATTERN = "S/S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SS"; + public static final String COMPONENTS_PATTERN = "SS"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SS"; + public static final String TYPES_PATTERN = "SS"; - /** - * Component number for the Code subfield. - */ - public static final Integer CODE = 1; + /** + * Component number for the Code subfield. + */ + public static final Integer CODE = 1; - /** - * Component number for the Party Identifier subfield. - */ - public static final Integer PARTY_IDENTIFIER = 2; + /** + * Component number for the Party Identifier subfield. + */ + public static final Integer PARTY_IDENTIFIER = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -138,7 +128,8 @@ public Field29S(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "29S")) { - throw new IllegalArgumentException("cannot create field 29S from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 29S from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -175,7 +166,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -219,11 +209,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 29S"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //default format (as is) + // default format (as is) return getComponent(2); } return null; @@ -419,8 +409,6 @@ public Field29S setPartyIdentifier(String component2) { return setComponent2(component2); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field29S.NAME @@ -519,6 +507,4 @@ public static Field29S fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java index 3f4a45b17..ed78071db 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.BIC; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - -import com.prowidesoftware.swift.model.BIC; - -import com.prowidesoftware.swift.model.field.BICContainer; -import com.prowidesoftware.swift.model.field.BICResolver; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 29U. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29U extends Field implements Serializable, BICContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 29U. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 29U. + */ public static final String NAME = "29U"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,31 +76,31 @@ public class Field29U extends Field implements Serializable, BICContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "B"; + public static final String COMPONENTS_PATTERN = "B"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "B"; + public static final String TYPES_PATTERN = "B"; - /** - * Component number for the IdentifierCode subfield. - */ - public static final Integer IDENTIFIERCODE = 1; + /** + * Component number for the IdentifierCode subfield. + */ + public static final Integer IDENTIFIERCODE = 1; - /** - * Alternative (DEPRECATED) constant name for field's IdentifierCode Component number. - * @see #IDENTIFIERCODE - */ + /** + * Alternative (DEPRECATED) constant name for field's IdentifierCode Component number. + * @see #IDENTIFIERCODE + */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) public static final Integer BIC = 1; @@ -143,7 +132,8 @@ public Field29U(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "29U")) { - throw new IllegalArgumentException("cannot create field 29U from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 29U from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -180,7 +170,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,7 +210,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 29U"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -468,16 +457,14 @@ public Field29U setBIC(com.prowidesoftware.swift.model.BIC component1) { return setIdentifierCode(component1); } - public List bics() { return BICResolver.bics(this); } - public List bicStrings () { + public List bicStrings() { return BICResolver.bicStrings(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field29U.NAME @@ -576,6 +563,4 @@ public static Field29U fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java index 2d3eb971d..641cc6e05 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 31J. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31J extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 31J. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 31J. + */ public static final String NAME = "31J"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,26 +76,26 @@ public class Field31J extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "E"; + public static final String COMPONENTS_PATTERN = "E"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "E"; + public static final String TYPES_PATTERN = "E"; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 1; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -135,7 +124,8 @@ public Field31J(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "31J")) { - throw new IllegalArgumentException("cannot create field 31J from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 31J from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -172,7 +162,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -213,8 +202,9 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 31J"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); @@ -413,7 +403,6 @@ public Field31J setDate(java.util.Calendar component1) { return setComponent1(component1); } - /** * Returns all components that can be converted to a Calendar * @@ -432,7 +421,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field31J.NAME @@ -525,6 +513,4 @@ public static Field31J fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java index 150330c93..64a5dd77a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 31K. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31K extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 31K. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 31K. + */ public static final String NAME = "31K"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,26 +76,26 @@ public class Field31K extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "E"; + public static final String COMPONENTS_PATTERN = "E"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "E"; + public static final String TYPES_PATTERN = "E"; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 1; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -135,7 +124,8 @@ public Field31K(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "31K")) { - throw new IllegalArgumentException("cannot create field 31K from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 31K from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -172,7 +162,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -213,8 +202,9 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 31K"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); @@ -413,7 +403,6 @@ public Field31K setDate(java.util.Calendar component1) { return setComponent1(component1); } - /** * Returns all components that can be converted to a Calendar * @@ -432,7 +421,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field31K.NAME @@ -525,6 +513,4 @@ public static Field31K fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java index 4ed6d519c..7c90e054a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 31M. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31M extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 31M. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 31M. + */ public static final String NAME = "31M"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,26 +76,26 @@ public class Field31M extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "E"; + public static final String COMPONENTS_PATTERN = "E"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "E"; + public static final String TYPES_PATTERN = "E"; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 1; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -135,7 +124,8 @@ public Field31M(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "31M")) { - throw new IllegalArgumentException("cannot create field 31M from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 31M from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -172,7 +162,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -213,8 +202,9 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 31M"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); @@ -413,7 +403,6 @@ public Field31M setDate(java.util.Calendar component1) { return setComponent1(component1); } - /** * Returns all components that can be converted to a Calendar * @@ -432,7 +421,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field31M.NAME @@ -525,6 +513,4 @@ public static Field31M fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31R.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31R.java index ed6fbbc87..550de3604 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31R.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31R.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 31R. *

    @@ -68,15 +57,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31R extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 31R. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 31R. + */ public static final String NAME = "31R"; /** * Same as NAME, intended to be clear when using static imports. @@ -88,31 +77,31 @@ public class Field31R extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "[/]"; + public static final String PARSER_PATTERN = "[/]"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "EE"; + public static final String COMPONENTS_PATTERN = "EE"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "EE"; + public static final String TYPES_PATTERN = "EE"; - /** - * Component number for the Date 1 subfield. - */ - public static final Integer DATE_1 = 1; + /** + * Component number for the Date 1 subfield. + */ + public static final Integer DATE_1 = 1; - /** - * Component number for the Date 2 subfield. - */ - public static final Integer DATE_2 = 2; + /** + * Component number for the Date 2 subfield. + */ + public static final Integer DATE_2 = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -141,7 +130,8 @@ public Field31R(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "31R")) { - throw new IllegalArgumentException("cannot create field 31R from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 31R from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -178,7 +168,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -223,16 +212,18 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 31R"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); } } if (component == 2) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent2AsCalendar(); if (cal != null) { return f.format(cal.getTime()); @@ -514,7 +505,6 @@ public Field31R setDate2(java.util.Calendar component2) { return setComponent2(component2); } - /** * Returns all components that can be converted to a Calendar * @@ -533,7 +523,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field31R.NAME @@ -632,6 +621,4 @@ public static Field31R fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java index 186020d18..d5d710e58 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,22 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.util.Calendar; - -import com.prowidesoftware.swift.model.field.DateContainer; -import com.prowidesoftware.swift.model.field.DateResolver; - +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 31T. *

    @@ -67,15 +56,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31T extends Field implements Serializable, DateContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 31T. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 31T. + */ public static final String NAME = "31T"; /** * Same as NAME, intended to be clear when using static imports. @@ -87,26 +76,26 @@ public class Field31T extends Field implements Serializable, DateContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "E"; + public static final String COMPONENTS_PATTERN = "E"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "E"; + public static final String TYPES_PATTERN = "E"; - /** - * Component number for the Date subfield. - */ - public static final Integer DATE = 1; + /** + * Component number for the Date subfield. + */ + public static final Integer DATE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -135,7 +124,8 @@ public Field31T(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "31T")) { - throw new IllegalArgumentException("cannot create field 31T from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 31T from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -172,7 +162,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -213,8 +202,9 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 31T"); } if (component == 1) { - //date: [YY]YYMMDD - java.text.DateFormat f = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); + // date: [YY]YYMMDD + java.text.DateFormat f = + java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale)); java.util.Calendar cal = getComponent1AsCalendar(); if (cal != null) { return f.format(cal.getTime()); @@ -413,7 +403,6 @@ public Field31T setDate(java.util.Calendar component1) { return setComponent1(component1); } - /** * Returns all components that can be converted to a Calendar * @@ -432,7 +421,6 @@ public Calendar date() { return DateResolver.date(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field31T.NAME @@ -525,6 +513,4 @@ public static Field31T fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java index e2e115eaa..acb7adec6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34D. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34D extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34D. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34D. + */ public static final String NAME = "34D"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34D extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34D(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34D")) { - throw new IllegalArgumentException("cannot create field 34D from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34D from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34D"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34D setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34D.NAME @@ -668,6 +655,4 @@ public static Field34D fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java index 91b48f887..798cb388e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34K. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34K extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34K. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34K. + */ public static final String NAME = "34K"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34K extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34K(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34K")) { - throw new IllegalArgumentException("cannot create field 34K from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34K from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34K"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34K setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34K.NAME @@ -668,6 +655,4 @@ public static Field34K fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java index 15ca4e476..e02b5da51 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34L. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34L extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34L. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34L. + */ public static final String NAME = "34L"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34L extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34L(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34L")) { - throw new IllegalArgumentException("cannot create field 34L from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34L from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34L"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34L setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34L.NAME @@ -668,6 +655,4 @@ public static Field34L fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java index c7595761b..0793f2baa 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34M. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34M extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34M. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34M. + */ public static final String NAME = "34M"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34M extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34M(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34M")) { - throw new IllegalArgumentException("cannot create field 34M from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34M from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34M"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34M setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34M.NAME @@ -668,6 +655,4 @@ public static Field34M fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java index 711d7df9e..9020e55f9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34S. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34S extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34S. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34S. + */ public static final String NAME = "34S"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34S extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34S(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34S")) { - throw new IllegalArgumentException("cannot create field 34S from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34S from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34S"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34S setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34S.NAME @@ -668,6 +655,4 @@ public static Field34S fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java index 1d7f79c81..f34b2e415 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34T. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34T extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34T. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34T. + */ public static final String NAME = "34T"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34T extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34T(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34T")) { - throw new IllegalArgumentException("cannot create field 34T from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34T from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34T"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34T setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34T.NAME @@ -668,6 +655,4 @@ public static Field34T fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java index 8e1e49d26..463b8f990 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34U. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34U extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34U. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34U. + */ public static final String NAME = "34U"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34U extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34U(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34U")) { - throw new IllegalArgumentException("cannot create field 34U from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34U from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34U"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34U setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34U.NAME @@ -668,6 +655,4 @@ public static Field34U fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java index 8a1e5b9d1..df2c7742d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34V. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34V extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34V. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34V. + */ public static final String NAME = "34V"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34V extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34V(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34V")) { - throw new IllegalArgumentException("cannot create field 34V from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34V from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34V"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34V setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34V.NAME @@ -668,6 +655,4 @@ public static Field34V fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java index e60d62a1d..a5a74d773 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34W. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34W extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34W. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34W. + */ public static final String NAME = "34W"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34W extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34W(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34W")) { - throw new IllegalArgumentException("cannot create field 34W from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34W from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34W"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34W setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34W.NAME @@ -668,6 +655,4 @@ public static Field34W fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java index 23119128a..947ae289a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,23 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; +import com.prowidesoftware.swift.utils.SwiftFormatUtils; import java.io.Serializable; -import java.util.Locale; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - import java.math.BigDecimal; import java.math.BigInteger; - -import com.prowidesoftware.swift.model.field.AmountContainer; -import com.prowidesoftware.swift.model.field.AmountResolver; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 34X. *

    @@ -69,15 +58,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34X extends Field implements Serializable, AmountContainer { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 34X. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 34X. + */ public static final String NAME = "34X"; /** * Same as NAME, intended to be clear when using static imports. @@ -89,31 +78,31 @@ public class Field34X extends Field implements Serializable, AmountContainer { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "SN"; + public static final String PARSER_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "SN"; + public static final String COMPONENTS_PATTERN = "SN"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "SI"; + public static final String TYPES_PATTERN = "SI"; - /** - * Component number for the Currency subfield. - */ - public static final Integer CURRENCY = 1; + /** + * Component number for the Currency subfield. + */ + public static final Integer CURRENCY = 1; - /** - * Component number for the Amount subfield. - */ - public static final Integer AMOUNT = 2; + /** + * Component number for the Amount subfield. + */ + public static final Integer AMOUNT = 2; /** * Default constructor. Creates a new field setting all components to null. @@ -142,7 +131,8 @@ public Field34X(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "34X")) { - throw new IllegalArgumentException("cannot create field 34X from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 34X from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -179,7 +169,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -221,11 +210,11 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 34X"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } if (component == 2) { - //amount, rate + // amount, rate java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale)); f.setMaximumFractionDigits(13); BigDecimal n = getComponent2AsBigDecimal(); @@ -548,7 +537,6 @@ public Field34X setAmount(java.lang.Number component2) { return setComponent2(component2); } - /** * Returns the list of all NON-NULL amounts as BigDecimal * @@ -569,7 +557,6 @@ public BigDecimal amount() { return AmountResolver.amount(this); } - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field34X.NAME @@ -668,6 +655,4 @@ public static Field34X fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java index 1363fae19..9f2b5b17c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 47E. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field47E extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 47E. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 47E. + */ public static final String NAME = "47E"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field47E extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Information from Advising Bank subfield. - */ - public static final Integer INFORMATION_FROM_ADVISING_BANK = 1; + /** + * Component number for the Information from Advising Bank subfield. + */ + public static final Integer INFORMATION_FROM_ADVISING_BANK = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field47E(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "47E")) { - throw new IllegalArgumentException("cannot create field 47E from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 47E from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 47E"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field47E setInformationfromAdvisingBank(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field47E.NAME @@ -539,6 +526,4 @@ public static Field47E fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java index b4cef93ed..14d686d54 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,30 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49D. *

    @@ -64,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49D extends Field implements Serializable { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49D. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49D. + */ public static final String NAME = "49D"; /** * Same as NAME, intended to be clear when using static imports. @@ -84,26 +74,26 @@ public class Field49D extends Field implements Serializable { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Confirmation Indicator subfield. - */ - public static final Integer CONFIRMATION_INDICATOR = 1; + /** + * Component number for the Confirmation Indicator subfield. + */ + public static final Integer CONFIRMATION_INDICATOR = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -132,7 +122,8 @@ public Field49D(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49D")) { - throw new IllegalArgumentException("cannot create field 49D from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49D from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -169,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -210,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49D"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -366,8 +356,6 @@ public Field49D setConfirmationIndicator(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49D.NAME @@ -460,6 +448,4 @@ public static Field49D fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java index 48c0b9ae1..b12d1df6a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49F. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49F extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49F. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49F. + */ public static final String NAME = "49F"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field49F extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Confirmation Information subfield. - */ - public static final Integer CONFIRMATION_INFORMATION = 1; + /** + * Component number for the Confirmation Information subfield. + */ + public static final Integer CONFIRMATION_INFORMATION = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field49F(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49F")) { - throw new IllegalArgumentException("cannot create field 49F from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49F from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49F"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field49F setConfirmationInformation(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49F.NAME @@ -539,6 +526,4 @@ public static Field49F fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java index 95ea6c32b..4d9df2f09 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49J. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49J extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49J. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49J. + */ public static final String NAME = "49J"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field49J extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field49J(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49J")) { - throw new IllegalArgumentException("cannot create field 49J from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49J from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49J"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field49J setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49J.NAME @@ -539,6 +526,4 @@ public static Field49J fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java index 6da249f4c..0f3fd59bb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49K. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49K extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49K. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49K. + */ public static final String NAME = "49K"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field49K extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field49K(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49K")) { - throw new IllegalArgumentException("cannot create field 49K from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49K from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49K"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field49K setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49K.NAME @@ -539,6 +526,4 @@ public static Field49K fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java index 4f34ec6e1..9c4cf8e70 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49L. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49L extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49L. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49L. + */ public static final String NAME = "49L"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field49L extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field49L(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49L")) { - throw new IllegalArgumentException("cannot create field 49L from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49L from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49L"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field49L setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49L.NAME @@ -539,6 +526,4 @@ public static Field49L fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java index 635c5ea4e..c09af2768 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 49Z. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49Z extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 49Z. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 49Z. + */ public static final String NAME = "49Z"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field49Z extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field49Z(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "49Z")) { - throw new IllegalArgumentException("cannot create field 49Z from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 49Z from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 49Z"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field49Z setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field49Z.NAME @@ -539,6 +526,4 @@ public static Field49Z fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java index 896957ca8..4999d1fc9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,17 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 71E. *

    @@ -65,15 +51,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field71E extends StructuredNarrativeField implements Serializable, NarrativeContainer, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 71E. - */ + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 71E. + */ public static final String NAME = "71E"; /** * Same as NAME, intended to be clear when using static imports. @@ -107,7 +93,8 @@ public Field71E(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "71E")) { - throw new IllegalArgumentException("cannot create field 71E from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 71E from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -183,8 +170,6 @@ public Field71E setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field71E.NAME @@ -351,6 +336,4 @@ public static Field71E fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java b/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java index 0aaf8e5f0..0e24f8afe 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,20 @@ */ package com.prowidesoftware.swift.model.field; -import com.prowidesoftware.swift.model.Tag; -import com.prowidesoftware.Generated; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - +import com.prowidesoftware.swift.model.*; +import com.prowidesoftware.swift.model.Tag; import java.io.Serializable; -import java.util.Locale; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; - - -import com.prowidesoftware.swift.model.field.MultiLineField; - +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.lang3.StringUtils; -import com.prowidesoftware.swift.model.field.SwiftParseUtils; -import com.prowidesoftware.swift.model.field.Field; -import com.prowidesoftware.swift.model.*; -import com.prowidesoftware.swift.utils.SwiftFormatUtils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - /** * SWIFT MT Field 78B. *

    @@ -65,15 +54,15 @@ @Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field78B extends Field implements Serializable, MultiLineField { - /** - * Constant identifying the SRU to which this class belongs to. - */ - public static final int SRU = 2022; - - private static final long serialVersionUID = 1L; - /** - * Constant with the field name 78B. - */ + /** + * Constant identifying the SRU to which this class belongs to. + */ + public static final int SRU = 2022; + + private static final long serialVersionUID = 1L; + /** + * Constant with the field name 78B. + */ public static final String NAME = "78B"; /** * Same as NAME, intended to be clear when using static imports. @@ -85,26 +74,26 @@ public class Field78B extends Field implements Serializable, MultiLineField { */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String PARSER_PATTERN = "S"; + public static final String PARSER_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String COMPONENTS_PATTERN = "S"; + public static final String COMPONENTS_PATTERN = "S"; /** * @deprecated Use {@link #typesPattern()} method instead. */ @Deprecated @ProwideDeprecated(phase4 = TargetYear.SRU2024) - public static final String TYPES_PATTERN = "S"; + public static final String TYPES_PATTERN = "S"; - /** - * Component number for the Narrative subfield. - */ - public static final Integer NARRATIVE = 1; + /** + * Component number for the Narrative subfield. + */ + public static final Integer NARRATIVE = 1; /** * Default constructor. Creates a new field setting all components to null. @@ -133,7 +122,8 @@ public Field78B(final Tag tag) { throw new IllegalArgumentException("tag cannot be null."); } if (!StringUtils.equals(tag.getName(), "78B")) { - throw new IllegalArgumentException("cannot create field 78B from tag "+tag.getName()+", tagname must match the name of the field."); + throw new IllegalArgumentException("cannot create field 78B from tag " + tag.getName() + + ", tagname must match the name of the field."); } parse(tag.getValue()); } @@ -170,7 +160,6 @@ public static Tag emptyTag() { return new Tag(NAME, ""); } - /** * Parses the parameter value into the internal components structure. * @@ -211,7 +200,7 @@ public String getValueDisplay(int component, Locale locale) { throw new IllegalArgumentException("invalid component number " + component + " for field 78B"); } if (component == 1) { - //default format (as is) + // default format (as is) return getComponent(1); } return null; @@ -367,8 +356,6 @@ public Field78B setNarrative(String component1) { return setComponent1(component1); } - - /** * Returns the field's name composed by the field number and the letter option (if any). * @return the static value of Field78B.NAME @@ -539,6 +526,4 @@ public static Field78B fromJson(final String json) { return field; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/GenericField.java b/src/main/java/com/prowidesoftware/swift/model/field/GenericField.java index 2ca03e8ce..5763fa30d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/GenericField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/GenericField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.model.field; - /** * Interface to mark generic fields and add method related to DSS and qualifiers. * diff --git a/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountContainer.java index 65a2418d1..0bed0e75d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,5 +19,4 @@ * Fields with an amount component and a currency component. * @since 9.2.15 */ -public interface MonetaryAmountContainer extends CurrencyContainer, AmountContainer { -} +public interface MonetaryAmountContainer extends CurrencyContainer, AmountContainer {} diff --git a/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolver.java index 5778eab90..3538b91f7 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/prowidesoftware/swift/model/field/MultiLineField.java b/src/main/java/com/prowidesoftware/swift/model/field/MultiLineField.java index a09965e50..0300fbb4f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/MultiLineField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/MultiLineField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ import java.util.List; - /** * Interface to mark fields whose structure admits multiple lines and API to query the field lines. * @@ -101,5 +100,4 @@ public interface MultiLineField { * @since 7.7 */ List getLinesBetween(int start, int end, int offset); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Narrative.java b/src/main/java/com/prowidesoftware/swift/model/field/Narrative.java index af9999a98..0af74532a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Narrative.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Narrative.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,9 @@ import com.prowidesoftware.swift.io.writer.FINWriterVisitor; import com.prowidesoftware.swift.utils.LineWrapper; -import org.apache.commons.lang3.StringUtils; - import java.math.BigDecimal; import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Models the value of fields containing narrative content. The content is normally text wrapped in lines but they also @@ -82,8 +81,7 @@ public class Narrative { private List structured = new ArrayList<>(); private List unstructuredFragments = new ArrayList<>(); - Narrative() { - } + Narrative() {} private Narrative(Builder builder) { this.structured = builder.structured; @@ -289,8 +287,7 @@ public String getValue() { result.append(FINWriterVisitor.SWIFT_EOL); } // append mandatory codeword, even if it is empty (invalid) we will add the slashes - result - .append("/") + result.append("/") .append(StringUtils.trimToEmpty(structured.getCodeword())) .append("/"); @@ -335,7 +332,6 @@ public String getValue() { result.append(fragment); first = false; } - } // add the unstructured narrative at te end (one fragment per line with no separators) @@ -418,9 +414,8 @@ public Builder addCodewordWithAmount(String codeword, String currency, BigDecima * */ public Builder addCodewordWithCountry(String codeword, String country, String narrative) { - StructuredNarrative structured = new StructuredNarrative() - .setCodeword(codeword) - .setCountry(country); + StructuredNarrative structured = + new StructuredNarrative().setCodeword(codeword).setCountry(country); String countrySlash = country != null ? country + "//" : ""; String prefix = "/" + StringUtils.trim(codeword) + countrySlash; for (String fragment : wrap(prefix, narrative)) { @@ -534,5 +529,4 @@ public Narrative build() { return new Narrative(this); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainer.java index c9023e458..c9faf6d5f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,5 +50,4 @@ public interface NarrativeContainer { * @see Narrative#builder(int) */ NarrativeContainer setNarrative(Narrative narrative); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtils.java b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtils.java index 6a2160303..9af99dae1 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.prowidesoftware.swift.io.writer.FINWriterVisitor; - import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -30,8 +29,7 @@ */ class NarrativeContainerJsonUtils { - static Pattern NARRATIVE_PATTERN = - Pattern.compile("[\"|']narrative([0-9]*)[\"|']"); + static Pattern NARRATIVE_PATTERN = Pattern.compile("[\"|']narrative([0-9]*)[\"|']"); static void fromJson(JsonObject jsonObject, String json, StructuredNarrativeField field) { if (jsonObject.get("narrative") != null) { @@ -69,5 +67,4 @@ static int countNarrativesInJson(String json) { } return count; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeResolver.java b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeResolver.java index 83982a0ef..c984af08f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/NarrativeResolver.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/NarrativeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,12 @@ package com.prowidesoftware.swift.model.field; import com.prowidesoftware.swift.utils.IsoUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutableTriple; -import org.apache.commons.lang3.tuple.Triple; - import java.math.BigDecimal; import java.util.List; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutableTriple; +import org.apache.commons.lang3.tuple.Triple; /** * Implementation for {@link StructuredNarrativeField} @@ -30,7 +29,8 @@ * @since 9.0.1 */ public class NarrativeResolver { - private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(NarrativeResolver.class.getName()); + private static final java.util.logging.Logger log = + java.util.logging.Logger.getLogger(NarrativeResolver.class.getName()); private static final int CODEWORDTYPE_UCASE = 1; private static final int CODEWORDTYPE_UCASE_NUMBER = 2; @@ -55,7 +55,7 @@ public static Narrative parse(Field f) { case Field71D.NAME: case Field73.NAME: case Field71B.NAME: - case "71E": // SCORE field + case "71E": // SCORE field return parseFormat3(f); case Field77B.NAME: return parseFormat4(f); @@ -83,9 +83,14 @@ public static Narrative parse(Field f) { return new Narrative(); } - private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordType, boolean supportsCountry, - boolean supportsCurrency, boolean supportsSupplement, - boolean additionalNarrativesStartWithDoubleSlash) { + private static Narrative parseFormat( + Field f, + int codewordMaxSize, + int codewordType, + boolean supportsCountry, + boolean supportsCurrency, + boolean supportsSupplement, + boolean additionalNarrativesStartWithDoubleSlash) { // create an empty narrative, get the value and check there's something to do Narrative narrative = new Narrative(); @@ -109,7 +114,7 @@ private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordT if (valueLine.charAt(0) == '/') { String text; if (valueLine.length() > 1 && valueLine.charAt(1) == '/') { - //line starts with '//' + // line starts with '//' unstructuredSection = false; if (additionalNarrativesStartWithDoubleSlash) { // continuation of current narrative, remove '//' @@ -120,8 +125,7 @@ private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordT } else if (StringUtils.isNotEmpty(valueLine)) { structured.addNarrativeFragment(valueLine); } - } else - structured.addNarrativeFragment(valueLine); + } else structured.addNarrativeFragment(valueLine); } else { // new codeword String codeword = StringUtils.substringBetween(valueLine, "/", "/"); @@ -141,13 +145,14 @@ private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordT } String textWithoutBankCode = text; - if (text.length() > 1 && Character.isUpperCase(text.charAt(0)) && (text.charAt(1) == '/')){ + if (text.length() > 1 && Character.isUpperCase(text.charAt(0)) && (text.charAt(1) == '/')) { textWithoutBankCode = text.substring(2); - structured.setBankCode(text.substring(0,1)); + structured.setBankCode(text.substring(0, 1)); } if (supportsCurrency && isCurrencyAndAmount(textWithoutBankCode)) { - Triple tripleValue = getCurrencyAmountAndNarrative(textWithoutBankCode); + Triple tripleValue = + getCurrencyAmountAndNarrative(textWithoutBankCode); String currency = tripleValue.getLeft(); BigDecimal amount = tripleValue.getMiddle(); String narrativeFragment = tripleValue.getRight(); @@ -177,8 +182,7 @@ private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordT structured.addNarrativeFragment(valueLine); unstructuredSection = false; } - if (unstructuredSection) - narrative.addUnstructuredFragment(valueLine); + if (unstructuredSection) narrative.addUnstructuredFragment(valueLine); } return narrative; @@ -186,8 +190,7 @@ private static Narrative parseFormat(Field f, int codewordMaxSize, int codewordT static boolean isCurrencyAndAmount(String textWithoutBankCode) { - if (textWithoutBankCode.length() < 4) - return false; + if (textWithoutBankCode.length() < 4) return false; for (int i = 0; i < 3; i++) { if (!Character.isUpperCase(textWithoutBankCode.charAt(i))) { @@ -204,16 +207,17 @@ private static List notEmptyLines(String value) { .collect(Collectors.toList()); } - //returns true if it's the first supplement added - private static boolean addNarrativeSupplement(boolean firstSupplementAdded, String line, StructuredNarrative structured) { + // returns true if it's the first supplement added + private static boolean addNarrativeSupplement( + boolean firstSupplementAdded, String line, StructuredNarrative structured) { if (!firstSupplementAdded) { - //narrative + // narrative String text = StringUtils.substringBefore(line, "/"); if (StringUtils.isNotEmpty(text)) { structured.addNarrativeFragment(text); } - //first supplement + // first supplement text = StringUtils.substringAfter(line, "/"); if (StringUtils.isNotEmpty(text)) { structured.addNarrativeSupplementFragment(text); @@ -238,7 +242,8 @@ public static Narrative parseFreeFormat(String value) { return narrative; } - boolean structured = value.startsWith("/") && isCodewordValid(StringUtils.substringBefore(value.substring(1), "/"), CODEWORDTYPE_UCASE, -1); + boolean structured = value.startsWith("/") + && isCodewordValid(StringUtils.substringBefore(value.substring(1), "/"), CODEWORDTYPE_UCASE, -1); List lines = notEmptyLines(value); if (structured) { @@ -294,25 +299,20 @@ private static void add(Narrative narrative, String codeword, String text) { } private static boolean isCodewordValid(String codeword, int codewordType, int codewordMaxSize) { - if (StringUtils.isBlank(codeword)) - return false; + if (StringUtils.isBlank(codeword)) return false; codeword = StringUtils.trimToEmpty(codeword); - //Maxlength - if (codewordMaxSize > 0 && codeword.length() > codewordMaxSize) - return false; + // Maxlength + if (codewordMaxSize > 0 && codeword.length() > codewordMaxSize) return false; - //Type + // Type for (int i = 0; i < codeword.length(); i++) { char c = codeword.charAt(i); - if (!Character.isLetterOrDigit(c)) - return false; - else if (Character.isLowerCase(c) && (codewordType == CODEWORDTYPE_UCASE || codewordType == CODEWORDTYPE_UCASE_NUMBER)) - return false; - else if (Character.isLetter(c) && codewordType == CODEWORDTYPE_NUMBER) - return false; - else if (Character.isDigit(c) && codewordType == CODEWORDTYPE_UCASE) - return false; + if (!Character.isLetterOrDigit(c)) return false; + else if (Character.isLowerCase(c) + && (codewordType == CODEWORDTYPE_UCASE || codewordType == CODEWORDTYPE_UCASE_NUMBER)) return false; + else if (Character.isLetter(c) && codewordType == CODEWORDTYPE_NUMBER) return false; + else if (Character.isDigit(c) && codewordType == CODEWORDTYPE_UCASE) return false; } return true; @@ -320,8 +320,7 @@ else if (Character.isDigit(c) && codewordType == CODEWORDTYPE_UCASE) private static String getCountry(String text) { text = StringUtils.trimToEmpty(text); - if (!IsoUtils.getInstance().isValidISOCountry(text)) - return null; + if (!IsoUtils.getInstance().isValidISOCountry(text)) return null; return text; } @@ -335,31 +334,29 @@ private static Triple getCurrencyAmountAndNarrative( for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); switch (section) { - case 1: //currency section + case 1: // currency section if (Character.isDigit(c)) { section = 2; amount.append(c); - } else - currency.append(c); + } else currency.append(c); break; - case 2: //amount section - if (Character.isDigit(c) || c == '.' || c == ',') - amount.append(c == ',' ? '.' : c); + case 2: // amount section + if (Character.isDigit(c) || c == '.' || c == ',') amount.append(c == ',' ? '.' : c); else { section = 3; narrative.append(c); } break; - case 3: //narrative section + case 3: // narrative section narrative.append(c); break; } } - return new ImmutableTriple<> - (currency.length() == 0 ? null : currency.toString(), - amount.length() == 0 ? null : new BigDecimal(amount.toString()), - narrative.length() == 0 ? null : narrative.toString()); + return new ImmutableTriple<>( + currency.length() == 0 ? null : currency.toString(), + amount.length() == 0 ? null : new BigDecimal(amount.toString()), + narrative.length() == 0 ? null : narrative.toString()); } /** @@ -430,7 +427,5 @@ public static Narrative parseFormat7(Field f) { */ public static Narrative parseFormat8(String value) { return parseFreeFormat(value); - } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionAPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionAPartyField.java index 4a74a0f2e..9b126644d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionAPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionAPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,8 @@ import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Identifier Code @@ -145,7 +144,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -448,5 +447,4 @@ public List bicStrings() { result.add(getComponent(3)); return result; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionBPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionBPartyField.java index 658ea0142..f5798e1bc 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionBPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionBPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Branch of Sender/Receiver @@ -155,7 +154,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -388,5 +387,4 @@ public String getPartyIdentifier() { public OptionBPartyField setPartyIdentifier(String partyIdentifier) { return (OptionBPartyField) PartyIdentifierUtils.setPartyIdentifier(this, 1, 2, partyIdentifier); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionCPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionCPartyField.java index 9934b1194..488c48a79 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionCPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionCPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - import java.util.*; /** @@ -115,7 +114,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 1) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -270,5 +269,4 @@ public String getAccount() { } return null; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionDPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionDPartyField.java index 882f35028..4feaf579b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionDPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionDPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Name and Address @@ -151,7 +150,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 6) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -471,5 +470,4 @@ public String getPartyIdentifier() { public OptionDPartyField setPartyIdentifier(String partyIdentifier) { return (OptionDPartyField) PartyIdentifierUtils.setPartyIdentifier(this, 1, 2, partyIdentifier); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionGPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionGPartyField.java index cb538aa8f..20e5b61a9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionGPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionGPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.utils.SwiftFormatUtils; - import java.util.*; /** @@ -120,7 +119,8 @@ public String getValue() { result.append("/"); append(result, 1); if (getComponent2() != null) { - result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL).append(getComponent2()); + result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL) + .append(getComponent2()); } return result.toString(); } @@ -139,7 +139,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -365,5 +365,4 @@ public List bicStrings() { result.add(getComponent(2)); return result; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionHPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionHPartyField.java index 743427374..bb065003d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionHPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionHPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Name and Address @@ -141,7 +140,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 5) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -398,5 +397,4 @@ public String getComponent4() { public String getComponent5() { return getComponent(5); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionJPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionJPartyField.java index 6b960c7bb..9717f4f23 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionJPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionJPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Party Identification @@ -115,7 +114,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 1) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -313,5 +312,4 @@ public enum Codeword { NOSI, SVBY } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionKPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionKPartyField.java index 77bdf8e66..2142f6cfb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionKPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionKPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Name and Address @@ -135,7 +134,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 5) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -401,5 +400,4 @@ public String getComponent4() { public String getComponent5() { return getComponent(5); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionLPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionLPartyField.java index 371ae88b5..d44b07783 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionLPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionLPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - import java.util.*; /** @@ -114,7 +113,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 1) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -260,5 +259,4 @@ public String getComponent1() { public String getPartyIdentifier() { return getComponent(1); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionPPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionPPartyField.java index 3bb3ed35b..284372914 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionPPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionPPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.utils.SwiftFormatUtils; - import java.util.*; /** @@ -133,7 +132,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -353,5 +352,4 @@ public List bicStrings() { result.add(getComponent(2)); return result; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionQPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionQPartyField.java index 2661a58ce..489881204 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionQPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionQPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Party @@ -133,7 +132,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 5) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -387,5 +386,4 @@ public String getComponent4() { public String getComponent5() { return getComponent(5); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionRPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionRPartyField.java index ed8d1352c..6b02bf247 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionRPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionRPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - import java.util.*; /** @@ -133,7 +132,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -321,5 +320,4 @@ public String getComponent3() { public String getProprietaryCode() { return getComponent(3); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionSPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionSPartyField.java index aef978a81..d2534f4c0 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionSPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionSPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; - import java.util.*; /** @@ -152,7 +151,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 5) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -382,5 +381,4 @@ public String getComponent5() { public String getAlternateID() { return getComponent(5); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/OptionUPartyField.java b/src/main/java/com/prowidesoftware/swift/model/field/OptionUPartyField.java index 6a902f2d5..391c2eda4 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/OptionUPartyField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/OptionUPartyField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import com.prowidesoftware.deprecation.DeprecationUtils; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; -import org.apache.commons.lang3.StringUtils; - import java.util.*; +import org.apache.commons.lang3.StringUtils; /** * Party @@ -132,7 +131,7 @@ public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 4) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent(component); } @@ -362,5 +361,4 @@ public String getComponent3() { public String getComponent4() { return getComponent(4); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifier.java b/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifier.java index 260b74214..0ae65bcd7 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifier.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifier.java @@ -31,5 +31,4 @@ public interface PartyIdentifier { * @return the current OptionAPartyField */ PartyIdentifier setPartyIdentifier(String partyIdentifier); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifierUtils.java b/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifierUtils.java index 035fc8af0..028ee23de 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifierUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/PartyIdentifierUtils.java @@ -20,14 +20,14 @@ public static String getPartyIdentifier(Field field, int cdComponent, int accoun } // build the party identifier - return StringUtils.trimToNull( (cdPart != null ? cdPart : "") + (accountPart != null ? accountPart : "") ); + return StringUtils.trimToNull((cdPart != null ? cdPart : "") + (accountPart != null ? accountPart : "")); } public static Field setPartyIdentifier(Field field, int cdComponent, int accountComponent, String partyIdentifier) { // if party identifier is null or does not start with a "/" => set to empty partyIdentifier = StringUtils.trimToNull(partyIdentifier); - if (partyIdentifier == null || ! partyIdentifier.startsWith("/")) { + if (partyIdentifier == null || !partyIdentifier.startsWith("/")) { field.setComponent(cdComponent, null); field.setComponent(accountComponent, null); return field; @@ -37,7 +37,9 @@ public static Field setPartyIdentifier(Field field, int cdComponent, int account String dcMark = SwiftParseUtils.getTokenFirst(partyIdentifier, "/", "/"); if (StringUtils.isNotEmpty(dcMark)) { field.setComponent(cdComponent, dcMark); - field.setComponent(accountComponent, SwiftParseUtils.getTokenSecondLast(StringUtils.substring(partyIdentifier, 1), "/")); + field.setComponent( + accountComponent, + SwiftParseUtils.getTokenSecondLast(StringUtils.substring(partyIdentifier, 1), "/")); } else { field.setComponent(cdComponent, null); field.setComponent(accountComponent, StringUtils.substring(partyIdentifier, 1)); @@ -45,5 +47,4 @@ public static Field setPartyIdentifier(Field field, int cdComponent, int account return field; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/PatternContainer.java b/src/main/java/com/prowidesoftware/swift/model/field/PatternContainer.java index 5e8bc2d0b..29aea17eb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/PatternContainer.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/PatternContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,5 +20,4 @@ public interface PatternContainer { String typesPattern(); String parserPattern(); - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrative.java b/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrative.java index 69ee9ac50..f17da0e8b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrative.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrative.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ */ package com.prowidesoftware.swift.model.field; -import org.apache.commons.lang3.StringUtils; - import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.StringUtils; /** * Simple POJO for portions of structured text in narrative containers. @@ -78,8 +77,6 @@ StructuredNarrative setCurrency(String currency) { return this; } - - /** * In SCORE messages, in field 71B, there is a bank code within the codeword with a slash separator (i.e. C/USD). * This will get the bank code (i.e. C for the C/USD case). Or null if this is not possible. @@ -222,17 +219,21 @@ public String getNarrativeSupplement(String delimiter) { * @return true if non of the narrative fields are set */ public boolean isEmpty() { - return this.codeword == null && this.currency == null && this.amount == null && this.country == null - && this.narrativeFragments.isEmpty() && this.narrativeSupplementFragments.isEmpty(); + return this.codeword == null + && this.currency == null + && this.amount == null + && this.country == null + && this.narrativeFragments.isEmpty() + && this.narrativeSupplementFragments.isEmpty(); } /** * Basic validation to check the codeword is present and at least one of the other fields is present */ public boolean valid() { - return StringUtils.isNotBlank(this.codeword) && - (this.currency != null && this.amount != null || - this.country != null || !this.narrativeFragments.isEmpty()); + return StringUtils.isNotBlank(this.codeword) + && (this.currency != null && this.amount != null + || this.country != null + || !this.narrativeFragments.isEmpty()); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrativeField.java b/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrativeField.java index 33faac781..6a2a32e36 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrativeField.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/StructuredNarrativeField.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,9 @@ package com.prowidesoftware.swift.model.field; import com.prowidesoftware.deprecation.DeprecationUtils; -import com.google.gson.Gson; import com.prowidesoftware.deprecation.ProwideDeprecated; import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.io.writer.FINWriterVisitor; - import java.util.*; /** @@ -89,7 +87,7 @@ public String getValueDisplay(int component, Locale locale) { if (component != 1) { throw new IllegalArgumentException("invalid component number " + component + " for field " + getName()); } - //default format (as is) + // default format (as is) return getComponent1(); } @@ -272,5 +270,4 @@ public NarrativeContainer setNarrative(Narrative narrative) { setComponent(1, narrative.getValue()); return this; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/SwiftParseUtils.java b/src/main/java/com/prowidesoftware/swift/model/field/SwiftParseUtils.java index 222e8728c..84468d265 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/SwiftParseUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/SwiftParseUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,12 @@ package com.prowidesoftware.swift.model.field; import com.prowidesoftware.ProwideException; -import org.apache.commons.lang3.StringUtils; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; - +import org.apache.commons.lang3.StringUtils; /** * This class provides methods to parse field components. @@ -33,7 +31,8 @@ */ public class SwiftParseUtils { @SuppressWarnings("unused") - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftParseUtils.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftParseUtils.class.getName()); // Suppress default constructor for noninstantiability private SwiftParseUtils() { @@ -49,7 +48,7 @@ public static boolean isAllAsciiDigits(final String value) { if (value == null) { return false; } - for(char c : value.toCharArray()) { + for (char c : value.toCharArray()) { if (c < '0' || '9' < c) { return false; } @@ -76,7 +75,7 @@ public static List splitComponents(final String line, final String start if (StringUtils.isNotBlank(separator)) { final String[] tokens = StringUtils.splitByWholeSeparator(lineNoPrefix, separator); - //add not empty tokens to result + // add not empty tokens to result for (String token : tokens) { if (StringUtils.isNotBlank(token)) { result.add(token); @@ -140,7 +139,8 @@ public static String removePrefix(final String value, final String prefix) { * @return s */ public static String getTokenSecond(final String line, final String separator) { - //notice we cannot use String.split nor StringUtils.split because in that implementations two adjacent separators are treated as one + // notice we cannot use String.split nor StringUtils.split because in that implementations two adjacent + // separators are treated as one return getTokenFirst(StringUtils.substringAfter(line, separator), null, separator); } @@ -324,7 +324,8 @@ public static String getAlphaPrefixTrimSlash(final String value) { public static String getNumericPrefix(final String value) { if (value != null && value.length() > 0) { int i = 0; - while (i < value.length() && (StringUtils.isNumeric(Character.toString(value.charAt(i))) || value.charAt(i) == ',')) { + while (i < value.length() + && (StringUtils.isNumeric(Character.toString(value.charAt(i))) || value.charAt(i) == ',')) { i++; } if (i > 0) { @@ -368,7 +369,8 @@ public static String getNumericSuffix(final String value) { public static String getAlphaSuffix(final String value) { if (value != null && value.length() > 0) { int i = 0; - while (i < value.length() && (StringUtils.isNumeric(Character.toString(value.charAt(i))) || value.charAt(i) == ',')) { + while (i < value.length() + && (StringUtils.isNumeric(Character.toString(value.charAt(i))) || value.charAt(i) == ',')) { i++; } if (i < value.length()) { @@ -411,7 +413,12 @@ public static List getLines(final String value) { * @param startingLine lines list offset, zero based * @param lines list of lines from where to get components content */ - public static void setComponentsFromLines(final Field f, final int startingComponentNumber, final Integer linesToSet, final int startingLine, final List lines) { + public static void setComponentsFromLines( + final Field f, + final int startingComponentNumber, + final Integer linesToSet, + final int startingLine, + final List lines) { int max = linesToSet != null ? linesToSet : lines.size(); int componentNumber = startingComponentNumber; int lineNumber = startingLine; @@ -434,12 +441,17 @@ public static void setComponentsFromLines(final Field f, final int startingCompo * @param value from where to get components content * @since 7.4 */ - public static void setComponentsFromTokens(final Field f, final int startingComponentNumber, final int componentsToSet, final int tokenSize, final String value) { + public static void setComponentsFromTokens( + final Field f, + final int startingComponentNumber, + final int componentsToSet, + final int tokenSize, + final String value) { StringBuilder token = new StringBuilder(); int componentNumber = startingComponentNumber; for (final char c : value.toCharArray()) { if (token.length() >= tokenSize) { - //token complete + // token complete if (componentNumber <= componentsToSet) { f.setComponent(componentNumber, token.toString()); } @@ -448,10 +460,9 @@ public static void setComponentsFromTokens(final Field f, final int startingComp } token.append(c); } - //add remainder + // add remainder if (token.length() > 0 && componentNumber <= componentsToSet) { f.setComponent(componentNumber, token.toString()); } } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/field/package-info.java b/src/main/java/com/prowidesoftware/swift/model/field/package-info.java index 1169b2094..bfeedf92d 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,4 +21,4 @@ *

    The constructor of each field class accepts the field's literal value and parses its content into a list of components with a simple and generic API of getComponent1() ... getComponentN().
    * Components are modeled as string, but if the component represents a date or number, additional API is provided to get the component parsed into a Calendar and Number with methods like getComponent1AsCalendar() and getComponent3AsNumber(). */ -package com.prowidesoftware.swift.model.field; \ No newline at end of file +package com.prowidesoftware.swift.model.field; diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMT.java b/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMT.java index 82c2b6052..048edd1fc 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMT.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMT.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.utils.Lib; -import org.apache.commons.lang3.StringUtils; - import java.io.*; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; @@ -35,7 +33,7 @@ import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; - +import org.apache.commons.lang3.StringUtils; /** * Base class for specific MTs.
    @@ -584,7 +582,8 @@ public List getSequenceList(final String name) { * @since 7.8.1 */ @SuppressWarnings("unchecked") - public /* cant make static, but should be */ List getSequenceList(final String name, final SwiftTagListBlock block) { + public /* cant make static, but should be */ List getSequenceList( + final String name, final SwiftTagListBlock block) { final String methodName = GETSEQUENCE + name + "List"; return (List) invokeHere(methodName, this, block); } @@ -629,8 +628,8 @@ public boolean containsSequence(final String name) { */ private Object invokeHere(final String methodName, final Object where, final SwiftTagListBlock argument) { try { - final Method method = argument == null ? - getClass().getMethod(methodName) + final Method method = argument == null + ? getClass().getMethod(methodName) : getClass().getMethod(methodName, SwiftTagListBlock.class); if (argument == null) { return method.invoke(where); @@ -672,7 +671,8 @@ public SwiftTagListBlock getSequence(final String name) { * @return found sequence or empty sequence block * @since 7.8.1 */ - public /* cant make static, but should be */ SwiftTagListBlock getSequence(final String name, final SwiftTagListBlock block) { + public /* cant make static, but should be */ SwiftTagListBlock getSequence( + final String name, final SwiftTagListBlock block) { final String methodName = GETSEQUENCE + name; Object o = invokeHere(methodName, this, block); return (SwiftTagListBlock) o; @@ -724,8 +724,7 @@ public AbstractMT setSignature(String signature) { */ public AbstractMT append(final SwiftTagListBlock block) { Objects.requireNonNull(block); - if (!block.isEmpty()) - b4().addTags(block.getTags()); + if (!block.isEmpty()) b4().addTags(block.getTags()); return this; } @@ -925,5 +924,4 @@ public List getFields() { } return fields; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMTAdapter.java b/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMTAdapter.java index 800d1dd49..66a623336 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMTAdapter.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/AbstractMTAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.google.gson.*; import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.model.field.Field; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; @@ -78,7 +77,12 @@ public JsonElement serialize(AbstractMT src, Type typeOfSrc, JsonSerializationCo if (src.m.getBlock5() != null && !src.m.getBlock5().getTags().isEmpty()) { // default serialization from SwiftMessage with tags renamed to fields - JsonArray tags = o.get("data").getAsJsonObject().get("block5").getAsJsonObject().get("tags").getAsJsonArray(); + JsonArray tags = o.get("data") + .getAsJsonObject() + .get("block5") + .getAsJsonObject() + .get("tags") + .getAsJsonArray(); JsonObject trailer = new JsonObject(); trailer.add("fields", tags); response.add(BLOCK5_FINAL_NAME, trailer); @@ -88,16 +92,20 @@ public JsonElement serialize(AbstractMT src, Type typeOfSrc, JsonSerializationCo } @Override - public AbstractMT deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + public AbstractMT deserialize( + JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException { JsonObject jsonObject = jsonElement.getAsJsonObject(); SwiftMessage swiftMessage = new SwiftMessage(); - SwiftBlock1 block1 = jsonDeserializationContext.deserialize(jsonObject.get(BLOCK1_FINAL_NAME), SwiftBlock1.class); + SwiftBlock1 block1 = + jsonDeserializationContext.deserialize(jsonObject.get(BLOCK1_FINAL_NAME), SwiftBlock1.class); if (block1 != null) { swiftMessage.addBlock(block1); } - SwiftBlock2 block2 = jsonDeserializationContext.deserialize(jsonObject.get(BLOCK2_FINAL_NAME), SwiftBlock2.class); + SwiftBlock2 block2 = + jsonDeserializationContext.deserialize(jsonObject.get(BLOCK2_FINAL_NAME), SwiftBlock2.class); if (block2 != null) { swiftMessage.addBlock(block2); } @@ -176,6 +184,4 @@ private JsonArray getFieldsFromTags(List tags) { } return fields; } - } - diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/DefaultMtMetadataStrategy.java b/src/main/java/com/prowidesoftware/swift/model/mt/DefaultMtMetadataStrategy.java index 5488cd690..cdc93efc1 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/DefaultMtMetadataStrategy.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/DefaultMtMetadataStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,7 @@ */ package com.prowidesoftware.swift.model.mt; - import com.prowidesoftware.swift.model.*; - import java.util.Calendar; import java.util.Optional; @@ -68,5 +66,4 @@ private SwiftMessage asSwiftMessage(AbstractMessage message) { } return null; } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/MTVariant.java b/src/main/java/com/prowidesoftware/swift/model/mt/MTVariant.java index a52e313cb..747c4742e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/MTVariant.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/MTVariant.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,5 +59,4 @@ public static Optional extract(String text) { } return Optional.empty(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/MtCategory.java b/src/main/java/com/prowidesoftware/swift/model/mt/MtCategory.java index 8d6558e0a..6d916e2d6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/MtCategory.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/MtCategory.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,5 +72,4 @@ public final String description() { public final String number() { return this.name().substring(1); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/SequenceUtils.java b/src/main/java/com/prowidesoftware/swift/model/mt/SequenceUtils.java index 70f6707d9..c6b5d8f2e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/SequenceUtils.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/SequenceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package com.prowidesoftware.swift.model.mt; +import static com.prowidesoftware.swift.model.SwiftMessageUtils.join; + import com.prowidesoftware.swift.model.SwiftTagListBlock; import com.prowidesoftware.swift.model.field.Field16R; import com.prowidesoftware.swift.model.field.Field16S; @@ -22,15 +24,11 @@ import com.prowidesoftware.swift.model.mt.mt5xx.MT537.SequenceB; import com.prowidesoftware.swift.model.mt.mt6xx.MT670; import com.prowidesoftware.swift.model.mt.mt6xx.MT671; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; -import static com.prowidesoftware.swift.model.SwiftMessageUtils.join; - - /** * DO NOT USE. All methods in this class may be removed without prior advice. * Use those MTxxx.getSequenceX directly instead. @@ -47,10 +45,10 @@ private SequenceUtils() { throw new AssertionError(); } - public static List resolveMT535GetSequenceB1b1List_sru2023(final MT535 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB1bList(), MT535.SequenceB1b1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB1bList(), MT535.SequenceB1b1.START_END_16RS)) { final MT535.SequenceB1b1 s = MT535.SequenceB1b1.newInstance(); s.clear().append(seq); result.add(s); @@ -60,7 +58,8 @@ public static List resolveMT535GetSequenceB1b1List_sru2023(f public static List resolveMT535GetSequenceB1cList_sru2023(final MT535 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB1List(), MT535.SequenceB1c.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB1List(), MT535.SequenceB1c.START_END_16RS)) { final MT535.SequenceB1c s = MT535.SequenceB1c.newInstance(); s.clear().append(seq); result.add(s); @@ -70,7 +69,8 @@ public static List resolveMT535GetSequenceB1cList_sru2023(fin public static List resolveMT536GetSequenceA1List_sru2023(final MT536 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT536.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT536.SequenceA1.START_END_16RS)) { final MT536.SequenceA1 s = MT536.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -80,7 +80,8 @@ public static List resolveMT536GetSequenceA1List_sru2023(final public static List resolveMT536GetSequenceB1a1List_sru2023(final MT536 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT536.SequenceB1a1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT536.SequenceB1a1.START_END_16RS)) { final MT536.SequenceB1a1 s = MT536.SequenceB1a1.newInstance(); s.clear().append(seq); result.add(s); @@ -90,7 +91,8 @@ public static List resolveMT536GetSequenceB1a1List_sru2023(f public static List resolveMT537GetSequenceA1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT537.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT537.SequenceA1.START_END_16RS)) { final MT537.SequenceA1 s = MT537.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -111,8 +113,7 @@ public static List resolveMT537GetSequenceBList_sru2023(final S // We first remove everything after and including C or D // Then we use use the standard getter for B - List raw = mt - .getSubBlockBeforeFirst(Field16R.tag(MT537.SequenceC.START_END_16RS), false) + List raw = mt.getSubBlockBeforeFirst(Field16R.tag(MT537.SequenceC.START_END_16RS), false) .getSubBlockBeforeFirst(Field16R.tag(MT537.SequenceD.START_END_16RS), false) .getSubBlocks(MT537.SequenceB.START_END_16RS); @@ -131,7 +132,8 @@ public static List resolveMT537GetSequenceBList_sru2023(final S public static List resolveMT537GetSequenceB1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceBList(), MT537.SequenceB1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceBList(), MT537.SequenceB1.START_END_16RS)) { final MT537.SequenceB1 s = MT537.SequenceB1.newInstance(); s.clear().append(seq); result.add(s); @@ -141,7 +143,8 @@ public static List resolveMT537GetSequenceB1List_sru2023(final public static List resolveMT537GetSequenceB2List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceBList(), MT537.SequenceB2.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceBList(), MT537.SequenceB2.START_END_16RS)) { final MT537.SequenceB2 s = MT537.SequenceB2.newInstance(); s.clear().append(seq); result.add(s); @@ -151,7 +154,8 @@ public static List resolveMT537GetSequenceB2List_sru2023(final public static List resolveMT537GetSequenceB2aList_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB2List(), MT537.SequenceB2a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB2List(), MT537.SequenceB2a.START_END_16RS)) { final MT537.SequenceB2a s = MT537.SequenceB2a.newInstance(); s.clear().append(seq); result.add(s); @@ -161,7 +165,8 @@ public static List resolveMT537GetSequenceB2aList_sru2023(fin public static List resolveMT537GetSequenceB2bList_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB2List(), MT537.SequenceB2b.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB2List(), MT537.SequenceB2b.START_END_16RS)) { final MT537.SequenceB2b s = MT537.SequenceB2b.newInstance(); s.clear().append(seq); result.add(s); @@ -171,7 +176,8 @@ public static List resolveMT537GetSequenceB2bList_sru2023(fin public static List resolveMT537GetSequenceB2b1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB2bList(), MT537.SequenceB2b1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB2bList(), MT537.SequenceB2b1.START_END_16RS)) { final MT537.SequenceB2b1 s = MT537.SequenceB2b1.newInstance(); s.clear().append(seq); result.add(s); @@ -181,7 +187,8 @@ public static List resolveMT537GetSequenceB2b1List_sru2023(f public static List resolveMT537GetSequenceC1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC1.START_END_16RS)) { final MT537.SequenceC1 s = MT537.SequenceC1.newInstance(); s.clear().append(seq); result.add(s); @@ -191,7 +198,8 @@ public static List resolveMT537GetSequenceC1List_sru2023(final public static List resolveMT537GetSequenceC2List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC2.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC2.START_END_16RS)) { final MT537.SequenceC2 s = MT537.SequenceC2.newInstance(); s.clear().append(seq); result.add(s); @@ -201,7 +209,8 @@ public static List resolveMT537GetSequenceC2List_sru2023(final public static List resolveMT537GetSequenceC2aList_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceC2List(), MT537.SequenceC2a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceC2List(), MT537.SequenceC2a.START_END_16RS)) { final MT537.SequenceC2a s = MT537.SequenceC2a.newInstance(); s.clear().append(seq); result.add(s); @@ -211,7 +220,8 @@ public static List resolveMT537GetSequenceC2aList_sru2023(fin public static List resolveMT537GetSequenceC3List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC3.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceCList(), MT537.SequenceC3.START_END_16RS)) { final MT537.SequenceC3 s = MT537.SequenceC3.newInstance(); s.clear().append(seq); result.add(s); @@ -221,7 +231,8 @@ public static List resolveMT537GetSequenceC3List_sru2023(final public static List resolveMT537GetSequenceC3aList_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceC3List(), MT537.SequenceC3a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceC3List(), MT537.SequenceC3a.START_END_16RS)) { final MT537.SequenceC3a s = MT537.SequenceC3a.newInstance(); s.clear().append(seq); result.add(s); @@ -236,7 +247,8 @@ public static List resolveMT537GetSequenceC3aList_sru2023(fin */ public static List resolveMT537GetSequenceD1a1B1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceD1a1BList(), MT537.SequenceD1a1B1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceD1a1BList(), MT537.SequenceD1a1B1.START_END_16RS)) { final MT537.SequenceD1a1B1 s = MT537.SequenceD1a1B1.newInstance(); s.clear().append(seq); result.add(s); @@ -251,7 +263,8 @@ public static List resolveMT537GetSequenceD1a1B1List_sru20 */ public static List resolveMT537GetSequenceD1a1B1aList_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceD1a1B1List(), MT537.SequenceD1a1B1a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceD1a1B1List(), MT537.SequenceD1a1B1a.START_END_16RS)) { final MT537.SequenceD1a1B1a s = MT537.SequenceD1a1B1a.newInstance(); s.clear().append(seq); result.add(s); @@ -266,7 +279,8 @@ public static List resolveMT537GetSequenceD1a1B1aList_sru */ public static List resolveMT537GetSequenceD1a1B1a1List_sru2023(final MT537 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceD1a1B1aList(), MT537.SequenceD1a1B1a1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceD1a1B1aList(), MT537.SequenceD1a1B1a1.START_END_16RS)) { final MT537.SequenceD1a1B1a1 s = MT537.SequenceD1a1B1a1.newInstance(); s.clear().append(seq); result.add(s); @@ -276,7 +290,8 @@ public static List resolveMT537GetSequenceD1a1B1a1List_s public static List resolveMT538GetSequenceA1List_sru2023(final MT538 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT538.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT538.SequenceA1.START_END_16RS)) { final MT538.SequenceA1 s = MT538.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -286,7 +301,8 @@ public static List resolveMT538GetSequenceA1List_sru2023(final public static List resolveMT538GetSequenceB2a1List_sru2023(final MT538 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB2aList(), MT538.SequenceB2a1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB2aList(), MT538.SequenceB2a1.START_END_16RS)) { final MT538.SequenceB2a1 s = MT538.SequenceB2a1.newInstance(); s.clear().append(seq); result.add(s); @@ -296,7 +312,8 @@ public static List resolveMT538GetSequenceB2a1List_sru2023(f public static List resolveMT548GetSequenceA2List_sru2023(final MT548 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT548.SequenceA2.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT548.SequenceA2.START_END_16RS)) { final MT548.SequenceA2 s = MT548.SequenceA2.newInstance(); s.clear().append(seq); result.add(s); @@ -306,7 +323,8 @@ public static List resolveMT548GetSequenceA2List_sru2023(final public static List resolveMT548GetSequenceA2aList_sru2023(final MT548 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA2List(), MT548.SequenceA2a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA2List(), MT548.SequenceA2a.START_END_16RS)) { final MT548.SequenceA2a s = MT548.SequenceA2a.newInstance(); s.clear().append(seq); result.add(s); @@ -321,7 +339,8 @@ public static List resolveMT548GetSequenceA2aList_sru2023(fin */ public static List resolveMT548GetSequenceC1a1B1aList_sru2023(final MT548 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceC1a1B1List(), MT548.SequenceC1a1B1a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceC1a1B1List(), MT548.SequenceC1a1B1a.START_END_16RS)) { final MT548.SequenceC1a1B1a s = MT548.SequenceC1a1B1a.newInstance(); s.clear().append(seq); result.add(s); @@ -336,7 +355,8 @@ public static List resolveMT548GetSequenceC1a1B1aList_sru */ public static List resolveMT548GetSequenceC1a1B1a1List_sru2023(final MT548 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceC1a1B1aList(), MT548.SequenceC1a1B1a1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceC1a1B1aList(), MT548.SequenceC1a1B1a1.START_END_16RS)) { final MT548.SequenceC1a1B1a1 s = MT548.SequenceC1a1B1a1.newInstance(); s.clear().append(seq); result.add(s); @@ -354,7 +374,8 @@ public static MT564.SequenceB1 resolveMT564GetSequenceB1_sru2023(final MT564 mt) public static List resolveMT564GetSequenceE1aList_sru2023(final MT564 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceE1List(), MT564.SequenceE1a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceE1List(), MT564.SequenceE1a.START_END_16RS)) { final MT564.SequenceE1a s = MT564.SequenceE1a.newInstance(); s.clear().append(seq); result.add(s); @@ -372,7 +393,8 @@ public static MT566.SequenceB1 resolveMT566GetSequenceB1_sru2023(final MT566 mt) public static List resolveMT566GetSequenceD1aList_sru2023(final MT566 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceD1List(), MT566.SequenceD1a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceD1List(), MT566.SequenceD1a.START_END_16RS)) { final MT566.SequenceD1a s = MT566.SequenceD1a.newInstance(); s.clear().append(seq); result.add(s); @@ -382,7 +404,8 @@ public static List resolveMT566GetSequenceD1aList_sru2023(fin public static List resolveMT575GetSequenceA1List_sru2023(final MT575 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT575.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT575.SequenceA1.START_END_16RS)) { final MT575.SequenceA1 s = MT575.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -392,7 +415,8 @@ public static List resolveMT575GetSequenceA1List_sru2023(final public static List resolveMT575GetSequenceB1a1List_sru2023(final MT575 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT575.SequenceB1a1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT575.SequenceB1a1.START_END_16RS)) { final MT575.SequenceB1a1 s = MT575.SequenceB1a1.newInstance(); s.clear().append(seq); result.add(s); @@ -402,7 +426,8 @@ public static List resolveMT575GetSequenceB1a1List_sru2023(f public static List resolveMT575GetSequenceB1a4List_sru2023(final MT575 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT575.SequenceB1a4.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB1aList(), MT575.SequenceB1a4.START_END_16RS)) { final MT575.SequenceB1a4 s = MT575.SequenceB1a4.newInstance(); s.clear().append(seq); result.add(s); @@ -412,7 +437,8 @@ public static List resolveMT575GetSequenceB1a4List_sru2023(f public static List resolveMT575GetSequenceC1List_sru2023(final MT575 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceCList(), MT575.SequenceC1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceCList(), MT575.SequenceC1.START_END_16RS)) { final MT575.SequenceC1 s = MT575.SequenceC1.newInstance(); s.clear().append(seq); result.add(s); @@ -422,7 +448,8 @@ public static List resolveMT575GetSequenceC1List_sru2023(final public static List resolveMT575GetSequenceC2aList_sru2023(final MT575 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceC2List(), MT575.SequenceC2a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceC2List(), MT575.SequenceC2a.START_END_16RS)) { final MT575.SequenceC2a s = MT575.SequenceC2a.newInstance(); s.clear().append(seq); result.add(s); @@ -432,7 +459,8 @@ public static List resolveMT575GetSequenceC2aList_sru2023(fin public static List resolveMT576GetSequenceA1List_sru2023(final MT576 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT576.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT576.SequenceA1.START_END_16RS)) { final MT576.SequenceA1 s = MT576.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -442,7 +470,8 @@ public static List resolveMT576GetSequenceA1List_sru2023(final public static List resolveMT576GetSequenceB2aList_sru2023(final MT576 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceB2List(), MT576.SequenceB2a.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceB2List(), MT576.SequenceB2a.START_END_16RS)) { final MT576.SequenceB2a s = MT576.SequenceB2a.newInstance(); s.clear().append(seq); result.add(s); @@ -452,7 +481,8 @@ public static List resolveMT576GetSequenceB2aList_sru2023(fin public static List resolveMT586GetSequenceA1List_sru2023(final MT586 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceA(), MT586.SequenceA1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceA(), MT586.SequenceA1.START_END_16RS)) { final MT586.SequenceA1 s = MT586.SequenceA1.newInstance(); s.clear().append(seq); result.add(s); @@ -462,7 +492,8 @@ public static List resolveMT586GetSequenceA1List_sru2023(final public static List resolveMT586GetSequenceB1List_sru2023(final MT586 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceBList(), MT586.SequenceB1.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceBList(), MT586.SequenceB1.START_END_16RS)) { final MT586.SequenceB1 s = MT586.SequenceB1.newInstance(); s.clear().append(seq); result.add(s); @@ -472,7 +503,8 @@ public static List resolveMT586GetSequenceB1List_sru2023(final public static List resolveMT670GetSequenceB2List_sru2023(final MT670 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceBList(), MT670.SequenceB2.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceBList(), MT670.SequenceB2.START_END_16RS)) { final MT670.SequenceB2 s = MT670.SequenceB2.newInstance(); s.clear().append(seq); result.add(s); @@ -489,7 +521,8 @@ public static MT670.SequenceC resolveMT670GetSequenceC_sru2023(final MT670 mt) { public static List resolveMT671GetSequenceB2List_sru2023(final MT671 mt) { final List result = new ArrayList<>(); - for (final SwiftTagListBlock seq : resolveNotUniqueSeparator(mt.getSequenceBList(), MT671.SequenceB2.START_END_16RS)) { + for (final SwiftTagListBlock seq : + resolveNotUniqueSeparator(mt.getSequenceBList(), MT671.SequenceB2.START_END_16RS)) { final MT671.SequenceB2 s = MT671.SequenceB2.newInstance(); s.clear().append(seq); result.add(s); @@ -505,7 +538,8 @@ public static MT671.SequenceC resolveMT671GetSequenceC_sru2023(final MT671 mt) { } private static SwiftTagListBlock getMT670_1_C(final SwiftTagListBlock b4, final String B_startEnd16rs) { - // Since B contains inside a colliding sequence, with same delimiter as sequence C, if B is present we remove it to avoid ambiguity + // Since B contains inside a colliding sequence, with same delimiter as sequence C, if B is present we remove it + // to avoid ambiguity final int last = b4.indexOfLastValue(Field16S.NAME, B_startEnd16rs); if (last >= 0) { if (last + 1 == b4.size()) { @@ -519,7 +553,8 @@ private static SwiftTagListBlock getMT670_1_C(final SwiftTagListBlock b4, final return b4; } - private static List resolveNotUniqueSeparator(List allParent, String separator) { + private static List resolveNotUniqueSeparator( + List allParent, String separator) { return resolveNotUniqueSeparator(join(allParent), separator); } @@ -529,5 +564,4 @@ private static List resolveNotUniqueSeparator(SwiftTagListBlo } return Collections.emptyList(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/ServiceIdType.java b/src/main/java/com/prowidesoftware/swift/model/mt/ServiceIdType.java index 95efee914..d2e483896 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/ServiceIdType.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/ServiceIdType.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,5 +84,4 @@ public String description() { public final String number() { return this.name().substring(1); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/ServiceMessage21.java b/src/main/java/com/prowidesoftware/swift/model/mt/ServiceMessage21.java index 66c1539c9..d4552c072 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/ServiceMessage21.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/ServiceMessage21.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,10 @@ import com.prowidesoftware.swift.model.field.Field405; import com.prowidesoftware.swift.model.field.Field451; import com.prowidesoftware.swift.utils.Lib; -import org.apache.commons.lang3.Validate; - import java.io.File; import java.io.IOException; import java.io.InputStream; +import org.apache.commons.lang3.Validate; /** * Generic MT representation for service messages with service id 21 = GPA/FIN Message (ACK/NAK/UAK/UNK). @@ -198,8 +197,7 @@ public final boolean isNack() { */ public String getErrorCode() { Field405 f = getField405(); - if (f == null) - return null; + if (f == null) return null; return f.getReasonForRejection(); } @@ -210,8 +208,7 @@ public String getErrorCode() { */ public String getErrorLine() { Field405 f = getField405(); - if (f == null) - return null; + if (f == null) return null; return f.getLineFieldNumber(); } @@ -281,5 +278,4 @@ public Field108 getField108() { public MtId getMtId() { return mtId(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/model/mt/package-info.java b/src/main/java/com/prowidesoftware/swift/model/mt/package-info.java index a54140292..c181c55ba 100644 --- a/src/main/java/com/prowidesoftware/swift/model/mt/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/model/mt/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Base package for classes that model SWIFT MTs. */ -package com.prowidesoftware.swift.model.mt; \ No newline at end of file +package com.prowidesoftware.swift.model.mt; diff --git a/src/main/java/com/prowidesoftware/swift/model/package-info.java b/src/main/java/com/prowidesoftware/swift/model/package-info.java index 2a4295806..b72995fee 100644 --- a/src/main/java/com/prowidesoftware/swift/model/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/model/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Core package with classes that model SWIFT messages. */ -package com.prowidesoftware.swift.model; \ No newline at end of file +package com.prowidesoftware.swift.model; diff --git a/src/main/java/com/prowidesoftware/swift/package-info.java b/src/main/java/com/prowidesoftware/swift/package-info.java index 7ed12ef29..c81c5dfdc 100644 --- a/src/main/java/com/prowidesoftware/swift/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * General purpose utility classes for the swift model */ -package com.prowidesoftware.swift; \ No newline at end of file +package com.prowidesoftware.swift; diff --git a/src/main/java/com/prowidesoftware/swift/utils/AckMessageComparator.java b/src/main/java/com/prowidesoftware/swift/utils/AckMessageComparator.java index 7c29d5b28..51f19a78e 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/AckMessageComparator.java +++ b/src/main/java/com/prowidesoftware/swift/utils/AckMessageComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,5 +33,4 @@ public AckMessageComparator() { super.ignoreHeaderSession = true; super.ignoreBlock2OptionalFields = true; } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/BaseMessageVisitor.java b/src/main/java/com/prowidesoftware/swift/utils/BaseMessageVisitor.java index 327be1714..0152931f1 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/BaseMessageVisitor.java +++ b/src/main/java/com/prowidesoftware/swift/utils/BaseMessageVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,87 +23,66 @@ * * @author sebastian */ -//TODO: complete javadocs +// TODO: complete javadocs public class BaseMessageVisitor implements IMessageVisitor { @Override - public void startBlock1(SwiftBlock1 b) { - } + public void startBlock1(SwiftBlock1 b) {} @Override - public void startBlock2(SwiftBlock2 b) { - } + public void startBlock2(SwiftBlock2 b) {} @Override - public void startBlock3(SwiftBlock3 b) { - } + public void startBlock3(SwiftBlock3 b) {} @Override - public void startBlock4(SwiftBlock4 b) { - } + public void startBlock4(SwiftBlock4 b) {} @Override - public void startBlock5(SwiftBlock5 b) { - } + public void startBlock5(SwiftBlock5 b) {} @Override - public void startBlockUser(SwiftBlockUser b) { - } + public void startBlockUser(SwiftBlockUser b) {} @Override - public void endBlock1(SwiftBlock1 b) { - } + public void endBlock1(SwiftBlock1 b) {} @Override - public void endBlock2(SwiftBlock2 b) { - } + public void endBlock2(SwiftBlock2 b) {} @Override - public void endBlock3(SwiftBlock3 b) { - } + public void endBlock3(SwiftBlock3 b) {} @Override - public void endBlock4(SwiftBlock4 b) { - } + public void endBlock4(SwiftBlock4 b) {} @Override - public void endBlock5(SwiftBlock5 b) { - } + public void endBlock5(SwiftBlock5 b) {} @Override - public void endBlockUser(SwiftBlockUser b) { - } + public void endBlockUser(SwiftBlockUser b) {} @Override - public void tag(SwiftBlock3 b, Tag t) { - } + public void tag(SwiftBlock3 b, Tag t) {} @Override - public void tag(SwiftBlock4 b, Tag t) { - } + public void tag(SwiftBlock4 b, Tag t) {} @Override - public void tag(SwiftBlock5 b, Tag t) { - } + public void tag(SwiftBlock5 b, Tag t) {} @Override - public void tag(SwiftBlockUser b, Tag t) { - } + public void tag(SwiftBlockUser b, Tag t) {} @Override - public void value(SwiftBlock1 b, String v) { - } + public void value(SwiftBlock1 b, String v) {} @Override - public void value(SwiftBlock2 b, String v) { - } + public void value(SwiftBlock2 b, String v) {} @Override - public void endMessage(SwiftMessage m) { - } + public void endMessage(SwiftMessage m) {} @Override - public void startMessage(SwiftMessage m) { - } - + public void startMessage(SwiftMessage m) {} } diff --git a/src/main/java/com/prowidesoftware/swift/utils/IMessageVisitor.java b/src/main/java/com/prowidesoftware/swift/utils/IMessageVisitor.java index 24ed9413f..97bfed19c 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/IMessageVisitor.java +++ b/src/main/java/com/prowidesoftware/swift/utils/IMessageVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,5 +116,4 @@ public interface IMessageVisitor { void startMessage(SwiftMessage m); void endMessage(SwiftMessage m); - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/IsoUtils.java b/src/main/java/com/prowidesoftware/swift/utils/IsoUtils.java index c46631765..ff3d75f9d 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/IsoUtils.java +++ b/src/main/java/com/prowidesoftware/swift/utils/IsoUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ */ package com.prowidesoftware.swift.utils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; - import java.util.*; import java.util.logging.Logger; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; /** * Helper API to check country and currency codes using Java {@link Currency} and {@link Locale} API. @@ -48,7 +47,8 @@ private IsoUtils() { countries = new HashSet<>(Arrays.asList(Locale.getISOCountries())); - log.fine("IsoUtils initialized with " + currencies.size() + " currency codes and " + countries.size() + " country codes"); + log.fine("IsoUtils initialized with " + currencies.size() + " currency codes and " + countries.size() + + " country codes"); } public static IsoUtils getInstance() { @@ -109,7 +109,9 @@ private boolean isUserAssignedCountryCode(String code) { * @since 7.9.7 */ public void addCountry(final String countryCode) { - Validate.isTrue(countryCode != null && countryCode.length() == 2 && countryCode.matches("[A-Z]*"), "The country code must by indicated with two uppercase letters"); + Validate.isTrue( + countryCode != null && countryCode.length() == 2 && countryCode.matches("[A-Z]*"), + "The country code must by indicated with two uppercase letters"); countries.add(countryCode); } @@ -121,8 +123,9 @@ public void addCountry(final String countryCode) { * @since 7.9.7 */ public void addCurrency(final String currencyCode) { - Validate.isTrue(currencyCode != null && currencyCode.length() == 3 && currencyCode.matches("[A-Z]*"), "The currency code must by indicated with three uppercase letters"); + Validate.isTrue( + currencyCode != null && currencyCode.length() == 3 && currencyCode.matches("[A-Z]*"), + "The currency code must by indicated with three uppercase letters"); currencies.add(currencyCode); } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/Lib.java b/src/main/java/com/prowidesoftware/swift/utils/Lib.java index a2cc56cbe..6e5fc21eb 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/Lib.java +++ b/src/main/java/com/prowidesoftware/swift/utils/Lib.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,18 +15,16 @@ */ package com.prowidesoftware.swift.utils; -import org.apache.commons.lang3.StringUtils; - import java.io.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import org.apache.commons.lang3.StringUtils; /** * Miscellaneous helper functions. */ public class Lib { - private Lib() { - } + private Lib() {} /** * Read the content of the given file into a string. @@ -66,10 +64,8 @@ public static String readFile(final File file, final String encoding) throws IOE } final String charset = encoding != null ? encoding : "UTF-8"; final StringBuilder sb = new StringBuilder((int) file.length()); - try ( - FileInputStream fileStream = new FileInputStream(file); - BufferedReader in = new BufferedReader(new InputStreamReader(fileStream, charset)) - ) { + try (FileInputStream fileStream = new FileInputStream(file); + BufferedReader in = new BufferedReader(new InputStreamReader(fileStream, charset))) { int c; while ((c = in.read()) != -1) { sb.append((char) c); @@ -212,5 +208,4 @@ public static String readReader(final Reader reader) throws IOException { } return out.toString(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/LineWrapper.java b/src/main/java/com/prowidesoftware/swift/utils/LineWrapper.java index a78f26863..242d137b8 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/LineWrapper.java +++ b/src/main/java/com/prowidesoftware/swift/utils/LineWrapper.java @@ -13,11 +13,10 @@ */ package com.prowidesoftware.swift.utils; -import org.apache.commons.lang3.StringUtils; - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.commons.lang3.StringUtils; /** * Static utility class to wrap character data into lines. @@ -30,8 +29,7 @@ public final class LineWrapper { /** * Constructor hidden to prevent instantiation. */ - private LineWrapper() { - } + private LineWrapper() {} /** * Wraps the input sequence {@code _str} to the specified {@code _width} identifying words by space.
    @@ -48,7 +46,7 @@ public static String wrap(final CharSequence _str, final int _width, final CharS if (wrapped.isEmpty()) { return null; } - CharSequence newLineSeq = _newLineSeq != null? _newLineSeq : System.lineSeparator(); + CharSequence newLineSeq = _newLineSeq != null ? _newLineSeq : System.lineSeparator(); return String.join(newLineSeq, wrapped); } @@ -165,5 +163,4 @@ private static String lstripChar(final CharSequence _str, final char _c) { } return _str.toString().substring(i); } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/MurMessageComparator.java b/src/main/java/com/prowidesoftware/swift/utils/MurMessageComparator.java index 767c922eb..8dd336477 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/MurMessageComparator.java +++ b/src/main/java/com/prowidesoftware/swift/utils/MurMessageComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,9 @@ package com.prowidesoftware.swift.utils; import com.prowidesoftware.swift.model.SwiftMessage; -import org.apache.commons.lang3.StringUtils; - import java.util.Comparator; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Compares the messages based on the MUR. @@ -49,5 +48,4 @@ public int compare(final SwiftMessage left, final SwiftMessage right) { Objects.requireNonNull(right); return StringUtils.equals(left.getMUR(), right.getMUR()) ? 0 : 1; } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/ResolverUtils.java b/src/main/java/com/prowidesoftware/swift/utils/ResolverUtils.java index fa50064c0..6eb096e5b 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/ResolverUtils.java +++ b/src/main/java/com/prowidesoftware/swift/utils/ResolverUtils.java @@ -1,9 +1,8 @@ package com.prowidesoftware.swift.utils; -import org.apache.commons.lang3.tuple.Pair; - import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.tuple.Pair; public class ResolverUtils { @@ -19,7 +18,7 @@ public static List> findWantedType(String pattern, Strin final List> result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (types.indexOf(pattern.charAt(i)) != -1) { result.add(Pair.of(pattern.charAt(i), components.get(i))); } @@ -35,11 +34,12 @@ public static List> findWantedType(String pattern, Strin * @param components the list of component values * @return the list of pairs {type, value} that match any of the wanted types, including nulls */ - public static List> findNonNullWantedType(String pattern, String types, List components) { + public static List> findNonNullWantedType( + String pattern, String types, List components) { final List> result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (components.get(i) != null && types.indexOf(pattern.charAt(i)) != -1) { result.add(Pair.of(pattern.charAt(i), components.get(i))); } @@ -58,7 +58,7 @@ public static List> findNonNullWantedType(String pattern public static Pair findFirstWantedType(String pattern, String types, List components) { int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (types.indexOf(pattern.charAt(i)) != -1) { return Pair.of(pattern.charAt(i), components.get(i)); } @@ -74,10 +74,11 @@ public static Pair findFirstWantedType(String pattern, String * @param components the list of component values * @return a pair containing the first NON-NULL component's type and the value */ - public static Pair findFirstNonNullWantedType(String pattern, String types, List components) { + public static Pair findFirstNonNullWantedType( + String pattern, String types, List components) { int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (components.get(i) != null && types.indexOf(pattern.charAt(i)) != -1) { return Pair.of(pattern.charAt(i), components.get(i)); } @@ -97,7 +98,7 @@ public static List findWantedType(String pattern, char type, List result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (type == pattern.charAt(i)) { result.add(components.get(i)); } @@ -117,7 +118,7 @@ public static List findNonNullWantedType(String pattern, char type, List final List result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (components.get(i) != null && type == pattern.charAt(i)) { result.add(components.get(i)); } @@ -136,7 +137,7 @@ public static List findNonNullWantedType(String pattern, char type, List public static String findFirstWantedType(String pattern, char type, List components) { int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (type == pattern.charAt(i)) { return components.get(i); } @@ -155,7 +156,7 @@ public static String findFirstWantedType(String pattern, char type, List public static String findFirstNonNullWantedType(String pattern, char type, List components) { int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (components.get(i) != null && type == pattern.charAt(i)) { return components.get(i); } @@ -174,7 +175,7 @@ public static List findWantedTypesPosition(String pattern, String types final List result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (types.indexOf(pattern.charAt(i)) != -1) { result.add(i + 1); } @@ -193,7 +194,7 @@ public static List findWantedTypesPosition(String pattern, char type) { final List result = new ArrayList<>(); int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (pattern.charAt(i) == type) { result.add(i + 1); } @@ -211,13 +212,11 @@ public static List findWantedTypesPosition(String pattern, char type) { public static int findFirstWantedTypePosition(String pattern, char type) { int len = pattern != null ? pattern.length() : 0; - for(int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { if (type == pattern.charAt(i)) { return i + 1; } } return -1; } - - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/SafeXmlUtils.java b/src/main/java/com/prowidesoftware/swift/utils/SafeXmlUtils.java index 2b065a008..97e445bc1 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/SafeXmlUtils.java +++ b/src/main/java/com/prowidesoftware/swift/utils/SafeXmlUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package com.prowidesoftware.swift.utils; import com.prowidesoftware.ProwideException; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.XMLReader; - import javax.xml.XMLConstants; import javax.xml.parsers.*; import javax.xml.stream.XMLInputFactory; @@ -30,6 +25,10 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; /** * Reusable safe XML document builder to prevent XXE @@ -39,7 +38,8 @@ */ public class SafeXmlUtils { @SuppressWarnings("unused") - private static transient final java.util.logging.Logger log = java.util.logging.Logger.getLogger(SafeXmlUtils.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SafeXmlUtils.class.getName()); // Suppress default constructor for noninstantiability private SafeXmlUtils() { @@ -87,8 +87,10 @@ public static DocumentBuilder documentBuilder(boolean namespaceAware) { return dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { - throw new ProwideException("Error configuring the XML document builder. " + - "The feature " + feature + " is probably not supported by your XML processor.", e); + throw new ProwideException( + "Error configuring the XML document builder. " + "The feature " + feature + + " is probably not supported by your XML processor.", + e); } } @@ -155,8 +157,10 @@ public static XMLReader reader(boolean namespaceAware, Schema schema) throws Pro return reader; } catch (ParserConfigurationException | SAXException e) { - throw new ProwideException("Error configuring the XML parser. " + - "The feature " + feature + " is probably not supported by your XML processor.", e); + throw new ProwideException( + "Error configuring the XML parser. " + "The feature " + feature + + " is probably not supported by your XML processor.", + e); } } @@ -194,8 +198,10 @@ public static Transformer transformer() { return tf.newTransformer(); } catch (TransformerConfigurationException e) { - throw new ProwideException("Error configuring the XML transformer factory. " + - "The feature " + feature + " is probably not supported by your XML processor.", e); + throw new ProwideException( + "Error configuring the XML transformer factory. " + "The feature " + feature + + " is probably not supported by your XML processor.", + e); } } @@ -212,14 +218,16 @@ public static SchemaFactory schemaFactory() { factory.setProperty(feature, ""); // we keep this one for the moment because it is needed in MX xsys validation - //feature = XMLConstants.ACCESS_EXTERNAL_SCHEMA; - //factory.setProperty(feature, ""); + // feature = XMLConstants.ACCESS_EXTERNAL_SCHEMA; + // factory.setProperty(feature, ""); return factory; } catch (SAXNotRecognizedException | SAXNotSupportedException e) { - throw new ProwideException("Error configuring the schema factory. " + - "The feature " + feature + " is probably not supported by your XML processor.", e); + throw new ProwideException( + "Error configuring the schema factory. " + "The feature " + feature + + " is probably not supported by your XML processor.", + e); } } @@ -240,9 +248,10 @@ public static Validator validator(Schema schema) { return validator; } catch (SAXNotRecognizedException | SAXNotSupportedException e) { - throw new ProwideException("Error configuring the schema validator. " + - "The feature " + feature + " is probably not supported by your XML processor.", e); + throw new ProwideException( + "Error configuring the schema validator. " + "The feature " + feature + + " is probably not supported by your XML processor.", + e); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/prowidesoftware/swift/utils/SwiftFormatUtils.java b/src/main/java/com/prowidesoftware/swift/utils/SwiftFormatUtils.java index 0611860ef..1f07f3f61 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/SwiftFormatUtils.java +++ b/src/main/java/com/prowidesoftware/swift/utils/SwiftFormatUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,26 +15,21 @@ */ package com.prowidesoftware.swift.utils; -import com.prowidesoftware.deprecation.DeprecationUtils; -import com.prowidesoftware.deprecation.ProwideDeprecated; -import com.prowidesoftware.deprecation.TargetYear; import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.model.LogicalTerminalAddress; import com.prowidesoftware.swift.model.MIR; import com.prowidesoftware.swift.model.MOR; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateFormatUtils; - import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.Year; import java.util.Calendar; import java.util.Currency; import java.util.Date; import java.util.GregorianCalendar; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; /** * This class provides methods to convert field components to objects. @@ -61,7 +56,8 @@ * @since 6.0 */ public class SwiftFormatUtils { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftFormatUtils.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftFormatUtils.class.getName()); // Suppress default constructor for noninstantiability private SwiftFormatUtils() { @@ -346,7 +342,9 @@ private static Calendar getCalendar(final String value, final String format) { cal.setTime(d); return cal; } catch (final ParseException e) { - log.log(java.util.logging.Level.WARNING, "Could not parse '" + value + "' with pattern '" + format + "'"); + log.log( + java.util.logging.Level.WARNING, + "Could not parse '" + value + "' with pattern '" + format + "'"); } } return null; @@ -507,9 +505,11 @@ public static String getBIC(final BIC bic) { public static Boolean getBoolean(final String string) { if (string == null) { return null; - } if ("Y".equals(string)) { + } + if ("Y".equals(string)) { return Boolean.TRUE; - } if ("N".equals(string)) { + } + if ("N".equals(string)) { return Boolean.FALSE; } return null; diff --git a/src/main/java/com/prowidesoftware/swift/utils/SwiftMessageComparator.java b/src/main/java/com/prowidesoftware/swift/utils/SwiftMessageComparator.java index c02be4a54..f60e1c9f6 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/SwiftMessageComparator.java +++ b/src/main/java/com/prowidesoftware/swift/utils/SwiftMessageComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ import com.prowidesoftware.ProwideException; import com.prowidesoftware.swift.model.*; -import org.apache.commons.lang3.StringUtils; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; @@ -26,6 +24,7 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * An MT message comparator that compares all values from block 1 2 3, 4 and 5. @@ -46,7 +45,8 @@ * @since 7.8.8 */ public class SwiftMessageComparator implements Comparator { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftMessageComparator.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftMessageComparator.class.getName()); /** * Flag to enable different type of EOLs in multi-line values */ @@ -149,9 +149,12 @@ public boolean compareB2(final SwiftBlock2 left, final SwiftBlock2 right) { private boolean compareB2Input(final SwiftBlock2Input left, final SwiftBlock2Input right) { boolean sameType = StringUtils.equals(left.getMessageType(), right.getMessageType()); boolean sameReceiverAddress = compareLTAddress(left.getReceiverAddress(), right.getReceiverAddress()); - boolean sameDeliveryMonitoring = ignoreBlock2OptionalFields || StringUtils.equals(left.getDeliveryMonitoring(), right.getDeliveryMonitoring()); - boolean sameObsolescencePeriod = ignoreBlock2OptionalFields || StringUtils.equals(left.getObsolescencePeriod(), right.getObsolescencePeriod()); - boolean samePriority = ignorePriority || StringUtils.equals(left.getMessagePriority(), right.getMessagePriority()); + boolean sameDeliveryMonitoring = ignoreBlock2OptionalFields + || StringUtils.equals(left.getDeliveryMonitoring(), right.getDeliveryMonitoring()); + boolean sameObsolescencePeriod = ignoreBlock2OptionalFields + || StringUtils.equals(left.getObsolescencePeriod(), right.getObsolescencePeriod()); + boolean samePriority = + ignorePriority || StringUtils.equals(left.getMessagePriority(), right.getMessagePriority()); return sameType && sameReceiverAddress && sameDeliveryMonitoring && sameObsolescencePeriod && samePriority; } @@ -162,11 +165,21 @@ private boolean compareB2Output(final SwiftBlock2Output left, final SwiftBlock2O boolean sameMIRLogicalTerminal = compareLTAddress(left.getMIRLogicalTerminal(), right.getMIRLogicalTerminal()); boolean sameMIRSessionNumber = StringUtils.equals(left.getMIRSessionNumber(), right.getMIRSessionNumber()); boolean sameMIRSequenceNumber = StringUtils.equals(left.getMIRSequenceNumber(), right.getMIRSequenceNumber()); - boolean sameReceiverOutputDate = StringUtils.equals(left.getReceiverOutputDate(), right.getReceiverOutputDate()); - boolean sameReceiverOutputTime = StringUtils.equals(left.getReceiverOutputTime(), right.getReceiverOutputTime()); - boolean samePriority = ignorePriority || StringUtils.equals(left.getMessagePriority(), right.getMessagePriority()); - return sameType && sameSenderInputTime && sameMIRDate && sameMIRLogicalTerminal && sameMIRSessionNumber && - sameMIRSequenceNumber && sameReceiverOutputDate && sameReceiverOutputTime && samePriority; + boolean sameReceiverOutputDate = + StringUtils.equals(left.getReceiverOutputDate(), right.getReceiverOutputDate()); + boolean sameReceiverOutputTime = + StringUtils.equals(left.getReceiverOutputTime(), right.getReceiverOutputTime()); + boolean samePriority = + ignorePriority || StringUtils.equals(left.getMessagePriority(), right.getMessagePriority()); + return sameType + && sameSenderInputTime + && sameMIRDate + && sameMIRLogicalTerminal + && sameMIRSessionNumber + && sameMIRSequenceNumber + && sameReceiverOutputDate + && sameReceiverOutputTime + && samePriority; } /** @@ -206,11 +219,7 @@ public boolean compareTagListBlock(final SwiftTagListBlock left, final SwiftTagL if (tagNameIgnored(t1.getName(), t2.getName())) { log.finer("Tag ignored: " + t1.getName() + " - " + t2.getName()); } else { - if (!( - StringUtils.equals(t1.getName(), t2.getName()) && - valuesAreEqual(t1.getValue(), t2.getValue()) - ) - ) { + if (!(StringUtils.equals(t1.getName(), t2.getName()) && valuesAreEqual(t1.getValue(), t2.getValue()))) { count++; } } @@ -290,8 +299,10 @@ public boolean compareB1(final SwiftBlock1 left, final SwiftBlock1 right) { } boolean sameApplicationId = StringUtils.equals(left.getApplicationId(), right.getApplicationId()); boolean sameServiceId = StringUtils.equals(left.getServiceId(), right.getServiceId()); - boolean sameSession = this.ignoreHeaderSession || StringUtils.equals(left.getSessionNumber(), right.getSessionNumber()); - boolean sameSequence = this.ignoreHeaderSession || StringUtils.equals(left.getSequenceNumber(), right.getSequenceNumber()); + boolean sameSession = + this.ignoreHeaderSession || StringUtils.equals(left.getSessionNumber(), right.getSessionNumber()); + boolean sameSequence = + this.ignoreHeaderSession || StringUtils.equals(left.getSequenceNumber(), right.getSequenceNumber()); boolean sameLTAddress = compareLTAddress(left.getLogicalTerminal(), right.getLogicalTerminal()); return sameApplicationId && sameServiceId && sameSequence && sameSession && sameLTAddress; } @@ -308,7 +319,8 @@ private boolean compareLTAddress(String logicalTerminalLeft, String logicalTermi private boolean compareBic(BIC left, BIC right) { if (this.ignoreLocationFlag) { - return StringUtils.equals(left.asTestBic().getBic11(), right.asTestBic().getBic11()); + return StringUtils.equals( + left.asTestBic().getBic11(), right.asTestBic().getBic11()); } else { return StringUtils.equals(left.getBic11(), right.getBic11()); } diff --git a/src/main/java/com/prowidesoftware/swift/utils/TestUtils.java b/src/main/java/com/prowidesoftware/swift/utils/TestUtils.java index 104e04433..379b84044 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/TestUtils.java +++ b/src/main/java/com/prowidesoftware/swift/utils/TestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,9 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.SwiftTagListBlock; import com.prowidesoftware.swift.model.Tag; -import org.apache.commons.lang3.StringUtils; - import java.util.List; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; /** * Utility methods for test cases @@ -112,5 +111,4 @@ public static String patch(final String xpath) { } return result.toString(); } - } diff --git a/src/main/java/com/prowidesoftware/swift/utils/package-info.java b/src/main/java/com/prowidesoftware/swift/utils/package-info.java index 2ba3fb243..df2a12193 100644 --- a/src/main/java/com/prowidesoftware/swift/utils/package-info.java +++ b/src/main/java/com/prowidesoftware/swift/utils/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ /** * Miscellaneous utility and helper classes. */ -package com.prowidesoftware.swift.utils; \ No newline at end of file +package com.prowidesoftware.swift.utils; diff --git a/src/main/resources/ProwideException.properties b/src/main/resources/ProwideException.properties index 9e68ae4f0..015a48d9c 100644 --- a/src/main/resources/ProwideException.properties +++ b/src/main/resources/ProwideException.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2021 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_de.properties b/src/main/resources/pw_swift_labels_de.properties index c60ca9dfe..f09379a8d 100644 --- a/src/main/resources/pw_swift_labels_de.properties +++ b/src/main/resources/pw_swift_labels_de.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_en.properties b/src/main/resources/pw_swift_labels_en.properties index 0c0ead7a6..52b907501 100644 --- a/src/main/resources/pw_swift_labels_en.properties +++ b/src/main/resources/pw_swift_labels_en.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_es.properties b/src/main/resources/pw_swift_labels_es.properties index 467f6e284..154fd1cae 100644 --- a/src/main/resources/pw_swift_labels_es.properties +++ b/src/main/resources/pw_swift_labels_es.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_fr.properties b/src/main/resources/pw_swift_labels_fr.properties index 1c170916d..38c5df695 100644 --- a/src/main/resources/pw_swift_labels_fr.properties +++ b/src/main/resources/pw_swift_labels_fr.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_it.properties b/src/main/resources/pw_swift_labels_it.properties index 7f74d71c4..eff079f6f 100644 --- a/src/main/resources/pw_swift_labels_it.properties +++ b/src/main/resources/pw_swift_labels_it.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/pw_swift_labels_ru.properties b/src/main/resources/pw_swift_labels_ru.properties index 648f15ceb..84fc91e33 100644 --- a/src/main/resources/pw_swift_labels_ru.properties +++ b/src/main/resources/pw_swift_labels_ru.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright 2006-2022 Prowide +# Copyright 2006-2023 Prowide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/deprecation/DeprecationUtilTest.java b/src/test/java/com/prowidesoftware/deprecation/DeprecationUtilTest.java index 3e24fdc81..17615495e 100644 --- a/src/test/java/com/prowidesoftware/deprecation/DeprecationUtilTest.java +++ b/src/test/java/com/prowidesoftware/deprecation/DeprecationUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,10 @@ public void testPhase2_default() { * Log and delay switched off */ @Test - @DisabledForJreRange(min = JRE.JAVA_17, disabledReason="Consider rewrite or removal. Due to JPMS this case requires: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED") + @DisabledForJreRange( + min = JRE.JAVA_17, + disabledReason = + "Consider rewrite or removal. Due to JPMS this case requires: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED") public void testPhase2_off() { DeprecationUtils.setEnv(EnvironmentVariableKey.NOLOG, EnvironmentVariableKey.NODELAY); long t0 = System.currentTimeMillis(); @@ -62,19 +65,23 @@ public void testPhase2_off() { */ @Test public void testPhase3_default() { - Assertions.assertThrows(UnsupportedOperationException.class, () -> DeprecationUtils.phase3(this.getClass(), null, "phase 3 message")); + Assertions.assertThrows( + UnsupportedOperationException.class, + () -> DeprecationUtils.phase3(this.getClass(), null, "phase 3 message")); } - /** * Exception switched off */ @Test - @DisabledForJreRange(min = JRE.JAVA_17, disabledReason="Consider rewrite or removal. Due to JPMS this case requires: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED") + @DisabledForJreRange( + min = JRE.JAVA_17, + disabledReason = + "Consider rewrite or removal. Due to JPMS this case requires: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED") public void testPhase3_off() { - DeprecationUtils.setEnv(EnvironmentVariableKey.NOLOG, EnvironmentVariableKey.NODELAY, EnvironmentVariableKey.NOEXCEPTION); + DeprecationUtils.setEnv( + EnvironmentVariableKey.NOLOG, EnvironmentVariableKey.NODELAY, EnvironmentVariableKey.NOEXCEPTION); DeprecationUtils.phase3(this.getClass(), null, "phase 3 message"); DeprecationUtils.clearEnv(); } - } diff --git a/src/test/java/com/prowidesoftware/issues/Bug3085740.java b/src/test/java/com/prowidesoftware/issues/Bug3085740.java index b470a6d74..4481b0224 100644 --- a/src/test/java/com/prowidesoftware/issues/Bug3085740.java +++ b/src/test/java/com/prowidesoftware/issues/Bug3085740.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,36 +20,33 @@ import com.prowidesoftware.swift.io.ConversionService; import com.prowidesoftware.swift.io.IConversionService; import com.prowidesoftware.swift.io.parser.SwiftParser; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; public class Bug3085740 { @Test public void testWifeBug() throws IOException { IConversionService conversionService = new ConversionService(); - String expectedMT940 = "{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\r\n" + - ":20:REFXXXXX\r\n" + - ":25:K005201001004509050156\r\n" + - ":28C:00001\r\n" + - ":60F:C051007XOF2644893271,0\r\n" + - ":61:0710241024DF4105400,0FMSC1234567890\r\n" + - "TEST LIBELLE\r\n" + - ":61:0710251025DF3000000000,0FMSC1234567890\r\n" + - "TEST LIBELLE\r\n" + - ":61:0710251025CF959919691,0FMSC1234567890\r\n" + - "TEST LIBELLE\r\n" + - ":61:0710251025CF523237057,0FMSC1234567890\r\n" + - "TEST LIBELLE\r\n" + - ":61:0710251025CF3000000000,0FMSC1234567890\r\n" + - "TEST LIBELLE\r\n" + - ":62F:C061207XOF4123944619,0\r\n" + - ":86:Message de bienvenue\r\n" + - ":62M:C100921ZAR499650,23\r\n" + - "-}"; + String expectedMT940 = "{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\r\n" + ":20:REFXXXXX\r\n" + + ":25:K005201001004509050156\r\n" + + ":28C:00001\r\n" + + ":60F:C051007XOF2644893271,0\r\n" + + ":61:0710241024DF4105400,0FMSC1234567890\r\n" + + "TEST LIBELLE\r\n" + + ":61:0710251025DF3000000000,0FMSC1234567890\r\n" + + "TEST LIBELLE\r\n" + + ":61:0710251025CF959919691,0FMSC1234567890\r\n" + + "TEST LIBELLE\r\n" + + ":61:0710251025CF523237057,0FMSC1234567890\r\n" + + "TEST LIBELLE\r\n" + + ":61:0710251025CF3000000000,0FMSC1234567890\r\n" + + "TEST LIBELLE\r\n" + + ":62F:C061207XOF4123944619,0\r\n" + + ":86:Message de bienvenue\r\n" + + ":62M:C100921ZAR499650,23\r\n" + + "-}"; String actualMT940 = conversionService.getFIN(new SwiftParser(expectedMT940).message()); assertEquals(expectedMT940, actualMT940); } - } diff --git a/src/test/java/com/prowidesoftware/issues/CustomTagInParserTest.java b/src/test/java/com/prowidesoftware/issues/CustomTagInParserTest.java index 9bb13b83b..bbb1ff4a7 100644 --- a/src/test/java/com/prowidesoftware/issues/CustomTagInParserTest.java +++ b/src/test/java/com/prowidesoftware/issues/CustomTagInParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,14 @@ */ package com.prowidesoftware.issues; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import com.prowidesoftware.swift.io.parser.SwiftParser; import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; /** * Kantoro Erkulov @@ -34,10 +32,9 @@ public class CustomTagInParserTest { @Test public void test() throws IOException { - final String fin = "{1:F01BIC0BANKAXXX0006222623}{2:I198BIC0BANKXXXXS}{4:\n" + - ":20:my_ref\n" + - ":CUSTOM_TAG:my_value\n" + - "-}"; + final String fin = "{1:F01BIC0BANKAXXX0006222623}{2:I198BIC0BANKXXXXS}{4:\n" + ":20:my_ref\n" + + ":CUSTOM_TAG:my_value\n" + + "-}"; SwiftParser swiftParser = new SwiftParser(fin); SwiftMessage swiftMessage = swiftParser.message(); final Tag t20 = swiftMessage.getBlock4().getTagByName("20"); @@ -52,5 +49,4 @@ public void test() throws IOException { assertNull(tcustom); assertEquals("my_ref\n:CUSTOM_TAG:my_value", t20.getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/issues/Issue41.java b/src/test/java/com/prowidesoftware/issues/Issue41.java index 8422e966b..304f6e565 100644 --- a/src/test/java/com/prowidesoftware/issues/Issue41.java +++ b/src/test/java/com/prowidesoftware/issues/Issue41.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,8 @@ import com.prowidesoftware.swift.model.SwiftTagListBlock; import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.model.mt.mt5xx.MT564; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * https://github.com/prowide/prowide-core/issues/41 @@ -33,51 +32,50 @@ public class Issue41 { @Test public void testMT564() { - String fin = "{1:F01FIFRUS31AXXX0000000000}{2:I564N}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//DV200000168730\n" + - ":20C::SEME//DV200000168730\n" + - ":23G:NEWM\n" + - ":22F::CAEV//DVCA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20201029152301\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:/CUSP/12345B68\n" + - "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" + - ":16R:FIA\n" + - ":94B::PLIS//EXCH/XTSE\n" + - ":16S:FIA\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//NONREF\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::ANOU//20201029\n" + - ":98A::XDTE//20001127\n" + - ":98A::RDTE//20201130\n" + - ":22F::DIVI//REGR\n" + - ":16S:CADETL\n" + + String fin = "{1:F01FIFRUS31AXXX0000000000}{2:I564N}{4:\n" + ":16R:GENL\n" + + ":20C::CORP//DV200000168730\n" + + ":20C::SEME//DV200000168730\n" + + ":23G:NEWM\n" + + ":22F::CAEV//DVCA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20201029152301\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:/CUSP/12345B68\n" + + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" + + ":16R:FIA\n" + + ":94B::PLIS//EXCH/XTSE\n" + + ":16S:FIA\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//NONREF\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::ANOU//20201029\n" + + ":98A::XDTE//20001127\n" + + ":98A::RDTE//20201130\n" + + ":22F::DIVI//REGR\n" + + ":16S:CADETL\n" + + // sequence E - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":17B::DFLT//Y\n" + - ":92H::GRSS//USD0,12345657/ACTU\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":17B::DFLT//Y\n" + + ":92H::GRSS//USD0,12345657/ACTU\n" + + // sequence E2 - ":16R:CASHMOVE\n" + - ":22H::CRDB//CRED\n" + - ":98A::PAYD//20201231\n" + - ":92J::GRSS//INCO/USD0,1234567/ACTU\n" + - ":16S:CASHMOVE\n" + - - ":70E::TAXE//US UNITED STATES\n" + - ":16S:CAOPTN\n" + - - "-}"; + ":16R:CASHMOVE\n" + + ":22H::CRDB//CRED\n" + + ":98A::PAYD//20201231\n" + + ":92J::GRSS//INCO/USD0,1234567/ACTU\n" + + ":16S:CASHMOVE\n" + + ":70E::TAXE//US UNITED STATES\n" + + ":16S:CAOPTN\n" + + "-}"; MT564 mt = MT564.parse(fin); // this returns all field 92a in the message @@ -89,7 +87,8 @@ public void testMT564() { assertEquals(2, sequenceE.getFieldsByNumber(92).size()); // this returns all fields 92a in sequence E only, not occurrence in subsequences - SwiftTagListBlock trimmedSequenceE = SwiftMessageUtils.removeInnerSequences(mt.getSequenceEList().get(0)); + SwiftTagListBlock trimmedSequenceE = + SwiftMessageUtils.removeInnerSequences(mt.getSequenceEList().get(0)); List fields = trimmedSequenceE.getFieldsByNumber(92); assertEquals(1, fields.size()); assertEquals(":GRSS//USD0,12345657/ACTU", fields.get(0).getValue()); @@ -101,10 +100,10 @@ public void testMT564() { assertNotNull(trimmedSequenceE.getFieldByName("92H")); // this returns all fields 92a in sequence E2 - SwiftTagListBlock sequenceE2 = SwiftMessageUtils.removeInnerSequences(mt.getSequenceE2List().get(0)); + SwiftTagListBlock sequenceE2 = + SwiftMessageUtils.removeInnerSequences(mt.getSequenceE2List().get(0)); fields = sequenceE2.getFieldsByNumber(92); assertEquals(1, fields.size()); assertEquals(":GRSS//INCO/USD0,1234567/ACTU", fields.get(0).getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/issues/Issue74.java b/src/test/java/com/prowidesoftware/issues/Issue74.java index cf76b1660..85b887ed0 100644 --- a/src/test/java/com/prowidesoftware/issues/Issue74.java +++ b/src/test/java/com/prowidesoftware/issues/Issue74.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public class Issue74 { @Test public void testField48() { - Tag swift48Tag = new Tag("48:30/BUT WITHIN L/C VALIDITY"); + Tag swift48Tag = new Tag("48:30/BUT WITHIN L/C VALIDITY"); String formattedValue = swift48Tag.getValue(); @@ -39,5 +39,4 @@ public void testField48() { System.out.println("swift48Tag.asField.getValue: " + formattedValue); assert "30/BUT WITHIN L/C VALIDITY".equals(formattedValue); } - } diff --git a/src/test/java/com/prowidesoftware/issues/Issue78.java b/src/test/java/com/prowidesoftware/issues/Issue78.java index 1ef180955..e278870aa 100644 --- a/src/test/java/com/prowidesoftware/issues/Issue78.java +++ b/src/test/java/com/prowidesoftware/issues/Issue78.java @@ -3,289 +3,298 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import com.prowidesoftware.swift.model.mt.mt5xx.MT537; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class Issue78 { @Test public void test() { - String fin = "{1:F01XXXXXXX0AXXX0400996471}{2:O5371305211201XXXXXXX0AXXX14523429742112011305N}{3:{108:GCH-xxxxxxxxxxxx}}{4:\n" + - // sequence A - ":16R:GENL\n" + - ":28E:5/LAST\n" + - ":13A::STAT//513\n" + - ":20C::SEME//000000000000251C\n" + - ":23G:PENA\n" + - ":98A::STAT//20211130\n" + - ":22F::SFRE//DAIL\n" + - ":22F::CODE//DELT\n" + - ":22H::STST//PENA\n" + - ":95P::ACOW//XXXXXXXXX01\n" + - ":97A::SAFE//NONREF\n" + - ":17B::ACTI//Y\n" + - ":16S:GENL\n" + + String fin = + "{1:F01XXXXXXX0AXXX0400996471}{2:O5371305211201XXXXXXX0AXXX14523429742112011305N}{3:{108:GCH-xxxxxxxxxxxx}}{4:\n" + + + // sequence A + ":16R:GENL\n" + + ":28E:5/LAST\n" + + ":13A::STAT//513\n" + + ":20C::SEME//000000000000251C\n" + + ":23G:PENA\n" + + ":98A::STAT//20211130\n" + + ":22F::SFRE//DAIL\n" + + ":22F::CODE//DELT\n" + + ":22H::STST//PENA\n" + + ":95P::ACOW//XXXXXXXXX01\n" + + ":97A::SAFE//NONREF\n" + + ":17B::ACTI//Y\n" + + ":16S:GENL\n" + + - // sequence B - ":16R:STAT\n" + - ":25D::IPRC//CPRC\n" + + // sequence B + ":16R:STAT\n" + + ":25D::IPRC//CPRC\n" + + - // sequence B1 - ":16R:REAS\n" + - ":24B::CAND//CANI\n" + - ":70D::REAS//SXAA015 - Failure of the settlement\n" + - "DESCRIPTION 111\n" + - "DESCRIPTION 112\n" + - "DESCRIPTION 113\n" + - "terparty\n" + - ":16S:REAS\n" + + // sequence B1 + ":16R:REAS\n" + + ":24B::CAND//CANI\n" + + ":70D::REAS//SXAA015 - Failure of the settlement\n" + + "DESCRIPTION 111\n" + + "DESCRIPTION 112\n" + + "DESCRIPTION 113\n" + + "terparty\n" + + ":16S:REAS\n" + + ":16S:STAT\n" + + - ":16S:STAT\n" + + // sequence D + ":16R:PENA\n" + + ":69A::STAT//20211101/20211130\n" + + ":22F::CODE//CURR\n" + + ":95P::ASDP//XXXXXXXXXXX\n" + + - // sequence D - ":16R:PENA\n" + - ":69A::STAT//20211101/20211130\n" + - ":22F::CODE//CURR\n" + - ":95P::ASDP//XXXXXXXXXXX\n" + - - // sequence D1 - ":16R:PENACUR\n" + - ":11A::PECU//EUR\n" + - ":98A::DACO//20211130\n" + - ":95P::REPA//XXXXXXXXD01\n" + - ":95P::CASD//XXXXXXXXXXX\n" + - ":95P::DCSD//XXXXXXXXXXX\n" + - ":22F::TRCA//CSDP\n" + + // sequence D1 + ":16R:PENACUR\n" + + ":11A::PECU//EUR\n" + + ":98A::DACO//20211130\n" + + ":95P::REPA//XXXXXXXXD01\n" + + ":95P::CASD//XXXXXXXXXXX\n" + + ":95P::DCSD//XXXXXXXXXXX\n" + + ":22F::TRCA//CSDP\n" + + // sequence D1a - ":16R:PENACOUNT\n" + - ":95P::REPA//XXXXXXXXXXX\n" + - ":22F::TRCA//CCPA\n" + - ":19A::AGNT//EUR1,04\n" + - - // sequence D1a1 - ":16R:PENDET\n" + - ":20C::PCOM//211130067774271\n" + - ":20C::PREF//N211130067774271\n" + - ":22H::PNTP//SEFP\n" + - ":22H::CALM//SECU\n" + - ":17B::CMPU//N\n" + - ":25D::PNST//ACTV\n" + - ":19A::AMCO//EUR1,\n" + - ":99A::DAAC//001\n" + - - // sequence D1a1A - ":16R:CALDET\n" + - ":98A::PEDA//20211130\n" + - - // sequence D1a1A1 - ":16R:FIA\n" + - ":35B:ISIN XX000000\n" + - ":12A::CLAS/REGL/SOVR\n" + - ":92A::GOMB//0,001\n" + - ":16S:FIA\n" + - - ":19A::SECU//EUR11,\n" + - ":16S:CALDET\n" + - - // sequence D1a1B - ":16R:RELTRAN\n" + - ":20C::ACOW//NONREF\n" + - ":20C::MITI//2111262161218562\n" + - - // sequence D1a1B1 - ":16R:TRAN\n" + - ":22H::REDE//RECE\n" + - ":22H::PAYM//APMT\n" + - ":22F::SETR//REPU\n" + - ":22F::TRAN//SETT\n" + - ":22F::BDEV/T2S/IDVP\n" + - ":98A::SETT//20211129\n" + - ":98C::ASTS//20211126181652\n" + - ":98C::MTCH//20211126181652\n" + - ":98C::SCTS//20211130143000\n" + - ":97A::SAFE//XXXXXXXXXXXXXX1000XX0\n" + - ":95P::ACOW//XXXXXXXXX01\n" + - ":36B::PSTA//FAMT/50000000,\n" + - ":19A::PSTA//EUR1111111,\n" + + ":16R:PENACOUNT\n" + + ":95P::REPA//XXXXXXXXXXX\n" + + ":22F::TRCA//CCPA\n" + + ":19A::AGNT//EUR1,04\n" + + - // sequence D1a1B1a - ":16R:STAT\n" + - ":25D::SETT//PENF\n" + + // sequence D1a1 + ":16R:PENDET\n" + + ":20C::PCOM//211130067774271\n" + + ":20C::PREF//N211130067774271\n" + + ":22H::PNTP//SEFP\n" + + ":22H::CALM//SECU\n" + + ":17B::CMPU//N\n" + + ":25D::PNST//ACTV\n" + + ":19A::AMCO//EUR1,\n" + + ":99A::DAAC//001\n" + + - // sequence D1a1B1a1 - ":16R:REAS\n" + - ":24B::PENF//CLAC\n" + - ":70D::REAS//SXAA015 - Failure of the settlement\n" + - "DESCRIPTION 101\n" + - "DESCRIPTION 102\n" + - "DESCRIPTION 103\n" + - ":16S:REAS\n" + + // sequence D1a1A + ":16R:CALDET\n" + + ":98A::PEDA//20211130\n" + + - ":16S:STAT\n" + + // sequence D1a1A1 + ":16R:FIA\n" + + ":35B:ISIN XX000000\n" + + ":12A::CLAS/REGL/SOVR\n" + + ":92A::GOMB//0,001\n" + + ":16S:FIA\n" + + ":19A::SECU//EUR11,\n" + + ":16S:CALDET\n" + + - ":16S:TRAN\n" + + // sequence D1a1B + ":16R:RELTRAN\n" + + ":20C::ACOW//NONREF\n" + + ":20C::MITI//2111262161218562\n" + + - ":16S:RELTRAN\n" + + // sequence D1a1B1 + ":16R:TRAN\n" + + ":22H::REDE//RECE\n" + + ":22H::PAYM//APMT\n" + + ":22F::SETR//REPU\n" + + ":22F::TRAN//SETT\n" + + ":22F::BDEV/T2S/IDVP\n" + + ":98A::SETT//20211129\n" + + ":98C::ASTS//20211126181652\n" + + ":98C::MTCH//20211126181652\n" + + ":98C::SCTS//20211130143000\n" + + ":97A::SAFE//XXXXXXXXXXXXXX1000XX0\n" + + ":95P::ACOW//XXXXXXXXX01\n" + + ":36B::PSTA//FAMT/50000000,\n" + + ":19A::PSTA//EUR1111111,\n" + + - ":16S:PENDET\n" + + // sequence D1a1B1a + ":16R:STAT\n" + + ":25D::SETT//PENF\n" + + - // sequence D1a1 [2] - ":16R:PENDET\n" + - ":20C::PCOM//211130067807953\n" + - ":20C::PREF//N211130067807953\n" + - ":22H::PNTP//SEFP\n" + - ":22H::CALM//SECU\n" + - ":17B::CMPU//N\n" + - ":25D::PNST//ACTV\n" + - ":19A::AMCO//EUR111,5\n" + - ":99A::DAAC//001\n" + - ":16R:CALDET\n" + - ":98A::PEDA//20211130\n" + - ":16R:FIA\n" + - ":35B:ISIN XX00000000\n" + - ":12A::CLAS/REGL/SOVR\n" + - ":92A::GOMB//0,001\n" + - ":16S:FIA\n" + - ":19A::SECU//EUR111,5\n" + - ":16S:CALDET\n" + - ":16R:RELTRAN\n" + - ":20C::ACOW//NONREF\n" + - ":20C::MITI//2111242159118671\n" + - ":16R:TRAN\n" + - ":22H::REDE//RECE\n" + - ":22H::PAYM//APMT\n" + - ":22F::SETR//TRAD\n" + - ":22F::TRAN//SETT\n" + - ":22F::BDEV/T2S/IDVP\n" + - ":98A::SETT//20211125\n" + - ":98C::ASTS//20211124181453\n" + - ":98C::MTCH//20211124181453\n" + - ":98C::SCTS//20211130143000\n" + - ":97A::SAFE//XXXXXXXXXXXXXX1000X0\n" + - ":95P::ACOW//XXXXXXXMD01\n" + - ":36B::PSTA//FAMT/50000000,\n" + - ":19A::PSTA//EUR111111111,75\n" + - ":16R:STAT\n" + - ":25D::SETT//PENF\n" + - ":16R:REAS\n" + - ":24B::PENF//CLAC\n" + - ":70D::REAS//SXAA015 - Failure of the settlement\n" + - "DESCRIPTION 1\n" + - "DESCRIPTION 2\n" + - "DESCRIPTION 3\n" + - ":16S:REAS\n" + - ":16S:STAT\n" + - ":16S:TRAN\n" + - ":16S:RELTRAN\n" + - ":16S:PENDET\n" + + // sequence D1a1B1a1 + ":16R:REAS\n" + + ":24B::PENF//CLAC\n" + + ":70D::REAS//SXAA015 - Failure of the settlement\n" + + "DESCRIPTION 101\n" + + "DESCRIPTION 102\n" + + "DESCRIPTION 103\n" + + ":16S:REAS\n" + + ":16S:STAT\n" + + ":16S:TRAN\n" + + ":16S:RELTRAN\n" + + ":16S:PENDET\n" + + - // sequence D1a1 [4] - ":16R:PENDET\n" + - ":20C::PCOM//211130067821332\n" + - ":20C::PREF//N211130067821332\n" + - ":22H::PNTP//SEFP\n" + - ":22H::CALM//SECU\n" + - ":17B::CMPU//N\n" + - ":25D::PNST//ACTV\n" + - ":19A::AMCO//EUR111,\n" + - ":99A::DAAC//001\n" + - ":16R:CALDET\n" + - ":98A::PEDA//20211130\n" + - ":16R:FIA\n" + - ":35B:ISIN XX00000000\n" + - ":12A::CLAS/REGL/SOVR\n" + - ":92A::GOMB//0,001\n" + - ":16S:FIA\n" + - ":19A::SECU//EUR111,\n" + - ":16S:CALDET\n" + - ":16R:RELTRAN\n" + - ":20C::ACOW//NONREF\n" + - ":20C::MITI//2111242159121848\n" + - ":16R:TRAN\n" + - ":22H::REDE//RECE\n" + - ":22H::PAYM//APMT\n" + - ":22F::SETR//TRAD\n" + - ":22F::TRAN//SETT\n" + - ":22F::BDEV/T2S/IDVP\n" + - ":98A::SETT//20211125\n" + - ":98C::ASTS//20211124181533\n" + - ":98C::MTCH//20211124181533\n" + - ":98C::SCTS//20211130143000\n" + - ":97A::SAFE//XXXXXXXXXXD01000L10\n" + - ":95P::ACOW//XXXXXXXMD01\n" + - ":36B::PSTA//FAMT/50000000,\n" + - ":19A::PSTA//EUR11111111,15\n" + - ":16R:STAT\n" + - ":25D::SETT//PENF\n" + - ":16R:REAS\n" + - ":24B::PENF//CLAC\n" + - ":70D::REAS//SXAA015 - Failure of the settlement\n" + - "DESCRIPTION 10\n" + - "DESCRIPTION 11\n" + - "DESCRIPTION 12\n" + - ":16S:REAS\n" + - ":16S:STAT\n" + - ":16S:TRAN\n" + - ":16S:RELTRAN\n" + - ":16S:PENDET\n" + + // sequence D1a1 [2] + ":16R:PENDET\n" + + ":20C::PCOM//211130067807953\n" + + ":20C::PREF//N211130067807953\n" + + ":22H::PNTP//SEFP\n" + + ":22H::CALM//SECU\n" + + ":17B::CMPU//N\n" + + ":25D::PNST//ACTV\n" + + ":19A::AMCO//EUR111,5\n" + + ":99A::DAAC//001\n" + + ":16R:CALDET\n" + + ":98A::PEDA//20211130\n" + + ":16R:FIA\n" + + ":35B:ISIN XX00000000\n" + + ":12A::CLAS/REGL/SOVR\n" + + ":92A::GOMB//0,001\n" + + ":16S:FIA\n" + + ":19A::SECU//EUR111,5\n" + + ":16S:CALDET\n" + + ":16R:RELTRAN\n" + + ":20C::ACOW//NONREF\n" + + ":20C::MITI//2111242159118671\n" + + ":16R:TRAN\n" + + ":22H::REDE//RECE\n" + + ":22H::PAYM//APMT\n" + + ":22F::SETR//TRAD\n" + + ":22F::TRAN//SETT\n" + + ":22F::BDEV/T2S/IDVP\n" + + ":98A::SETT//20211125\n" + + ":98C::ASTS//20211124181453\n" + + ":98C::MTCH//20211124181453\n" + + ":98C::SCTS//20211130143000\n" + + ":97A::SAFE//XXXXXXXXXXXXXX1000X0\n" + + ":95P::ACOW//XXXXXXXMD01\n" + + ":36B::PSTA//FAMT/50000000,\n" + + ":19A::PSTA//EUR111111111,75\n" + + ":16R:STAT\n" + + ":25D::SETT//PENF\n" + + ":16R:REAS\n" + + ":24B::PENF//CLAC\n" + + ":70D::REAS//SXAA015 - Failure of the settlement\n" + + "DESCRIPTION 1\n" + + "DESCRIPTION 2\n" + + "DESCRIPTION 3\n" + + ":16S:REAS\n" + + ":16S:STAT\n" + + ":16S:TRAN\n" + + ":16S:RELTRAN\n" + + ":16S:PENDET\n" + + - // sequence D1a1 [5] - ":16R:PENDET\n" + - ":20C::PCOM//211130067830614\n" + - ":20C::PREF//N211130067830614\n" + - ":22H::PNTP//SEFP\n" + - ":22H::CALM//SECU\n" + - ":17B::CMPU//N\n" + - ":25D::PNST//ACTV\n" + - ":19A::AMCO//EUR92,06\n" + - ":99A::DAAC//001\n" + - ":16R:CALDET\n" + - ":98A::PEDA//20211130\n" + - ":16R:FIA\n" + - ":35B:ISIN XX00000000\n" + - ":12A::CLAS/REGL/SOVR\n" + - ":92A::GOMB//0,001\n" + - ":16S:FIA\n" + - ":19A::SECU//EUR11,06\n" + - ":16S:CALDET\n" + - ":16R:RELTRAN\n" + - ":20C::ACOW//NONREF\n" + - ":20C::MITI//2111262161219993\n" + - ":16R:TRAN\n" + - ":22H::REDE//RECE\n" + - ":22H::PAYM//APMT\n" + - ":22F::SETR//REPU\n" + - ":22F::TRAN//SETT\n" + - ":22F::BDEV/T2S/IDVP\n" + - ":98A::SETT//20211129\n" + - ":98C::ASTS//20211126181705\n" + - ":98C::MTCH//20211126181705\n" + - ":98C::SCTS//20211130143000\n" + - ":97A::SAFE//XXXXXXXXXXXXD01000L10\n" + - ":95P::ACOW//XXXXXXXXX01\n" + - ":36B::PSTA//FAMT/7500000,\n" + - ":19A::PSTA//EUR11111111,85\n" + - ":16R:STAT\n" + - ":25D::SETT//PENF\n" + - ":16R:REAS\n" + - ":24B::PENF//CLAC\n" + - ":70D::REAS//SXAA015 - Failure of the settlement\n" + - "DESCRIPTION 13\n" + - "DESCRIPTION 14\n" + - "DESCRIPTION 15\n" + - ":16S:REAS\n" + - ":16S:STAT\n" + - ":16S:TRAN\n" + - ":16S:RELTRAN\n" + - ":16S:PENDET\n" + + // sequence D1a1 [4] + ":16R:PENDET\n" + + ":20C::PCOM//211130067821332\n" + + ":20C::PREF//N211130067821332\n" + + ":22H::PNTP//SEFP\n" + + ":22H::CALM//SECU\n" + + ":17B::CMPU//N\n" + + ":25D::PNST//ACTV\n" + + ":19A::AMCO//EUR111,\n" + + ":99A::DAAC//001\n" + + ":16R:CALDET\n" + + ":98A::PEDA//20211130\n" + + ":16R:FIA\n" + + ":35B:ISIN XX00000000\n" + + ":12A::CLAS/REGL/SOVR\n" + + ":92A::GOMB//0,001\n" + + ":16S:FIA\n" + + ":19A::SECU//EUR111,\n" + + ":16S:CALDET\n" + + ":16R:RELTRAN\n" + + ":20C::ACOW//NONREF\n" + + ":20C::MITI//2111242159121848\n" + + ":16R:TRAN\n" + + ":22H::REDE//RECE\n" + + ":22H::PAYM//APMT\n" + + ":22F::SETR//TRAD\n" + + ":22F::TRAN//SETT\n" + + ":22F::BDEV/T2S/IDVP\n" + + ":98A::SETT//20211125\n" + + ":98C::ASTS//20211124181533\n" + + ":98C::MTCH//20211124181533\n" + + ":98C::SCTS//20211130143000\n" + + ":97A::SAFE//XXXXXXXXXXD01000L10\n" + + ":95P::ACOW//XXXXXXXMD01\n" + + ":36B::PSTA//FAMT/50000000,\n" + + ":19A::PSTA//EUR11111111,15\n" + + ":16R:STAT\n" + + ":25D::SETT//PENF\n" + + ":16R:REAS\n" + + ":24B::PENF//CLAC\n" + + ":70D::REAS//SXAA015 - Failure of the settlement\n" + + "DESCRIPTION 10\n" + + "DESCRIPTION 11\n" + + "DESCRIPTION 12\n" + + ":16S:REAS\n" + + ":16S:STAT\n" + + ":16S:TRAN\n" + + ":16S:RELTRAN\n" + + ":16S:PENDET\n" + + - ":16S:PENACOUNT\n" + - ":16S:PENACUR\n" + - ":16S:PENA\n" + - "-}{5:{CHK:0F4F93C68EA5}{TNG:}}"; - MT537 mt537= MT537.parse(fin); + // sequence D1a1 [5] + ":16R:PENDET\n" + + ":20C::PCOM//211130067830614\n" + + ":20C::PREF//N211130067830614\n" + + ":22H::PNTP//SEFP\n" + + ":22H::CALM//SECU\n" + + ":17B::CMPU//N\n" + + ":25D::PNST//ACTV\n" + + ":19A::AMCO//EUR92,06\n" + + ":99A::DAAC//001\n" + + ":16R:CALDET\n" + + ":98A::PEDA//20211130\n" + + ":16R:FIA\n" + + ":35B:ISIN XX00000000\n" + + ":12A::CLAS/REGL/SOVR\n" + + ":92A::GOMB//0,001\n" + + ":16S:FIA\n" + + ":19A::SECU//EUR11,06\n" + + ":16S:CALDET\n" + + ":16R:RELTRAN\n" + + ":20C::ACOW//NONREF\n" + + ":20C::MITI//2111262161219993\n" + + ":16R:TRAN\n" + + ":22H::REDE//RECE\n" + + ":22H::PAYM//APMT\n" + + ":22F::SETR//REPU\n" + + ":22F::TRAN//SETT\n" + + ":22F::BDEV/T2S/IDVP\n" + + ":98A::SETT//20211129\n" + + ":98C::ASTS//20211126181705\n" + + ":98C::MTCH//20211126181705\n" + + ":98C::SCTS//20211130143000\n" + + ":97A::SAFE//XXXXXXXXXXXXD01000L10\n" + + ":95P::ACOW//XXXXXXXXX01\n" + + ":36B::PSTA//FAMT/7500000,\n" + + ":19A::PSTA//EUR11111111,85\n" + + ":16R:STAT\n" + + ":25D::SETT//PENF\n" + + ":16R:REAS\n" + + ":24B::PENF//CLAC\n" + + ":70D::REAS//SXAA015 - Failure of the settlement\n" + + "DESCRIPTION 13\n" + + "DESCRIPTION 14\n" + + "DESCRIPTION 15\n" + + ":16S:REAS\n" + + ":16S:STAT\n" + + ":16S:TRAN\n" + + ":16S:RELTRAN\n" + + ":16S:PENDET\n" + + ":16S:PENACOUNT\n" + + ":16S:PENACUR\n" + + ":16S:PENA\n" + + "-}{5:{CHK:0F4F93C68EA5}{TNG:}}"; + MT537 mt537 = MT537.parse(fin); List sequences = mt537.getSequenceBList(); assertEquals(1, sequences.size()); } diff --git a/src/test/java/com/prowidesoftware/issues/Issue95.java b/src/test/java/com/prowidesoftware/issues/Issue95.java index b260d5a1d..e8cf28f69 100644 --- a/src/test/java/com/prowidesoftware/issues/Issue95.java +++ b/src/test/java/com/prowidesoftware/issues/Issue95.java @@ -24,5 +24,4 @@ public String getValue() { return super.getValue() + "FOO"; } } - } diff --git a/src/test/java/com/prowidesoftware/issues/IssueGh148Test.java b/src/test/java/com/prowidesoftware/issues/IssueGh148Test.java index c8540024e..e5fd2138d 100644 --- a/src/test/java/com/prowidesoftware/issues/IssueGh148Test.java +++ b/src/test/java/com/prowidesoftware/issues/IssueGh148Test.java @@ -17,30 +17,25 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import com.prowidesoftware.swift.io.ConversionService; -import com.prowidesoftware.swift.io.IConversionService; -import com.prowidesoftware.swift.io.parser.SwiftParser; import com.prowidesoftware.swift.model.field.Field61; import com.prowidesoftware.swift.model.mt.mt9xx.MT940; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.util.List; +import org.junit.jupiter.api.Test; public class IssueGh148Test { @Test public void test() throws IOException { - String fin = "{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\r\n" + - ":20:REFXXXXX\r\n" + - ":25:K005201001004509050156\r\n" + - ":28C:00001\r\n" + - ":60F:C051007XOF2644893271,0\r\n" + - ":61:2212051205C,32NDIV252100549047714//RJHIPSH2233901WI000001215560\r\n" + - ":62F:C061207XOF4123944619,0\r\n" + - ":86:Message de bienvenue\r\n" + - ":62M:C100921ZAR499650,23\r\n" + - "-}"; + String fin = "{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\r\n" + ":20:REFXXXXX\r\n" + + ":25:K005201001004509050156\r\n" + + ":28C:00001\r\n" + + ":60F:C051007XOF2644893271,0\r\n" + + ":61:2212051205C,32NDIV252100549047714//RJHIPSH2233901WI000001215560\r\n" + + ":62F:C061207XOF4123944619,0\r\n" + + ":86:Message de bienvenue\r\n" + + ":62M:C100921ZAR499650,23\r\n" + + "-}"; MT940 mt940 = MT940.parse(fin); List field61List = mt940.getField61(); assertEquals(1, field61List.size()); @@ -48,5 +43,4 @@ public void test() throws IOException { double amount = field61.getComponentAsNumber(Field61.AMOUNT).doubleValue(); assertEquals(0.32d, amount); } - } diff --git a/src/test/java/com/prowidesoftware/issues/JapaneseCharactersTest.java b/src/test/java/com/prowidesoftware/issues/JapaneseCharactersTest.java index 2f7f95774..5185b74d2 100644 --- a/src/test/java/com/prowidesoftware/issues/JapaneseCharactersTest.java +++ b/src/test/java/com/prowidesoftware/issues/JapaneseCharactersTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,9 @@ import com.prowidesoftware.swift.model.field.Field86; import com.prowidesoftware.swift.model.mt.mt9xx.MT940; import com.prowidesoftware.swift.utils.Lib; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.nio.charset.StandardCharsets; +import org.junit.jupiter.api.Test; /** * https://sourceforge.net/p/wife/discussion/544817/thread/f8f66a6d/ @@ -34,21 +33,23 @@ public class JapaneseCharactersTest { @Test public void testRJEFromFile() throws IOException { - RJEReader reader = new RJEReader(this.getClass().getResourceAsStream("/sample_JPchar.txt"), StandardCharsets.UTF_8); + RJEReader reader = + new RJEReader(this.getClass().getResourceAsStream("/sample_JPchar.txt"), StandardCharsets.UTF_8); MT940 mt = (MT940) reader.nextMT(); assertNotNull(mt); Field86 field86 = mt.getField86().get(0); - //System.out.println(mt.message()); + // System.out.println(mt.message()); assertEquals("゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT", field86.getComponent2()); } @Test public void testRJEFromFile2() throws IOException { - RJEReader reader = new RJEReader(Lib.readStream(this.getClass().getResourceAsStream("/sample_JPchar.txt"), StandardCharsets.UTF_8)); + RJEReader reader = new RJEReader( + Lib.readStream(this.getClass().getResourceAsStream("/sample_JPchar.txt"), StandardCharsets.UTF_8)); MT940 mt = (MT940) reader.nextMT(); assertNotNull(mt); Field86 field86 = mt.getField86().get(0); - //System.out.println(mt.message()); + // System.out.println(mt.message()); assertEquals("゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT", field86.getComponent2()); } @@ -57,30 +58,28 @@ public void testMTFromFile() throws IOException { MT940 mt = new MT940(this.getClass().getResourceAsStream("/sample_JPchar.txt")); assertNotNull(mt); Field86 field86 = mt.getField86().get(0); - //System.out.println(mt.message()); + // System.out.println(mt.message()); assertEquals("゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT", field86.getComponent2()); } @Test public void testMTFromString() { - MT940 mt = new MT940("{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\n" + - ":20:ABC123456530012\n" + - ":25:987654321\n" + - ":28C:00046/00001\n" + - ":60F:C180312JPY15459988,\n" + - ":61:3454543545CY1234,NTRFNONREF//AABB-01111\n" + - ":86:/OP/トクテイヒカツドウホウジ\n" + - "゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT\n" + - "VNRWINWNGWRIGNWIORNGIWRNIGNWORGNORNGIRIOGNJ /OI/ミト\n" + - "モ カンダ MOFRBGEOEBTIBD MNEJFO /EDI//REF/AABB-01111\n" + - ":62F:C180312JPY17062895,\n" + - ":64:C180312JPY17062895,\n" + - ":86:/ABD/BANKJPJT \n" + - "-}"); + MT940 mt = new MT940("{1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\n" + ":20:ABC123456530012\n" + + ":25:987654321\n" + + ":28C:00046/00001\n" + + ":60F:C180312JPY15459988,\n" + + ":61:3454543545CY1234,NTRFNONREF//AABB-01111\n" + + ":86:/OP/トクテイヒカツドウホウジ\n" + + "゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT\n" + + "VNRWINWNGWRIGNWIORNGIWRNIGNWORGNORNGIRIOGNJ /OI/ミト\n" + + "モ カンダ MOFRBGEOEBTIBD MNEJFO /EDI//REF/AABB-01111\n" + + ":62F:C180312JPY17062895,\n" + + ":64:C180312JPY17062895,\n" + + ":86:/ABD/BANKJPJT \n" + + "-}"); assertNotNull(mt); Field86 field86 = mt.getField86().get(0); - //System.out.println(mt.message()); + // System.out.println(mt.message()); assertEquals("゙アタイヘイヨウセンタ- AFEISEOHFIOSEIOIRT", field86.getComponent2()); } - } diff --git a/src/test/java/com/prowidesoftware/issues/Jira1341.java b/src/test/java/com/prowidesoftware/issues/Jira1341.java index 0b653983f..2be6ca8c8 100644 --- a/src/test/java/com/prowidesoftware/issues/Jira1341.java +++ b/src/test/java/com/prowidesoftware/issues/Jira1341.java @@ -2,21 +2,18 @@ import com.prowidesoftware.swift.model.field.Field50K; import org.junit.jupiter.api.Test; + public class Jira1341 { @Test void testLogPollutionField50K() { // given - Field50K field50K = new Field50K("/112224-55\n" + - "AAA BBB\n" + - "AAAAAAAA 10,2ND FLOOR\n" + - "BBBBBBBBB 104"); + Field50K field50K = new Field50K("/112224-55\n" + "AAA BBB\n" + "AAAAAAAA 10,2ND FLOOR\n" + "BBBBBBBBB 104"); // when field50K.getValueDisplay(); // then - //Assertions.fail("see log pollution through exception..."); + // Assertions.fail("see log pollution through exception..."); } - } diff --git a/src/test/java/com/prowidesoftware/issues/TabInFieldValueTest.java b/src/test/java/com/prowidesoftware/issues/TabInFieldValueTest.java index 24a3e03d0..59849018e 100644 --- a/src/test/java/com/prowidesoftware/issues/TabInFieldValueTest.java +++ b/src/test/java/com/prowidesoftware/issues/TabInFieldValueTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,48 +30,46 @@ public class TabInFieldValueTest { private static final String REF_ACC_OWN = "REFERENCE_BB_ACCOUNTOWNER"; private static final String REF_ACC_OWN_TAB = "REFERENCE_\u000b\u000b_ACCOUNTOWNER"; private static final String REF_ACC_OWN_TAB2 = "\u000b\u000b"; - private static final String MESSAGE = "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + - ":20:1234567890123456\n" + - ":25:ABCDEFGHXXX/12345678\n" + - ":28C:12345\n" + - ":60F:C180418CNY0,00\n" + - ":61:1804190419D93366,00NTRFREFERENCE_BB_ACCOUNTOWNER//NNN 123456789012\n" + - "MULTITUDE\n" + - ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + - ":62F:C180419CNY0,00\n" + - ":64:C180419CNY0,00\n" + - "-}"; - private static final String MESSAGE_TAB = "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + - ":20:1234567890123456\n" + - ":25:ABCDEFGHXXX/12345678\n" + - ":28C:12345\n" + - ":60F:C180418CNY0,00\n" + - ":61:1804190419D93366,00NTRFREFERENCE_\u000b\u000b_ACCOUNTOWNER//NNN 123456789012\n" + - "MULTITUDE\n" + - ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + - ":62F:C180419CNY0,00\n" + - ":64:C180419CNY0,00\n" + - "-}"; - private static final String MESSAGE_TAB2 = "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + - ":20:1234567890123456\n" + - ":25:ABCDEFGHXXX/12345678\n" + - ":28C:12345\n" + - ":60F:C180418CNY0,00\n" + - ":61:1804190419D93366,00NTRF\u000b\u000b//NNN 123456789012\n" + - "MULTITUDE\n" + - ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + - ":62F:C180419CNY0,00\n" + - ":64:C180419CNY0,00\n" + - "-}"; + private static final String MESSAGE = + "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + ":20:1234567890123456\n" + + ":25:ABCDEFGHXXX/12345678\n" + + ":28C:12345\n" + + ":60F:C180418CNY0,00\n" + + ":61:1804190419D93366,00NTRFREFERENCE_BB_ACCOUNTOWNER//NNN 123456789012\n" + + "MULTITUDE\n" + + ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + + ":62F:C180419CNY0,00\n" + + ":64:C180419CNY0,00\n" + + "-}"; + private static final String MESSAGE_TAB = + "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + ":20:1234567890123456\n" + + ":25:ABCDEFGHXXX/12345678\n" + + ":28C:12345\n" + + ":60F:C180418CNY0,00\n" + + ":61:1804190419D93366,00NTRFREFERENCE_\u000b\u000b_ACCOUNTOWNER//NNN 123456789012\n" + + "MULTITUDE\n" + + ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + + ":62F:C180419CNY0,00\n" + + ":64:C180419CNY0,00\n" + + "-}"; + private static final String MESSAGE_TAB2 = + "{1:F01ABCDEFGHXXX0000000000}{2:I940WOWAUS6CUXXXX}{4:\n" + ":20:1234567890123456\n" + + ":25:ABCDEFGHXXX/12345678\n" + + ":28C:12345\n" + + ":60F:C180418CNY0,00\n" + + ":61:1804190419D93366,00NTRF\u000b\u000b//NNN 123456789012\n" + + "MULTITUDE\n" + + ":86:/YYYY/\u000b\u000b MARKMS1234/PPPP/RRR93366,00/RASK/\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\u000b\n" + + ":62F:C180419CNY0,00\n" + + ":64:C180419CNY0,00\n" + + "-}"; @Test public void test() { - Field61 field = new Field61(":61:1804190419D56716,17NTRF\u000b//XXX 18041900259\n" + - "FX-NORMAL TRANSACTION"); + Field61 field = new Field61(":61:1804190419D56716,17NTRF\u000b//XXX 18041900259\n" + "FX-NORMAL TRANSACTION"); assertNotNull(field); - Field61 field2 = new Field61(":61:1804190419D56716,17NTRF\t//XXX 18041900259\n" + - "FX-NORMAL TRANSACTION"); + Field61 field2 = new Field61(":61:1804190419D56716,17NTRF\t//XXX 18041900259\n" + "FX-NORMAL TRANSACTION"); assertNotNull(field2); } @@ -96,5 +94,4 @@ public void messageTab() { public void messageTab2() { test(REF_ACC_OWN_TAB2, MESSAGE_TAB2); } - } diff --git a/src/test/java/com/prowidesoftware/swift/Constants.java b/src/test/java/com/prowidesoftware/swift/Constants.java index 1f1431761..fd1529e22 100644 --- a/src/test/java/com/prowidesoftware/swift/Constants.java +++ b/src/test/java/com/prowidesoftware/swift/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,40 +24,34 @@ public interface Constants { String B1_DATA = "F01BANKBEBBAXXX2222123456"; - String B1_DATA_XML = - "\n\t" + - "\n\tF" + - "\n\t01" + - "\n\tBANKBEBBAXXX" + - "\n\t2222" + - "\n\t123456" + - "\n"; + String B1_DATA_XML = "\n\t" + "\n\tF" + + "\n\t01" + + "\n\tBANKBEBBAXXX" + + "\n\t2222" + + "\n\t123456" + + "\n"; String B2_INPUT = "I100BANKDEFFXXXXU3003"; - String B2_INPUT_XML = - "\n\t" + - "\n\t100" + - "\n\tBANKDEFFXXXX" + - "\n\tU" + - "\n\t3" + - "\n\t003" + - "\n"; + String B2_INPUT_XML = "\n\t" + "\n\t100" + + "\n\tBANKDEFFXXXX" + + "\n\tU" + + "\n\t3" + + "\n\t003" + + "\n"; String B2_OUTPUT = "O1001200970103BANKBEBBAXXX22221234569701031201N"; - String B2_OUTPUT_XML = - "\n\t" + - "\n\t100" + - "\n\t1200" + - "\n\t970103" + - "\n\tBANKBEBBAXXX" + - "\n\t2222" + - "\n\t123456" + - "\n\t970103" + - "\n\t1201" + - "\n\tN" + - "\n"; + String B2_OUTPUT_XML = "\n\t" + "\n\t100" + + "\n\t1200" + + "\n\t970103" + + "\n\tBANKBEBBAXXX" + + "\n\t2222" + + "\n\t123456" + + "\n\t970103" + + "\n\t1201" + + "\n\tN" + + "\n"; String B3_DATA = "{n:v}{n2:v2}"; } diff --git a/src/test/java/com/prowidesoftware/swift/GeneralAPITest.java b/src/test/java/com/prowidesoftware/swift/GeneralAPITest.java index 7f789073e..40c5f73dc 100644 --- a/src/test/java/com/prowidesoftware/swift/GeneralAPITest.java +++ b/src/test/java/com/prowidesoftware/swift/GeneralAPITest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -27,7 +26,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - /** * Conversion services test. * @@ -55,21 +53,22 @@ public void setUp() { */ @Test public void testGetMTFromFIN() { - String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + - ":20:AMLX985338-D4E5E\n" + - ":23B:CRED\n" + - ":32A:051018EUR66969,52\n" + - ":33B:EUR66969,52\n" + - ":50K:Foo SA\n" + - ":53A:DEUTDEFF\n" + - ":54A://RT\n" + - "FOOBARYY\n" + - ":59:/-\n" + - "Tressis SA\n" + - ":70:/CS BD ST EUR B\n" + - "REDEMPTION AMLX985338\n" + - ":71A:OUR\n" + - "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; + String fin = + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + + ":20:AMLX985338-D4E5E\n" + + ":23B:CRED\n" + + ":32A:051018EUR66969,52\n" + + ":33B:EUR66969,52\n" + + ":50K:Foo SA\n" + + ":53A:DEUTDEFF\n" + + ":54A://RT\n" + + "FOOBARYY\n" + + ":59:/-\n" + + "Tressis SA\n" + + ":70:/CS BD ST EUR B\n" + + "REDEMPTION AMLX985338\n" + + ":71A:OUR\n" + + "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; msg = srv.getMessageFromFIN(fin); assertNotNull(msg); SwiftBlock4 b4 = msg.getBlock4(); @@ -83,26 +82,26 @@ public void testGetMTFromFIN() { */ @Test public void testGetMTFromFIN2() { - String fin2 = "{1:F01FOOBARCAAXXX5306843322}{2:O2021128081024FOOSUS33DXXX19330576120810241058N}{4:\n" + - ":20:TCPLO200919447\n" + - ":21:345234\n" + - ":32A:091118USD2345234,3\n" + - ":53B:/00010013800002000114\n" + - "FOO BANK\n" + - ":58D:/00013500510020179998\n" + - "FOO NAME\n" + - "R00000V234234\n" + - ":72:/TIPO/419\n" + - "/PLAZO/3\n" + - "/TASA/4\n" + - "-}"; + String fin2 = "{1:F01FOOBARCAAXXX5306843322}{2:O2021128081024FOOSUS33DXXX19330576120810241058N}{4:\n" + + ":20:TCPLO200919447\n" + + ":21:345234\n" + + ":32A:091118USD2345234,3\n" + + ":53B:/00010013800002000114\n" + + "FOO BANK\n" + + ":58D:/00013500510020179998\n" + + "FOO NAME\n" + + "R00000V234234\n" + + ":72:/TIPO/419\n" + + "/PLAZO/3\n" + + "/TASA/4\n" + + "-}"; msg = srv.getMessageFromFIN(fin2); assertNotNull(msg); SwiftBlock4 b4 = msg.getBlock4(); assertNotNull(b4); assertEquals("TCPLO200919447", b4.getTagByName("20").getValue()); assertEquals("091118USD2345234,3", b4.getTagByName("32A").getValue()); - // assertEquals((new Double(2345234.3)).doubleValue(), mt202.getField32A().getComponent3AsNumber().doubleValue()); + // assertEquals((new Double(2345234.3)).doubleValue(), + // mt202.getField32A().getComponent3AsNumber().doubleValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/RJEReaderTest.java b/src/test/java/com/prowidesoftware/swift/io/RJEReaderTest.java index d402847f4..85bf77c06 100644 --- a/src/test/java/com/prowidesoftware/swift/io/RJEReaderTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/RJEReaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.nio.charset.StandardCharsets; - +import org.junit.jupiter.api.Test; /** * Test cases for the {@link RJEReader} class @@ -35,11 +33,12 @@ public class RJEReaderTest { @Test public void testIterator() { - RJEReader r = new RJEReader(this.getClass().getResourceAsStream("/MT103-out-ack.rje"), StandardCharsets.US_ASCII); + RJEReader r = + new RJEReader(this.getClass().getResourceAsStream("/MT103-out-ack.rje"), StandardCharsets.US_ASCII); int count = 0; for (String m : r) { assertNotNull(m); - //System.out.println("msg "+(count)); + // System.out.println("msg "+(count)); count++; } assertEquals(13, count); @@ -65,17 +64,17 @@ public void testIteratorNotReentrant() { assertEquals("foo", m); } }, - "Expected iterator to throw IllegalStateException, but it didn't" - ); + "Expected iterator to throw IllegalStateException, but it didn't"); } @Test public void testIterableWithNextMT() throws IOException { - RJEReader r = new RJEReader(this.getClass().getResourceAsStream("/MT103-out-ack.rje"), StandardCharsets.US_ASCII); + RJEReader r = + new RJEReader(this.getClass().getResourceAsStream("/MT103-out-ack.rje"), StandardCharsets.US_ASCII); assertTrue(r.hasNext()); AbstractMT mt = r.nextMT(); assertNotNull(mt); - //System.out.println(mt.message()); + // System.out.println(mt.message()); assertEquals("103", mt.getMessageType()); } @@ -91,14 +90,16 @@ public void testIterableWithInvalidString() throws IOException { @Test public void testDeliveryNotification() throws IOException { - RJEReader r = new RJEReader("{1:F01AAAAFRPPZXXX0000000001}{2:O0111702090738DYLRXXXXCXXX00000000001702090738S}{4:{175:0741}{106:170209AAAAFRPPZXXX0000000002}{108:REF1}{175:0741}{107:170209AAAAFRPPXXXX0000000002}}{5:{CHK:ABCDEF123456}{SYS:}}$"); + RJEReader r = new RJEReader( + "{1:F01AAAAFRPPZXXX0000000001}{2:O0111702090738DYLRXXXXCXXX00000000001702090738S}{4:{175:0741}{106:170209AAAAFRPPZXXX0000000002}{108:REF1}{175:0741}{107:170209AAAAFRPPXXXX0000000002}}{5:{CHK:ABCDEF123456}{SYS:}}$"); assertNotNull(r.nextMT()); assertNull(r.nextMT()); } @Test public void testBulkFileWithAcks() throws IOException { - RJEReader r = new RJEReader(this.getClass().getResourceAsStream("/MT103-bulk-with-ack.rje"), StandardCharsets.US_ASCII); + RJEReader r = new RJEReader( + this.getClass().getResourceAsStream("/MT103-bulk-with-ack.rje"), StandardCharsets.US_ASCII); int count = 0; while (r.hasNext()) { SwiftMessage ack = r.nextSwiftMessage(); @@ -107,10 +108,9 @@ public void testBulkFileWithAcks() throws IOException { SwiftMessage mt = SwiftMessage.parse(ack.getUnparsedTexts().getAsFINString()); assertNotNull(mt); assertTrue(mt.isType(103)); - //System.out.println(mt.getBlock4().getTagValue("20")); + // System.out.println(mt.getBlock4().getTagValue("20")); count++; } assertEquals(3, count); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/RJEWriterTest.java b/src/test/java/com/prowidesoftware/swift/io/RJEWriterTest.java index 3ca81a003..fa5db1fba 100644 --- a/src/test/java/com/prowidesoftware/swift/io/RJEWriterTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/RJEWriterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,9 @@ import com.prowidesoftware.swift.io.writer.FINWriterVisitor; import com.prowidesoftware.swift.model.mt.mt1xx.MT103; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.io.StringWriter; +import org.junit.jupiter.api.Test; /** * Test cases for the {@link RJEWriter} class @@ -48,7 +47,12 @@ public void test2() throws IOException { MT103 mt = new MT103(); w.write(mt); w.write(mt); - assertEquals(s.toString(), mt.message() + FINWriterVisitor.SWIFT_EOL + RJEReader.SPLITCHAR + FINWriterVisitor.SWIFT_EOL + mt.message()); + assertEquals( + s.toString(), + mt.message() + + FINWriterVisitor.SWIFT_EOL + + RJEReader.SPLITCHAR + + FINWriterVisitor.SWIFT_EOL + + mt.message()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/BaseMessageTestcase.java b/src/test/java/com/prowidesoftware/swift/io/parser/BaseMessageTestcase.java index 54adacb6b..9c3cde2c2 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/BaseMessageTestcase.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/BaseMessageTestcase.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.fail; import com.prowidesoftware.swift.model.*; - import java.io.IOException; import java.io.InputStream; import java.io.StringReader; @@ -64,13 +63,11 @@ protected String readMessageFromInputStream(InputStream is) { int c; do { c = is.read(); - if (c != '$' && c != -1) - msgBuf.append((char) c); + if (c != '$' && c != -1) msgBuf.append((char) c); } while (c != '$' && c != -1); // check for end of input - if (msgBuf.length() > 0) - s = msgBuf.toString(); + if (msgBuf.length() > 0) s = msgBuf.toString(); } catch (IOException e) { fail("Reading input file: FAILED [" + e.getMessage() + "]"); } @@ -129,5 +126,4 @@ protected void assertAllBlocksNonNull(SwiftMessage o) { assertNotNull(o.getBlock4(), "Block 4 is null"); assertNotNull(o.getBlock5(), "Block 5 is null"); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java index 5044bdcb1..af91c98c1 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import com.prowidesoftware.swift.model.SwiftBlock2Output; -import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.model.field.Field72; import com.prowidesoftware.swift.model.field.Narrative; import com.prowidesoftware.swift.model.field.StructuredNarrative; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * MT103 tests @@ -35,25 +33,26 @@ public class MT103ParserTest extends BaseMessageTestcase { @Test public void test103_1() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:D051026EUR100057\n" + - ":13C:/RNCTIME/0802+0000\n" + - ":23B:CRED\n" + - ":32A:051028EUR6740,91\n" + - ":33B:EUR6740,91\n" + - ":50A:SSSSESMMXXX\n" + - ":53A:BBBBESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/ES0123456789012345671234\n" + - "FOOOOO 1000 FOOBAR S.A.\n" + - ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + - "/123123123: FOOVIMAR 2000 FOOBAR\n" + - ":71A:SHA\n" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + + ":13C:/RNCTIME/0802+0000\n" + + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + + ":33B:EUR6740,91\n" + + ":50A:SSSSESMMXXX\n" + + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/ES0123456789012345671234\n" + + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + + "/123123123: FOOVIMAR 2000 FOOBAR\n" + + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -61,7 +60,7 @@ public void test103_1() { assertEquals("1234", b1.getSessionNumber()); assertEquals("123456", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("O1030803051028AAPBESMMAXXX54237368560510280803N", b2.getBlockValue()); assertEquals("103", b2.getMessageType()); assertEquals("0803", ((SwiftBlock2Output) b2).getSenderInputTime()); @@ -74,13 +73,13 @@ public void test103_1() { assertEquals("0803", ((SwiftBlock2Output) b2).getReceiverOutputTime()); assertEquals("N", b2.getMessagePriority()); - //check b3 + // check b3 assertEquals(3, b3.countAll()); assertEquals("NOMF", b3.getTagValue("113")); assertEquals("0510280086100057", b3.getTagValue("108")); assertEquals("STP", b3.getTagValue("119")); - //check b4 + // check b4 assertEquals(11, b4.countAll()); assertEquals("D051026EUR100057", b4.getTagValue("20")); assertEquals("/RNCTIME/0802+0000", b4.getTagValue("13C")); @@ -94,7 +93,7 @@ public void test103_1() { assertEquals("REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR", b4.getTagValue("70")); assertEquals("SHA", b4.getTagValue("71A")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("D9D8FA56", b5.getTagValue("MAC")); assertEquals("46E46A6460F2", b5.getTagValue("CHK")); @@ -102,47 +101,48 @@ public void test103_1() { @Test public void test103_2() { - messageToParse = "{1:F01FOOBARXXAXXX1234123456}{2:O1031041060411AAABESMMAXXX55944670160604111041N}{3:{113:ROMF}{108:0604113641000001}{119:STP}}{4:\n" + - ":20:1234123421340001\n" + - ":13C:/RNCTIME/1040+0000\n" + - ":23B:CRED\n" + - ":23E:SDVA\n" + - ":23E:CORT\n" + - ":32A:010411EUR1275000,\n" + - ":33B:EUR1234567,\n" + - ":50A:ABCEESM1XXX\n" + - ":52A:ABCEESM1XXX\n" + - ":53A:ABCEESM1XXX\n" + - ":57A:FOOBARXXXXX\n" + - ":59:/ES1234123412341234123412\n" + - "FOOBAR SECURITIES S.V. S.A\n" + - ":71A:OUR\n" + - "-}{5:{MAC:184123B4}{CHK:5EFE8E14DF81}}"; + messageToParse = + "{1:F01FOOBARXXAXXX1234123456}{2:O1031041060411AAABESMMAXXX55944670160604111041N}{3:{113:ROMF}{108:0604113641000001}{119:STP}}{4:\n" + + ":20:1234123421340001\n" + + ":13C:/RNCTIME/1040+0000\n" + + ":23B:CRED\n" + + ":23E:SDVA\n" + + ":23E:CORT\n" + + ":32A:010411EUR1275000,\n" + + ":33B:EUR1234567,\n" + + ":50A:ABCEESM1XXX\n" + + ":52A:ABCEESM1XXX\n" + + ":53A:ABCEESM1XXX\n" + + ":57A:FOOBARXXXXX\n" + + ":59:/ES1234123412341234123412\n" + + "FOOBAR SECURITIES S.V. S.A\n" + + ":71A:OUR\n" + + "-}{5:{MAC:184123B4}{CHK:5EFE8E14DF81}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1031041060411AAABESMMAXXX55944670160604111041N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(3, b3.countAll()); assertEquals("ROMF", b3.getTagValue("113")); assertEquals("0604113641000001", b3.getTagValue("108")); assertEquals("STP", b3.getTagValue("119")); - //check b4 + // check b4 assertEquals(13, b4.countAll()); assertEquals("1234123421340001", b4.getTagValue("20")); assertEquals("/RNCTIME/1040+0000", b4.getTagValue("13C")); assertEquals("CRED", b4.getTagValue("23B")); - //first ocurrence of 23E + // first ocurrence of 23E assertEquals("SDVA", b4.getTagValue("23E")); - //all ocurrences of 23E + // all ocurrences of 23E tags = b4.getTagsByName("23E"); assertEquals("SDVA", tags[0].getValue()); assertEquals("CORT", tags[1].getValue()); @@ -156,7 +156,7 @@ public void test103_2() { assertEquals("/ES1234123412341234123412\n" + "FOOBAR SECURITIES S.V. S.A", b4.getTagValue("59")); assertEquals("OUR", b4.getTagValue("71A")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("184123B4", b5.getTagValue("MAC")); assertEquals("5EFE8E14DF81", b5.getTagValue("CHK")); @@ -164,49 +164,50 @@ public void test103_2() { @Test public void test103_3() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030954060228RRRRESMMAXXX55549966520602280954N}{3:{113:NOMT}{108:2006022800940029}{119:STP}}{4:\n" + - ":20:B185008345547244\n" + - ":13C:/SNDTIME/0951+0100\n" + - ":13C:/RNCTIME/0952+0100\n" + - ":23B:CRED\n" + - ":32A:010228EUR2999,66\n" + - ":33B:EUR2999,66\n" + - ":50K:FOOOBANK NA EUR (LONDON BRANCH) LVL\n" + - "12, FOOOGROUP CENT. CANADA SQ., CA\n" + - "NNNN WWWWW, LONDON E99 5LB CONTACT\n" + - "99 (0) 999 999 9999 GCNPPCCY FOOO\n" + - ":52A://TAGBFOOOGB2LXXXB185008345547244\n" + - "FOOOIE2X\n" + - ":53A:/0951A060228GBES00350\n" + - "FOONGB2L\n" + - ":57A:FOOBARYY\n" + - ":59:/ES8700940001822410908524\n" + - "FOO CAPITAL ADVISORS\n" + - "SPAIN AGENCIA DE VALORES\n" + - "PLAZA XXXXXX YYYYY ZZZZZZ 9\n" + - "MADRID,\n" + - ":70:B0706\n" + - ":71A:BEN\n" + - ":71F:EUR0,\n" + - ":72:/ACC/BANKXXXX FOOOOOOOO, 20\n" + - "//MADRID,\n" + - "-}{5:{MAC:07CDCC9A}{CHK:AD1FAEE8537B}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030954060228RRRRESMMAXXX55549966520602280954N}{3:{113:NOMT}{108:2006022800940029}{119:STP}}{4:\n" + + ":20:B185008345547244\n" + + ":13C:/SNDTIME/0951+0100\n" + + ":13C:/RNCTIME/0952+0100\n" + + ":23B:CRED\n" + + ":32A:010228EUR2999,66\n" + + ":33B:EUR2999,66\n" + + ":50K:FOOOBANK NA EUR (LONDON BRANCH) LVL\n" + + "12, FOOOGROUP CENT. CANADA SQ., CA\n" + + "NNNN WWWWW, LONDON E99 5LB CONTACT\n" + + "99 (0) 999 999 9999 GCNPPCCY FOOO\n" + + ":52A://TAGBFOOOGB2LXXXB185008345547244\n" + + "FOOOIE2X\n" + + ":53A:/0951A060228GBES00350\n" + + "FOONGB2L\n" + + ":57A:FOOBARYY\n" + + ":59:/ES8700940001822410908524\n" + + "FOO CAPITAL ADVISORS\n" + + "SPAIN AGENCIA DE VALORES\n" + + "PLAZA XXXXXX YYYYY ZZZZZZ 9\n" + + "MADRID,\n" + + ":70:B0706\n" + + ":71A:BEN\n" + + ":71F:EUR0,\n" + + ":72:/ACC/BANKXXXX FOOOOOOOO, 20\n" + + "//MADRID,\n" + + "-}{5:{MAC:07CDCC9A}{CHK:AD1FAEE8537B}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1030954060228RRRRESMMAXXX55549966520602280954N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(3, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2006022800940029", b3.getTagValue("108")); assertEquals("STP", b3.getTagValue("119")); - //check b4 + // check b4 assertEquals(15, b4.countAll()); assertEquals("B185008345547244", b4.getTagValue("20")); @@ -218,20 +219,26 @@ public void test103_3() { assertEquals("010228EUR2999,66", b4.getTagValue("32A")); assertEquals("EUR2999,66", b4.getTagValue("33B")); - assertEquals("FOOOBANK NA EUR (LONDON BRANCH) LVL\n" + "12, FOOOGROUP CENT. CANADA SQ., CA\n" + "NNNN WWWWW, LONDON E99 5LB CONTACT\n" + "99 (0) 999 999 9999 GCNPPCCY FOOO", b4.getTagValue("50K")); + assertEquals( + "FOOOBANK NA EUR (LONDON BRANCH) LVL\n" + "12, FOOOGROUP CENT. CANADA SQ., CA\n" + + "NNNN WWWWW, LONDON E99 5LB CONTACT\n" + "99 (0) 999 999 9999 GCNPPCCY FOOO", + b4.getTagValue("50K")); assertEquals("//TAGBFOOOGB2LXXXB185008345547244\n" + "FOOOIE2X", b4.getTagValue("52A")); assertEquals("/0951A060228GBES00350\n" + "FOONGB2L", b4.getTagValue("53A")); assertEquals("FOOBARYY", b4.getTagValue("57A")); - assertEquals("/ES8700940001822410908524\n" + "FOO CAPITAL ADVISORS\n" + "SPAIN AGENCIA DE VALORES\n" + "PLAZA XXXXXX YYYYY ZZZZZZ 9\n" + "MADRID,", b4.getTagValue("59")); + assertEquals( + "/ES8700940001822410908524\n" + "FOO CAPITAL ADVISORS\n" + "SPAIN AGENCIA DE VALORES\n" + + "PLAZA XXXXXX YYYYY ZZZZZZ 9\n" + "MADRID,", + b4.getTagValue("59")); assertEquals("B0706", b4.getTagValue("70")); assertEquals("BEN", b4.getTagValue("71A")); assertEquals("EUR0,", b4.getTagValue("71F")); assertEquals("/ACC/BANKXXXX FOOOOOOOO, 20\n" + "//MADRID,", b4.getTagValue("72")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("07CDCC9A", b5.getTagValue("MAC")); assertEquals("AD1FAEE8537B", b5.getTagValue("CHK")); @@ -239,47 +246,48 @@ public void test103_3() { @Test public void test103_4() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102UUUUESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + - ":20:0511029000000056\n" + - ":13C:/RNCTIME/123123123+0000\n" + - ":23B:CRED\n" + - ":32A:051102EUR88888,88\n" + - ":33B:EUR88888,88\n" + - ":50K:/12345678\n" + - "DIRECCION GENERAL DEL FOOBAR\n" + - ":53A:EEEEESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/00123456789012345678\n" + - "FOOOOBAR, S.A.\n" + - "PS DE YYYYYYYYY 88\n" + - "MADRID\n" + - ":70:/CNC/FRA. 8888 CUENTA 88 SEPTIEMBRE\n" + - "//MANT\n" + - "//NIMIENTO EQUIPOS E INSTALACIONES\n" + - "//TO\n" + - ":71A:OUR\n" + - ":72:/PORCTA1/M FOOOOOO(001622053100386\n" + - "//123123123)\n" + - "/REFBEN/123123123A80960552\n" + - "/REC/123123123\n" + - "/CODORD/123123123\n" + - ":77B:/ORDERRES///123123123\n" + - "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102UUUUESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + + ":20:0511029000000056\n" + + ":13C:/RNCTIME/123123123+0000\n" + + ":23B:CRED\n" + + ":32A:051102EUR88888,88\n" + + ":33B:EUR88888,88\n" + + ":50K:/12345678\n" + + "DIRECCION GENERAL DEL FOOBAR\n" + + ":53A:EEEEESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/00123456789012345678\n" + + "FOOOOBAR, S.A.\n" + + "PS DE YYYYYYYYY 88\n" + + "MADRID\n" + + ":70:/CNC/FRA. 8888 CUENTA 88 SEPTIEMBRE\n" + + "//MANT\n" + + "//NIMIENTO EQUIPOS E INSTALACIONES\n" + + "//TO\n" + + ":71A:OUR\n" + + ":72:/PORCTA1/M FOOOOOO(001622053100386\n" + + "//123123123)\n" + + "/REFBEN/123123123A80960552\n" + + "/REC/123123123\n" + + "/CODORD/123123123\n" + + ":77B:/ORDERRES///123123123\n" + + "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1031101051102UUUUESMMAXXX54267818770511021101N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("ROMF", b3.getTagValue("113")); assertEquals("0511029000000056", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(13, b4.countAll()); assertEquals("0511029000000056", b4.getTagValue("20")); assertEquals("/RNCTIME/123123123+0000", b4.getTagValue("13C")); @@ -290,17 +298,24 @@ public void test103_4() { assertEquals("EEEEESMMXXX", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); - assertEquals("/00123456789012345678\n" + "FOOOOBAR, S.A.\n" + "PS DE YYYYYYYYY 88\n" + "MADRID", b4.getTagValue("59")); + assertEquals( + "/00123456789012345678\n" + "FOOOOBAR, S.A.\n" + "PS DE YYYYYYYYY 88\n" + "MADRID", + b4.getTagValue("59")); - assertEquals("/CNC/FRA. 8888 CUENTA 88 SEPTIEMBRE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E INSTALACIONES\n" + "//TO", b4.getTagValue("70")); + assertEquals( + "/CNC/FRA. 8888 CUENTA 88 SEPTIEMBRE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E INSTALACIONES\n" + "//TO", + b4.getTagValue("70")); assertEquals("OUR", b4.getTagValue("71A")); - assertEquals("/PORCTA1/M FOOOOOO(001622053100386\n" + "//123123123)\n" + "/REFBEN/123123123A80960552\n" + "/REC/123123123\n" + "/CODORD/123123123", b4.getTagValue("72")); + assertEquals( + "/PORCTA1/M FOOOOOO(001622053100386\n" + "//123123123)\n" + "/REFBEN/123123123A80960552\n" + + "/REC/123123123\n" + "/CODORD/123123123", + b4.getTagValue("72")); assertEquals("/ORDERRES///123123123", b4.getTagValue("77B")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("17F13741", b5.getTagValue("MAC")); assertEquals("802BE35B36EB", b5.getTagValue("CHK")); @@ -308,44 +323,45 @@ public void test103_4() { @Test public void test103_5() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + - ":20:0511029000000056\n" + - ":13C:/RNCTIME/1101+0000\n" + - ":23B:CRED\n" + - ":32A:051102EUR66666,66\n" + - ":33B:EUR66666,66\n" + - ":50K:/12345678\n" + - "AAAA BBB CCCCC DDDDD\n" + - ":53A:FOOBARMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/00123456789012345678\n" + - "FOOBAR, S.A.\n" + - "PS DE FFFFFFF 66\n" + - "MADRID\n" + - ":70:/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + - "//MANT\n" + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + - "//TO\n" + ":71A:OUR\n" + - ":72:/PORCTA1/M YYYYYYY(001622053100386\n" + - "//98)\n" + "/REFBEN/000A80960552\n" + - "/REC/00940001872410904744\n" + - "/CODORD/40005\n" + - ":77B:/ORDERRES///000000\n" + - "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + + ":20:0511029000000056\n" + + ":13C:/RNCTIME/1101+0000\n" + + ":23B:CRED\n" + + ":32A:051102EUR66666,66\n" + + ":33B:EUR66666,66\n" + + ":50K:/12345678\n" + + "AAAA BBB CCCCC DDDDD\n" + + ":53A:FOOBARMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/00123456789012345678\n" + + "FOOBAR, S.A.\n" + + "PS DE FFFFFFF 66\n" + + "MADRID\n" + + ":70:/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + + "//MANT\n" + + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO\n" + + ":71A:OUR\n" + ":72:/PORCTA1/M YYYYYYY(001622053100386\n" + + "//98)\n" + + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n" + + "/CODORD/40005\n" + + ":77B:/ORDERRES///000000\n" + + "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1031101051102KKKKESMMAXXX54267818770511021101N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("ROMF", b3.getTagValue("113")); assertEquals("0511029000000056", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(13, b4.countAll()); assertEquals("0511029000000056", b4.getTagValue("20")); assertEquals("/RNCTIME/1101+0000", b4.getTagValue("13C")); @@ -356,17 +372,23 @@ public void test103_5() { assertEquals("FOOBARMMXXX", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); - assertEquals("/00123456789012345678\n" + "FOOBAR, S.A.\n" + "PS DE FFFFFFF 66\n" + "MADRID", b4.getTagValue("59")); + assertEquals( + "/00123456789012345678\n" + "FOOBAR, S.A.\n" + "PS DE FFFFFFF 66\n" + "MADRID", b4.getTagValue("59")); - assertEquals("/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO", b4.getTagValue("70")); + assertEquals( + "/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO", + b4.getTagValue("70")); assertEquals("OUR", b4.getTagValue("71A")); - assertEquals("/PORCTA1/M YYYYYYY(001622053100386\n" + "//98)\n" + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n" + "/CODORD/40005", b4.getTagValue("72")); + assertEquals( + "/PORCTA1/M YYYYYYY(001622053100386\n" + "//98)\n" + "/REFBEN/000A80960552\n" + + "/REC/00940001872410904744\n" + "/CODORD/40005", + b4.getTagValue("72")); assertEquals("/ORDERRES///000000", b4.getTagValue("77B")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("17F13741", b5.getTagValue("MAC")); assertEquals("802BE35B36EB", b5.getTagValue("CHK")); @@ -374,47 +396,48 @@ public void test103_5() { @Test public void test103_6() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + - ":20:0511029000000056\n" + - ":13C:/RNCTIME/1101+0000\n" + - ":23B:CRED\n" + - ":32A:051102EUR66666,66\n" + - ":33B:EUR66666,66\n" + - ":50K:/1234}5678\n" + - "AAAA BBB CCCCC DDDDD\n" + - ":53A:FOOBARMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/00123456789012345678\n" + - "FOOBAR, S.A.\n" + - "PS DE FFFFFFF 66\n" + - "MADRID\n" + - ":70:/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + - "//MANT\n" + - "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + - "//TO\n" + - ":71A:OUR\n" + - ":72:/PORCTA1/M YYYYYYY(001622053100386\n" + - "//98)\n" + "/REFBEN/000A80960552\n" + - "/REC/00940001872410904744\n" + - "/CODORD/40005\n" + - ":77B:/ORDERRES///000000\n" + - "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n" + + ":20:0511029000000056\n" + + ":13C:/RNCTIME/1101+0000\n" + + ":23B:CRED\n" + + ":32A:051102EUR66666,66\n" + + ":33B:EUR66666,66\n" + + ":50K:/1234}5678\n" + + "AAAA BBB CCCCC DDDDD\n" + + ":53A:FOOBARMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/00123456789012345678\n" + + "FOOBAR, S.A.\n" + + "PS DE FFFFFFF 66\n" + + "MADRID\n" + + ":70:/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + + "//MANT\n" + + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + + "//TO\n" + + ":71A:OUR\n" + + ":72:/PORCTA1/M YYYYYYY(001622053100386\n" + + "//98)\n" + + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n" + + "/CODORD/40005\n" + + ":77B:/ORDERRES///000000\n" + + "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1031101051102KKKKESMMAXXX54267818770511021101N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("ROMF", b3.getTagValue("113")); assertEquals("0511029000000056", b3.getTagValue("108")); - //check b4 - // assertEquals(13, b4.countAll()); + // check b4 + // assertEquals(13, b4.countAll()); assertEquals("0511029000000056", b4.getTagValue("20")); assertEquals("/RNCTIME/1101+0000", b4.getTagValue("13C")); assertEquals("CRED", b4.getTagValue("23B")); @@ -424,17 +447,23 @@ public void test103_6() { assertEquals("FOOBARMMXXX", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); - assertEquals("/00123456789012345678\n" + "FOOBAR, S.A.\n" + "PS DE FFFFFFF 66\n" + "MADRID", b4.getTagValue("59")); + assertEquals( + "/00123456789012345678\n" + "FOOBAR, S.A.\n" + "PS DE FFFFFFF 66\n" + "MADRID", b4.getTagValue("59")); - assertEquals("/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO", b4.getTagValue("70")); + assertEquals( + "/CNC/FRA. 6666 CUENTA 66 EEEEEEE\n" + "//MANT\n" + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO", + b4.getTagValue("70")); assertEquals("OUR", b4.getTagValue("71A")); - assertEquals("/PORCTA1/M YYYYYYY(001622053100386\n" + "//98)\n" + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n" + "/CODORD/40005", b4.getTagValue("72")); + assertEquals( + "/PORCTA1/M YYYYYYY(001622053100386\n" + "//98)\n" + "/REFBEN/000A80960552\n" + + "/REC/00940001872410904744\n" + "/CODORD/40005", + b4.getTagValue("72")); assertEquals("/ORDERRES///000000", b4.getTagValue("77B")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("17F13741", b5.getTagValue("MAC")); assertEquals("802BE35B36EB", b5.getTagValue("CHK")); @@ -442,55 +471,57 @@ public void test103_6() { @Test public void test103_7() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:D051026EUR100057\n" + - ":13C:/RNCTIME/0802+0000\n" + - ":23B:CRED\n" + - ":32A:051028EUR6740,91\n" + - ":33B:EUR6740,91\n" + - ":50A:SSSSESMMXXX\n" + - ":53A:BBBBESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/ES0123456789012345671234\n" + - "FOOOOO 1000 FOOBAR S.A.\n" + - ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + - "/123123123: FOOVIMAR 2000 FOOBAR\n" + - ":71A:SHA" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + + ":13C:/RNCTIME/0802+0000\n" + + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + + ":33B:EUR6740,91\n" + + ":50A:SSSSESMMXXX\n" + + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/ES0123456789012345671234\n" + + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + + "/123123123: FOOVIMAR 2000 FOOBAR\n" + + ":71A:SHA" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; assertEquals("103", parseMessage(messageToParse).getType()); } @Test public void test103_8() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:Return A\n" + - ":23B:CRED\n" + - ":32A:021125USD100,25\n" + - ":33B:USD100,25\n" + - ":50K:Franz Holzappel GMBH Vienna\n" + - ":59:H.F. Janssen\n" + - ":71A:SHA\n" + - ":72:/REJT/59\n" + - "/BE04/\n" + - "/MREF/Sample A /CHGS/EUR20,\n" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:Return A\n" + + ":23B:CRED\n" + + ":32A:021125USD100,25\n" + + ":33B:USD100,25\n" + + ":50K:Franz Holzappel GMBH Vienna\n" + + ":59:H.F. Janssen\n" + + ":71A:SHA\n" + + ":72:/REJT/59\n" + + "/BE04/\n" + + "/MREF/Sample A /CHGS/EUR20,\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; assertEquals("103", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O1030803051028AAPBESMMAXXX54237368560510280803N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(3, b3.countAll()); assertEquals("NOMF", b3.getTagValue("113")); assertEquals("0510280086100057", b3.getTagValue("108")); assertEquals("STP", b3.getTagValue("119")); - //check b4 + // check b4 // assertEquals(13, b4.countAll()); assertEquals("Return A", b4.getTagValue("20")); assertEquals("CRED", b4.getTagValue("23B")); @@ -508,11 +539,12 @@ public void test103_8() { assertEquals("59", structured.get(0).getNarrativeFragments().get(0)); assertEquals("BE04", structured.get(1).getCodeword()); assertEquals("MREF", structured.get(2).getCodeword()); - assertEquals("Sample A /CHGS/EUR20,", structured.get(2).getNarrativeFragments().get(0)); - //check b5 + assertEquals( + "Sample A /CHGS/EUR20,", + structured.get(2).getNarrativeFragments().get(0)); + // check b5 assertEquals(2, b5.countAll()); assertEquals("D9D8FA56", b5.getTagValue("MAC")); assertEquals("46E46A6460F2", b5.getTagValue("CHK")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT199ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT199ParserTest.java index 7777ae17f..6196bf1b0 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT199ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT199ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,50 +24,48 @@ public class MT199ParserTest extends BaseMessageTestcase { - @Test public void test199_01() throws Exception { - String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + - ":20:24986614073\n" + - ":79:TO. HSBC INTERNATIONAL TRUSTEE LIMITED\n" + - "ATTN. FOO LAM / FOO CHENG - FAX NO. 11112222\n" + - "FROM. JF ASSET MANAGEMENT LIMITED\n" + - "RE. JF ASIA ABSOLUTE RETURN FUND\n" + - "A/C: 614073\n" + - ".\n" + - "- STOCK BORROWING\n" + - "BORROWER. JF ASIA ABSOLUTE RETURN FUND\n" + - "LENDER. J.P. MORGAN SECURITIES LTD LONDON\n" + - "STOCK. HSBC TAIWAN FOO FD (ISIN: )\n" + - "QUANTITY. 400,000\n" + - "MARGIN PRICE. USD5.1234567\n" + - "COLLATERAL EQUI. USD2,049,382.68\n" + - "TRADE DATE. 23 MAR 2012\n" + - "SETTLEMENT DATE. 23 MAR 2012\n" + - "PERIOD. OPEN-ENDED\n" + - "RATE. -4.0(REBATE RATE)\n" + - "DIVIDEND TERMS. 100 PCT GROSS\n" + - "SETTLEMENT.\n" + - "PLEASE RECEIVE THE CAPTIONED SHARES FROM THE\n" + - "DEPOSITORY TRUST CO, FOO A/C JP MORGAN\n" + - "SECURITIES LTD. A/C NO. THIRD PARTY A/C NO. 123\n" + - "ON SETTLEMENT DATE FREE OF PAYMENT.\n" + - "COLLATERAL.\n" + - "PLEASE REMIT THE STOCK BORROWING CASH COLLATERAL\n" + - "OF USD1,234,567.89 TO JPMORGAN CHASE BANK, NEW\n" + - "YORK (CHASUS33) ABA 1234567, BENE: FOO LONDON\n" + - "(JPMSGB2L) A/C 0123-45-678, CREDIT TO: JF ASIA\n" + - "ABSOLUTE RETURN FUND A/C 1234 UPON INSTRUCTION\n" + - "MATCHED AND COMPLETION OF STOCK SETTLEMENT.\n" + - "PLEASE NOTIFY US WITHIN 24 HOURS IF ANY\n" + - "DISCREPANCY FOUND, OTHERWISE THE DETAILS STATED\n" + - "ABOVE WILL BE TREATED AS CORRECT.\n" + - ".\n" + - "1\n" + - "2\n" + - "3\n" + - "4\n" + - "-}"; + String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + ":20:24986614073\n" + + ":79:TO. HSBC INTERNATIONAL TRUSTEE LIMITED\n" + + "ATTN. FOO LAM / FOO CHENG - FAX NO. 11112222\n" + + "FROM. JF ASSET MANAGEMENT LIMITED\n" + + "RE. JF ASIA ABSOLUTE RETURN FUND\n" + + "A/C: 614073\n" + + ".\n" + + "- STOCK BORROWING\n" + + "BORROWER. JF ASIA ABSOLUTE RETURN FUND\n" + + "LENDER. J.P. MORGAN SECURITIES LTD LONDON\n" + + "STOCK. HSBC TAIWAN FOO FD (ISIN: )\n" + + "QUANTITY. 400,000\n" + + "MARGIN PRICE. USD5.1234567\n" + + "COLLATERAL EQUI. USD2,049,382.68\n" + + "TRADE DATE. 23 MAR 2012\n" + + "SETTLEMENT DATE. 23 MAR 2012\n" + + "PERIOD. OPEN-ENDED\n" + + "RATE. -4.0(REBATE RATE)\n" + + "DIVIDEND TERMS. 100 PCT GROSS\n" + + "SETTLEMENT.\n" + + "PLEASE RECEIVE THE CAPTIONED SHARES FROM THE\n" + + "DEPOSITORY TRUST CO, FOO A/C JP MORGAN\n" + + "SECURITIES LTD. A/C NO. THIRD PARTY A/C NO. 123\n" + + "ON SETTLEMENT DATE FREE OF PAYMENT.\n" + + "COLLATERAL.\n" + + "PLEASE REMIT THE STOCK BORROWING CASH COLLATERAL\n" + + "OF USD1,234,567.89 TO JPMORGAN CHASE BANK, NEW\n" + + "YORK (CHASUS33) ABA 1234567, BENE: FOO LONDON\n" + + "(JPMSGB2L) A/C 0123-45-678, CREDIT TO: JF ASIA\n" + + "ABSOLUTE RETURN FUND A/C 1234 UPON INSTRUCTION\n" + + "MATCHED AND COMPLETION OF STOCK SETTLEMENT.\n" + + "PLEASE NOTIFY US WITHIN 24 HOURS IF ANY\n" + + "DISCREPANCY FOUND, OTHERWISE THE DETAILS STATED\n" + + "ABOVE WILL BE TREATED AS CORRECT.\n" + + ".\n" + + "1\n" + + "2\n" + + "3\n" + + "4\n" + + "-}"; SwiftMessage msg = new SwiftParser(s).message(); final String value = msg.getBlock4().getTagByName("79").getValue(); assertEquals("\n4", value.substring(value.length() - 2)); @@ -75,32 +73,31 @@ public void test199_01() throws Exception { @Test public void test199_02() throws Exception { - String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO. CITIBANK NA (NEW YORK)\n" + - "ATTN. ANTHONY FOO/BONI FOO - ABC OPERATIONS\n" + - "FROM.\n" + - "RE. FOO SUB A/C 12345\n" + - "A/C: 961XXX\n" + - ".\n" + - "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + - "USD100,027.78 TO USD150,000.00.\n" + - "TRADED 01 MAY 2012\n" + - "VALUE 01 MAY 2012\n" + - "MATURITY 02 MAY 2012\n" + - "AMOUNT USD150,000.00\n" + - "RATE 10.0000\n" + - ".\n" + - "INSTRUCTIONS:\n" + - "PLEASE RECEIVE USD49,972.22 FROM\n" + - "STATE STREET BANK AND TRUST CO, NA NEW YORK\n" + - "SWIFT CODE: FOOSUS3N\n" + - "CHIPS UID263760\n" + - "VALUE 01 MAY 2012\n" + - ".\n" + - "REGARDS,\n" + - "}\n" + - "-}"; + String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:TO. CITIBANK NA (NEW YORK)\n" + + "ATTN. ANTHONY FOO/BONI FOO - ABC OPERATIONS\n" + + "FROM.\n" + + "RE. FOO SUB A/C 12345\n" + + "A/C: 961XXX\n" + + ".\n" + + "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + + "USD100,027.78 TO USD150,000.00.\n" + + "TRADED 01 MAY 2012\n" + + "VALUE 01 MAY 2012\n" + + "MATURITY 02 MAY 2012\n" + + "AMOUNT USD150,000.00\n" + + "RATE 10.0000\n" + + ".\n" + + "INSTRUCTIONS:\n" + + "PLEASE RECEIVE USD49,972.22 FROM\n" + + "STATE STREET BANK AND TRUST CO, NA NEW YORK\n" + + "SWIFT CODE: FOOSUS3N\n" + + "CHIPS UID263760\n" + + "VALUE 01 MAY 2012\n" + + ".\n" + + "REGARDS,\n" + + "}\n" + + "-}"; SwiftMessage msg = new SwiftParser(s).message(); final String value = msg.getBlock4().getTagByName("79").getValue(); final char lastChar = value.charAt(value.length() - 1); @@ -109,12 +106,12 @@ public void test199_02() throws Exception { @Test public void test199_03() throws Exception { - String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO. FOO NA (HONG KONG)\n" + - "FOO\n" + - "REGARDS,\n" + - "{\n" + //invalid character + String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:TO. FOO NA (HONG KONG)\n" + + "FOO\n" + + "REGARDS,\n" + + "{\n" + + // invalid character "-}"; SwiftMessage msg = new SwiftParser(s).message(); final String value = msg.getBlock4().getTagByName("79").getValue(); @@ -124,10 +121,10 @@ public void test199_03() throws Exception { @Test public void test199_04() throws Exception { - String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:foo\n" + - "}\n" + //invalid character + String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:foo\n" + + "}\n" + + // invalid character "-}"; SwiftMessage msg = new SwiftParser(s).message(); final String value = msg.getBlock4().getTagByName("79").getValue(); @@ -136,12 +133,12 @@ public void test199_04() throws Exception { @Test public void test199_05() throws Exception { - String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:foo\n" + - "}\n" + //invalid character - ":13C:bar\n" + - "-}"; + String s = "{1:F01AAAAUSC0AXXX8321000092}{2:I199FOOBARAAXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:foo\n" + + "}\n" + + // invalid character + ":13C:bar\n" + + "-}"; SwiftMessage msg = new SwiftParser(s).message(); final Tag t13 = msg.getBlock4().getTagByName("13C"); @@ -154,14 +151,13 @@ public void test199_05() throws Exception { @Test public void test199_06() throws Exception { - String s = "{4:\n" + - ":79:foo\n" + - "}\n" + //invalid character + String s = "{4:\n" + ":79:foo\n" + + "}\n" + + // invalid character "-}"; SwiftMessage msg = new SwiftParser(s).message(); final String value = msg.getBlock4().getTagByName("79").getValue(); assertEquals("foo\n}", value); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java index 604127bf4..b53f88cb8 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,29 +29,30 @@ public class MT202ParserTest extends BaseMessageTestcase { @Test public void test202_1() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O2020810060308QQQQESMMAXXX55610922240603080810N}{3:{113:NOMT}{108:2006030800940016}}{4:\n" + - ":20:X2XC05060308\n" + - ":21:X2XC05060308\n" + - ":13C:/SNDTIME/0809+0100\n" + - ":13C:/RNCTIME/0809+0100\n" + - ":32A:060308EUR12345,67\n" + - ":52A://FOOLLLLLLULLXXXL2SC05060308\n" + - "LLLLLULLXXX\n" + - ":53A:/0809A060308LUES00054\n" + - "FOOOOOOO\n" + - ":57A:FOOBARYYXXX\n" + - ":58A:/ES4100940060792840000017\n" + - "FOOBARYYXXX\n" + - ":72:/BNF/REDEM 123.456 SHS B LU01191229\n" + - "//00 FOOOOO L FUND EQUITY FOOOBAR\n" + - "//EUROP AT NAV 88.88 06032006\n" + - "//BY ORDER OF FOOBAR L FUND\n" + - "//EQUITY FOOOBAR EUROPE\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O2020810060308QQQQESMMAXXX55610922240603080810N}{3:{113:NOMT}{108:2006030800940016}}{4:\n" + + ":20:X2XC05060308\n" + + ":21:X2XC05060308\n" + + ":13C:/SNDTIME/0809+0100\n" + + ":13C:/RNCTIME/0809+0100\n" + + ":32A:060308EUR12345,67\n" + + ":52A://FOOLLLLLLULLXXXL2SC05060308\n" + + "LLLLLULLXXX\n" + + ":53A:/0809A060308LUES00054\n" + + "FOOOOOOO\n" + + ":57A:FOOBARYYXXX\n" + + ":58A:/ES4100940060792840000017\n" + + "FOOBARYYXXX\n" + + ":72:/BNF/REDEM 123.456 SHS B LU01191229\n" + + "//00 FOOOOO L FUND EQUITY FOOOBAR\n" + + "//EUROP AT NAV 88.88 06032006\n" + + "//BY ORDER OF FOOBAR L FUND\n" + + "//EQUITY FOOOBAR EUROPE\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("202", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -59,7 +60,7 @@ public void test202_1() { assertEquals("1234", b1.getSessionNumber()); assertEquals("123456", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("O2020810060308QQQQESMMAXXX55610922240603080810N", b2.getBlockValue()); assertEquals("202", b2.getMessageType()); assertEquals("0810", ((SwiftBlock2Output) b2).getSenderInputTime()); @@ -72,12 +73,12 @@ public void test202_1() { assertEquals("0810", ((SwiftBlock2Output) b2).getReceiverOutputTime()); assertEquals("N", b2.getMessagePriority()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2006030800940016", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(10, b4.countAll()); assertEquals("X2XC05060308", b4.getTagValue("20")); assertEquals("X2XC05060308", b4.getTagValue("21")); @@ -91,13 +92,14 @@ public void test202_1() { assertEquals("/0809A060308LUES00054\n" + "FOOOOOOO", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); assertEquals("/ES4100940060792840000017\n" + "FOOBARYYXXX", b4.getTagValue("58A")); - assertEquals("/BNF/REDEM 123.456 SHS B LU01191229\n" + - "//00 FOOOOO L FUND EQUITY FOOOBAR\n" + - "//EUROP AT NAV 88.88 06032006\n" + - "//BY ORDER OF FOOBAR L FUND\n" + - "//EQUITY FOOOBAR EUROPE", b4.getTagValue("72")); - - //check b5 + assertEquals( + "/BNF/REDEM 123.456 SHS B LU01191229\n" + "//00 FOOOOO L FUND EQUITY FOOOBAR\n" + + "//EUROP AT NAV 88.88 06032006\n" + + "//BY ORDER OF FOOBAR L FUND\n" + + "//EQUITY FOOOBAR EUROPE", + b4.getTagValue("72")); + + // check b5 assertEquals(2, b5.countAll()); assertEquals("0D3E6718", b5.getTagValue("MAC")); assertEquals("76FFBA03C41F", b5.getTagValue("CHK")); @@ -105,40 +107,41 @@ public void test202_1() { @Test public void test202_2() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O2021340060306PPPPESMMAXXX55590714410603061340N}{3:{113:NOMT}{108:2006030600940035}}{4:\n" + - ":20:C2CI03060306\n" + - ":21:C2CI03060306\n" + - ":13C:/SNDTIME/1339+0100\n" + - ":13C:/RNCTIME/1339+0100\n" + - ":32A:060306EUR199999,99\n" + - ":52A://FOOOBGLLLUYYXXXL2SI03060306\n" + - "BGLLLUYYXXX\n" + - ":53A:/1339A060306LUES00052\n" + - "FOOOOOOO\n" + - ":57A:FOOBARYYXXX\n" + - ":58A:/ES4100940060792840000017\n" + - "FOOBARYYXXX\n" + - ":72:/BNF/REDEM 1876.543 SHS B LU011111\n" + - "//3634 FOOBAR L FUND ABSOLUTE\n" + - "//RETURN BOND AT NAV 199.99 FROM\n" + - "//02032006 B/O FOOBAR L FUND ABSOLU\n" + - "//TE RETURN BOND\n" + - "-}{5:{MAC:2424F8B6}{CHK:F76887F6C516}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O2021340060306PPPPESMMAXXX55590714410603061340N}{3:{113:NOMT}{108:2006030600940035}}{4:\n" + + ":20:C2CI03060306\n" + + ":21:C2CI03060306\n" + + ":13C:/SNDTIME/1339+0100\n" + + ":13C:/RNCTIME/1339+0100\n" + + ":32A:060306EUR199999,99\n" + + ":52A://FOOOBGLLLUYYXXXL2SI03060306\n" + + "BGLLLUYYXXX\n" + + ":53A:/1339A060306LUES00052\n" + + "FOOOOOOO\n" + + ":57A:FOOBARYYXXX\n" + + ":58A:/ES4100940060792840000017\n" + + "FOOBARYYXXX\n" + + ":72:/BNF/REDEM 1876.543 SHS B LU011111\n" + + "//3634 FOOBAR L FUND ABSOLUTE\n" + + "//RETURN BOND AT NAV 199.99 FROM\n" + + "//02032006 B/O FOOBAR L FUND ABSOLU\n" + + "//TE RETURN BOND\n" + + "-}{5:{MAC:2424F8B6}{CHK:F76887F6C516}}"; assertEquals("202", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O2021340060306PPPPESMMAXXX55590714410603061340N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2006030600940035", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(10, b4.countAll()); assertEquals("C2CI03060306", b4.getTagValue("20")); assertEquals("C2CI03060306", b4.getTagValue("21")); @@ -152,13 +155,14 @@ public void test202_2() { assertEquals("/1339A060306LUES00052\n" + "FOOOOOOO", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); assertEquals("/ES4100940060792840000017\n" + "FOOBARYYXXX", b4.getTagValue("58A")); - assertEquals("/BNF/REDEM 1876.543 SHS B LU011111\n" + - "//3634 FOOBAR L FUND ABSOLUTE\n" + - "//RETURN BOND AT NAV 199.99 FROM\n" + - "//02032006 B/O FOOBAR L FUND ABSOLU\n" + - "//TE RETURN BOND", b4.getTagValue("72")); - - //check b5 + assertEquals( + "/BNF/REDEM 1876.543 SHS B LU011111\n" + "//3634 FOOBAR L FUND ABSOLUTE\n" + + "//RETURN BOND AT NAV 199.99 FROM\n" + + "//02032006 B/O FOOBAR L FUND ABSOLU\n" + + "//TE RETURN BOND", + b4.getTagValue("72")); + + // check b5 assertEquals(2, b5.countAll()); assertEquals("2424F8B6", b5.getTagValue("MAC")); assertEquals("F76887F6C516", b5.getTagValue("CHK")); @@ -166,40 +170,41 @@ public void test202_2() { @Test public void test202_3() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O2020838060307AAAABRMMAXXX55600795140603070838N}{3:{113:NOMT}{108:2006030700940021}}{4:\n" + - ":20:B2B404060307\n" + - ":21:B2B404060307\n" + - ":13C:/SNDTIME/0837+0100\n" + - ":13C:/RNCTIME/0837+0100\n" + - ":32A:060307EUR54321,23\n" + - ":52A://FOOUBGLLBRLLXXXL2S404060307\n" + - "BGLLBRLLXXX\n" + - ":53A:/0837A060307AABR00038\n" + - "FOOOOOOO\n" + - ":57A:FOOBARYYXXX\n" + - ":58A:/BR4100940060792840000017\n" + - "FOOBARYYXXX\n" + - ":72:/BNF/REDEM 123.456 SHS B AA02077585\n" + - "//81 FOOOBAR L FUND BOND INFLATION\n" + - "//LINKE AT NAV 123.45 FROM 03032006\n" + - "//B/O FOOOBAR L FUND BOND INFLATION\n" + - "//LINKED\n" + - "-}{5:{MAC:CF70285B}{CHK:51C671F55CB7}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O2020838060307AAAABRMMAXXX55600795140603070838N}{3:{113:NOMT}{108:2006030700940021}}{4:\n" + + ":20:B2B404060307\n" + + ":21:B2B404060307\n" + + ":13C:/SNDTIME/0837+0100\n" + + ":13C:/RNCTIME/0837+0100\n" + + ":32A:060307EUR54321,23\n" + + ":52A://FOOUBGLLBRLLXXXL2S404060307\n" + + "BGLLBRLLXXX\n" + + ":53A:/0837A060307AABR00038\n" + + "FOOOOOOO\n" + + ":57A:FOOBARYYXXX\n" + + ":58A:/BR4100940060792840000017\n" + + "FOOBARYYXXX\n" + + ":72:/BNF/REDEM 123.456 SHS B AA02077585\n" + + "//81 FOOOBAR L FUND BOND INFLATION\n" + + "//LINKE AT NAV 123.45 FROM 03032006\n" + + "//B/O FOOOBAR L FUND BOND INFLATION\n" + + "//LINKED\n" + + "-}{5:{MAC:CF70285B}{CHK:51C671F55CB7}}"; assertEquals("202", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O2020838060307AAAABRMMAXXX55600795140603070838N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2006030700940021", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(10, b4.countAll()); assertEquals("B2B404060307", b4.getTagValue("20")); assertEquals("B2B404060307", b4.getTagValue("21")); @@ -213,13 +218,14 @@ public void test202_3() { assertEquals("/0837A060307AABR00038\n" + "FOOOOOOO", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); assertEquals("/BR4100940060792840000017\n" + "FOOBARYYXXX", b4.getTagValue("58A")); - assertEquals("/BNF/REDEM 123.456 SHS B AA02077585\n" + - "//81 FOOOBAR L FUND BOND INFLATION\n" + - "//LINKE AT NAV 123.45 FROM 03032006\n" + - "//B/O FOOOBAR L FUND BOND INFLATION\n" + - "//LINKED", b4.getTagValue("72")); - - //check b5 + assertEquals( + "/BNF/REDEM 123.456 SHS B AA02077585\n" + "//81 FOOOBAR L FUND BOND INFLATION\n" + + "//LINKE AT NAV 123.45 FROM 03032006\n" + + "//B/O FOOOBAR L FUND BOND INFLATION\n" + + "//LINKED", + b4.getTagValue("72")); + + // check b5 assertEquals(2, b5.countAll()); assertEquals("CF70285B", b5.getTagValue("MAC")); assertEquals("51C671F55CB7", b5.getTagValue("CHK")); @@ -227,38 +233,39 @@ public void test202_3() { @Test public void test202_4() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O2021011060227FOOOESMMAXXX55529778600602271011N}{3:{113:NOMT}{108:2006022700940034}}{4:\n" + - ":20:A2A504060227\n" + - ":21:A2A504060227\n" + - ":13C:/SNDTIME/1010+0100\n" + - ":32A:060227EUR11111,11\n" + - ":52A://FOOUBGLLARLLXXXL2S504060227\n" + - "BGLLARLLXXX\n" + - ":53A:/1010A060227ARES00071\n" + - "FOOOOOOO\n" + - ":57A:FOOBARYYXXX\n" + - ":58A:/AR4100940060792840000017\n" + - "FOOBARYYXXX\n" + - ":72:/BNF/REDEM 33.333 SHS B XX008704538\n" + - "//0 FOOOBAR X YYYY BOND EURO PM/RV\n" + - "//1 AT NAV 444.44 FROM 22.02.06\n" + - "//B/O FOOBAR X YYYY BOND EURO\n" + - "-}{5:{MAC:D45AA0E8}{CHK:3406C04414BD}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O2021011060227FOOOESMMAXXX55529778600602271011N}{3:{113:NOMT}{108:2006022700940034}}{4:\n" + + ":20:A2A504060227\n" + + ":21:A2A504060227\n" + + ":13C:/SNDTIME/1010+0100\n" + + ":32A:060227EUR11111,11\n" + + ":52A://FOOUBGLLARLLXXXL2S504060227\n" + + "BGLLARLLXXX\n" + + ":53A:/1010A060227ARES00071\n" + + "FOOOOOOO\n" + + ":57A:FOOBARYYXXX\n" + + ":58A:/AR4100940060792840000017\n" + + "FOOBARYYXXX\n" + + ":72:/BNF/REDEM 33.333 SHS B XX008704538\n" + + "//0 FOOOBAR X YYYY BOND EURO PM/RV\n" + + "//1 AT NAV 444.44 FROM 22.02.06\n" + + "//B/O FOOBAR X YYYY BOND EURO\n" + + "-}{5:{MAC:D45AA0E8}{CHK:3406C04414BD}}"; assertEquals("202", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O2021011060227FOOOESMMAXXX55529778600602271011N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2006022700940034", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(9, b4.countAll()); assertEquals("A2A504060227", b4.getTagValue("20")); assertEquals("A2A504060227", b4.getTagValue("21")); @@ -268,12 +275,13 @@ public void test202_4() { assertEquals("/1010A060227ARES00071\n" + "FOOOOOOO", b4.getTagValue("53A")); assertEquals("FOOBARYYXXX", b4.getTagValue("57A")); assertEquals("/AR4100940060792840000017\n" + "FOOBARYYXXX", b4.getTagValue("58A")); - assertEquals("/BNF/REDEM 33.333 SHS B XX008704538\n" + - "//0 FOOOBAR X YYYY BOND EURO PM/RV\n" + - "//1 AT NAV 444.44 FROM 22.02.06\n" + - "//B/O FOOBAR X YYYY BOND EURO", b4.getTagValue("72")); + assertEquals( + "/BNF/REDEM 33.333 SHS B XX008704538\n" + "//0 FOOOBAR X YYYY BOND EURO PM/RV\n" + + "//1 AT NAV 444.44 FROM 22.02.06\n" + + "//B/O FOOBAR X YYYY BOND EURO", + b4.getTagValue("72")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("D45AA0E8", b5.getTagValue("MAC")); assertEquals("3406C04414BD", b5.getTagValue("CHK")); @@ -281,36 +289,37 @@ public void test202_4() { @Test public void test202_5() { - messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O2021559051102ABCDEFMMAXXX54267910040511021559N}{3:{113:NOMT}{108:2005110200940055}}{4:\n" + - ":20:FTR2222222 01\n" + - ":21:NONREF\n" + - ":13C:/RNCTIME/1559+0100\n" + - ":32A:051102EUR339262,0\n" + - ":52A://ABCDEFGHDEFFXXX1234567890 01\n" + - "CHASGB2L\n" + - ":53A:/1234A0123456ABC012345\n" + - "MARKDEFF\n" + - ":57A:FOOBARYY\n" + - ":58A:/US12 1234 6789 1234 1111 1234\n" + - "FOOBARYY\n" + - ":72:/BNF/00940001852410932921ING DIRECT\n" + - "//F.N.IBEX 35 FI\n" + - "-}{5:{MAC:00EAF2F1}{CHK:5A1A7D7807F7}}"; + messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O2021559051102ABCDEFMMAXXX54267910040511021559N}{3:{113:NOMT}{108:2005110200940055}}{4:\n" + + ":20:FTR2222222 01\n" + + ":21:NONREF\n" + + ":13C:/RNCTIME/1559+0100\n" + + ":32A:051102EUR339262,0\n" + + ":52A://ABCDEFGHDEFFXXX1234567890 01\n" + + "CHASGB2L\n" + + ":53A:/1234A0123456ABC012345\n" + + "MARKDEFF\n" + + ":57A:FOOBARYY\n" + + ":58A:/US12 1234 6789 1234 1111 1234\n" + + "FOOBARYY\n" + + ":72:/BNF/00940001852410932921ING DIRECT\n" + + "//F.N.IBEX 35 FI\n" + + "-}{5:{MAC:00EAF2F1}{CHK:5A1A7D7807F7}}"; assertEquals("202", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue()); - //check b2 + // check b2 assertEquals("O2021559051102ABCDEFMMAXXX54267910040511021559N", b2.getBlockValue()); - //check b3 + // check b3 assertEquals(2, b3.countAll()); assertEquals("NOMT", b3.getTagValue("113")); assertEquals("2005110200940055", b3.getTagValue("108")); - //check b4 + // check b4 assertEquals(9, b4.countAll()); assertEquals("FTR2222222 01", b4.getTagValue("20")); assertEquals("NONREF", b4.getTagValue("21")); @@ -320,13 +329,11 @@ public void test202_5() { assertEquals("/1234A0123456ABC012345\n" + "MARKDEFF", b4.getTagValue("53A")); assertEquals("FOOBARYY", b4.getTagValue("57A")); assertEquals("/US12 1234 6789 1234 1111 1234\n" + "FOOBARYY", b4.getTagValue("58A")); - assertEquals("/BNF/00940001852410932921ING DIRECT\n" + - "//F.N.IBEX 35 FI", b4.getTagValue("72")); + assertEquals("/BNF/00940001852410932921ING DIRECT\n" + "//F.N.IBEX 35 FI", b4.getTagValue("72")); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("00EAF2F1", b5.getTagValue("MAC")); assertEquals("5A1A7D7807F7", b5.getTagValue("CHK")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT535ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT535ParserTest.java index a3d899e2a..1023e9760 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT535ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT535ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,31 +29,30 @@ public class MT535ParserTest extends BaseMessageTestcase { @Test public void test535_1() { - messageToParse = "{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + - ":16R:GENL\n" + - ":28E:1/ONLY\n" + - ":13A::STAT//086\n" + - ":20C::SEME//ABC20070327P1\n" + - ":23G:NEWM\n" + - ":98A::STAT//20070327\n" + - ":98C::PREP//20070328043657\n" + - ":22F::SFRE//DAIL\n" + - ":22F::CODE//COMP\n" + - ":22F::STTY//CUST\n" + - ":22F::STBA//TRAD\n" + - ":97A::SAFE//ABC\n" + - ":17B::ACTI//Y\n" + - ":17B::CONS//Y\n" + - ":16S:GENL\n" + - ":16R:ADDINFO\n" + - ":19A::HOLP//USD0,\n" + - ":19A::HOLS//USD0,\n" + - ":16S:ADDINFO\n" + - "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; + messageToParse = "{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + ":16R:GENL\n" + + ":28E:1/ONLY\n" + + ":13A::STAT//086\n" + + ":20C::SEME//ABC20070327P1\n" + + ":23G:NEWM\n" + + ":98A::STAT//20070327\n" + + ":98C::PREP//20070328043657\n" + + ":22F::SFRE//DAIL\n" + + ":22F::CODE//COMP\n" + + ":22F::STTY//CUST\n" + + ":22F::STBA//TRAD\n" + + ":97A::SAFE//ABC\n" + + ":17B::ACTI//Y\n" + + ":17B::CONS//Y\n" + + ":16S:GENL\n" + + ":16R:ADDINFO\n" + + ":19A::HOLP//USD0,\n" + + ":19A::HOLS//USD0,\n" + + ":16S:ADDINFO\n" + + "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; assertEquals("535", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXAXXX3219604112", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -61,7 +60,7 @@ public void test535_1() { assertEquals("3219", b1.getSessionNumber()); assertEquals("604112", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("I535FOOBARXXXXXXN", b2.getBlockValue()); assertEquals("535", b2.getMessageType()); assertEquals("FOOBARXXXXXX", ((SwiftBlock2Input) b2).getReceiverAddress()); @@ -69,7 +68,7 @@ public void test535_1() { assertNull(((SwiftBlock2Input) b2).getDeliveryMonitoring()); assertNull(((SwiftBlock2Input) b2).getObsolescencePeriod()); - //check b4 + // check b4 assertEquals(19, b4.countAll()); tags = b4.getTagsByName("16R"); @@ -103,15 +102,13 @@ public void test535_1() { assertEquals(":HOLP//USD0,", tags[0].getValue()); assertEquals(":HOLS//USD0,", tags[1].getValue()); - //check b5 + // check b5 assertEquals(2, b5.countAll()); assertEquals("8A1FADA1", b5.getTagValue("MAC")); assertEquals("B018C2CA74CD", b5.getTagValue("CHK")); - //user block (extra data, not swift standard, attached to the message as a trailer block) + // user block (extra data, not swift standard, attached to the message as a trailer block) assertNotNull(o.getUserBlock("S")); assertEquals("I20070328.386482886.out/1/1", o.getUserBlock("S").getTagValue("REF")); } - } - diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT541ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT541ParserTest.java index 53cee097c..81e1cafcf 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT541ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT541ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,8 @@ import com.prowidesoftware.swift.model.SwiftBlock2Input; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * MT541 tests @@ -33,45 +32,44 @@ public class MT541ParserTest extends BaseMessageTestcase { @Test public void test541_1() { - messageToParse = "{1:F01FOOBARXXXXXX1234123456}{2:I541FOOOFRPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2005080800000944\n" + - ":23G:NEWM\n" + - ":98A::PREP//20050808\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20050803\n" + - ":98A::SETT//20050808\n" + - ":90B::DEAL//ACTU/EUR11,11\n" + - ":35B:ISIN FR1234567111\n" + - "FRA.FOOOBAR\n" + - ":70E::SPRO//4042\n" + - ":16S:TRADFOO\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/1000,00\n" + - ":97A::SAFE//123456789\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::DEAG/FOOV/1234\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//FOOOFRPP\n" + - ":97A::SAFE//123456789\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//FOOVFRPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR123456,50\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX1234123456}{2:I541FOOOFRPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2005080800000944\n" + + ":23G:NEWM\n" + + ":98A::PREP//20050808\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20050803\n" + + ":98A::SETT//20050808\n" + + ":90B::DEAL//ACTU/EUR11,11\n" + + ":35B:ISIN FR1234567111\n" + + "FRA.FOOOBAR\n" + + ":70E::SPRO//4042\n" + + ":16S:TRADFOO\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/1000,00\n" + + ":97A::SAFE//123456789\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::DEAG/FOOV/1234\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//FOOOFRPP\n" + + ":97A::SAFE//123456789\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//FOOVFRPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR123456,50\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("541", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXXXXX1234123456", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -79,7 +77,7 @@ public void test541_1() { assertEquals("1234", b1.getSessionNumber()); assertEquals("123456", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("I541FOOOFRPPXXXXN", b2.getBlockValue()); assertEquals("541", b2.getMessageType()); assertEquals("FOOOFRPPXXXX", ((SwiftBlock2Input) b2).getReceiverAddress()); @@ -223,41 +221,40 @@ public void test541_1() { @Test public void test541_2() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I541FOOOFRPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2002071500000614\n" + - ":23G:NEWM\n" + - ":98A::PREP//20020715\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20020713\n" + - ":98A::SETT//20020718\n" + - ":90B::DEAL//ACTU/EUR22,22\n" + - ":35B:ISIN FR1234567890\n" + - "FOO DE FRAN\n" + - ":70E::SPRO//1234\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/321,00\n" + - ":97A::SAFE//123456789\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::DEAG/SICV/4042\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//FOOOFRPP\n" + - ":97A::SAFE//123456789\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//SICVFRPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR123456,78\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I541FOOOFRPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2002071500000614\n" + + ":23G:NEWM\n" + + ":98A::PREP//20020715\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20020713\n" + + ":98A::SETT//20020718\n" + + ":90B::DEAL//ACTU/EUR22,22\n" + + ":35B:ISIN FR1234567890\n" + + "FOO DE FRAN\n" + + ":70E::SPRO//1234\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/321,00\n" + + ":97A::SAFE//123456789\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::DEAG/SICV/4042\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//FOOOFRPP\n" + + ":97A::SAFE//123456789\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//SICVFRPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR123456,78\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("541", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I541FOOOFRPPXXXXN", b2.getBlockValue()); @@ -266,41 +263,40 @@ public void test541_2() { @Test public void test541_3() { - messageToParse = "{1:F01FOOBARXXXXXX4321654321}{2:I541FOOOARPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2007071800000923\n" + - ":23G:NEWM\n" + - ":98A::PREP//20070718\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20070714\n" + - ":98A::SETT//20070719\n" + - ":90B::DEAL//ACTU/EUR12,34\n" + - ":35B:ISIN FR1234567890\n" + - "FOO UAP\n" + - ":70E::SPRO//4321\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/222,22\n" + - ":97A::SAFE//123456789\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::DEAG/SICV/4321\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//FOOOARPP\n" + - ":97A::SAFE//123456789\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//SICVARPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR123456,78\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX4321654321}{2:I541FOOOARPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2007071800000923\n" + + ":23G:NEWM\n" + + ":98A::PREP//20070718\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20070714\n" + + ":98A::SETT//20070719\n" + + ":90B::DEAL//ACTU/EUR12,34\n" + + ":35B:ISIN FR1234567890\n" + + "FOO UAP\n" + + ":70E::SPRO//4321\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/222,22\n" + + ":97A::SAFE//123456789\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::DEAG/SICV/4321\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//FOOOARPP\n" + + ":97A::SAFE//123456789\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//SICVARPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR123456,78\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("541", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX4321654321", b1.getBlockValue()); assertEquals("I541FOOOARPPXXXXN", b2.getBlockValue()); @@ -309,39 +305,38 @@ public void test541_3() { @Test public void test541_4() { - messageToParse = "{1:F01FOOBARXXXXXX1234123456}{2:I541FOOODEFFXCUSN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2001071800001228\n" + - ":23G:NEWM\n" + - ":98A::PREP//20010718\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20010713\n" + - ":98A::SETT//20010715\n" + - ":90B::DEAL//ACTU/EUR8,88\n" + - ":35B:ISIN DE1234567890\n" + - "FOOO CREATI\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/6666,66\n" + - ":97A::SAFE//123456789\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::DEAG/AAKV/9876\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//AAKVDEFF\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//AAKVDEFF\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR123456,78\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX1234123456}{2:I541FOOODEFFXCUSN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2001071800001228\n" + + ":23G:NEWM\n" + + ":98A::PREP//20010718\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20010713\n" + + ":98A::SETT//20010715\n" + + ":90B::DEAL//ACTU/EUR8,88\n" + + ":35B:ISIN DE1234567890\n" + + "FOOO CREATI\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/6666,66\n" + + ":97A::SAFE//123456789\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::DEAG/AAKV/9876\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//AAKVDEFF\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//AAKVDEFF\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR123456,78\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("541", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX1234123456", b1.getBlockValue()); assertEquals("I541FOOODEFFXCUSN", b2.getBlockValue()); @@ -350,44 +345,42 @@ public void test541_4() { @Test public void test541_5() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I541FOOOUS33XASTN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2005071300000248\n" + - ":23G:NEWM\n" + - ":98A::PREP//20050713\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20050708\n" + - ":98A::SETT//20050713\n" + - ":90B::DEAL//ACTU/USD18,81\n" + - ":35B:ISIN US1234567890\n" + - "FOOOO SYS\n" + - ":70E::SPRO//050\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/1234,00\n" + - ":97A::SAFE//123456789\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::DEAG/DTCYID/050\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//MSNYUS11\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//DTCYUS11\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR123456,78\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I541FOOOUS33XASTN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2005071300000248\n" + + ":23G:NEWM\n" + + ":98A::PREP//20050713\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20050708\n" + + ":98A::SETT//20050713\n" + + ":90B::DEAL//ACTU/USD18,81\n" + + ":35B:ISIN US1234567890\n" + + "FOOOO SYS\n" + + ":70E::SPRO//050\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/1234,00\n" + + ":97A::SAFE//123456789\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::DEAG/DTCYID/050\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//MSNYUS11\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//DTCYUS11\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR123456,78\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("541", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I541FOOOUS33XASTN", b2.getBlockValue()); assertEquals(31, b4.countAll()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT543ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT543ParserTest.java index 1015e8452..9f2d9f2e4 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT543ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT543ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,8 @@ import com.prowidesoftware.swift.model.SwiftBlock2Input; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * MT543 tests @@ -33,45 +32,44 @@ public class MT543ParserTest extends BaseMessageTestcase { @Test public void test543_1() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOODEFFXCUSN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2008101900002890\n" + - ":23G:NEWM\n" + - ":98A::PREP//20081019\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20081017\n" + - ":98A::SETT//20081019\n" + - ":90B::DEAL//ACTU/EUR11,11\n" + - ":35B:ISIN US1234567890\n" + - "AAAA BBBBBB\n" + - ":70E::SPRO//1234\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/123,45\n" + - ":97A::SAFE//100948783600\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/DAKV/8888\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::BUYR//SSSSNL2A\n" + - ":97A::SAFE//223602222\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//FOOVDEFF\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR1234,56\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOODEFFXCUSN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2008101900002890\n" + + ":23G:NEWM\n" + + ":98A::PREP//20081019\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20081017\n" + + ":98A::SETT//20081019\n" + + ":90B::DEAL//ACTU/EUR11,11\n" + + ":35B:ISIN US1234567890\n" + + "AAAA BBBBBB\n" + + ":70E::SPRO//1234\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/123,45\n" + + ":97A::SAFE//100948783600\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/DAKV/8888\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::BUYR//SSSSNL2A\n" + + ":97A::SAFE//223602222\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//FOOVDEFF\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR1234,56\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("543", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -79,7 +77,7 @@ public void test543_1() { assertEquals("0000", b1.getSessionNumber()); assertEquals("000000", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("I543FOOODEFFXCUSN", b2.getBlockValue()); assertEquals("543", b2.getMessageType()); assertEquals("FOOODEFFXCUS", ((SwiftBlock2Input) b2).getReceiverAddress()); @@ -115,41 +113,40 @@ public void test543_1() { @Test public void test543_2() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOUKPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2004080300000523\n" + - ":23G:NEWM\n" + - ":98A::PREP//20040803\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20040801\n" + - ":98A::SETT//20040804\n" + - ":90B::DEAL//ACTU/EUR11,11\n" + - ":35B:ISIN FR1234567890\n" + - "UKUKUK SA\n" + - ":70E::SPRO//2222\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/1000,00\n" + - ":97A::SAFE//0655015035\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/SICV/2222\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::BUYR//FOOOUKPP\n" + - ":97A::SAFE//0655093044\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//SICVUKPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR11111,00\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOUKPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2004080300000523\n" + + ":23G:NEWM\n" + + ":98A::PREP//20040803\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20040801\n" + + ":98A::SETT//20040804\n" + + ":90B::DEAL//ACTU/EUR11,11\n" + + ":35B:ISIN FR1234567890\n" + + "UKUKUK SA\n" + + ":70E::SPRO//2222\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/1000,00\n" + + ":97A::SAFE//0655015035\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/SICV/2222\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::BUYR//FOOOUKPP\n" + + ":97A::SAFE//0655093044\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//SICVUKPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR11111,00\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("543", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I543FOOOUKPPXXXXN", b2.getBlockValue()); @@ -158,41 +155,40 @@ public void test543_2() { @Test public void test543_3() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOARPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2005071100000156\n" + - ":23G:NEWM\n" + - ":98A::PREP//11111111\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//11111111\n" + - ":98A::SETT//11111111\n" + - ":90B::DEAL//ACTU/EUR22,22\n" + - ":35B:ISIN AR1234567890\n" + - "FOOO\n" + - ":70E::SPRO//123\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/333,00\n" + - ":97A::SAFE//0655013333\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/SICV/444\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::BUYR//FOOANL2A\n" + - ":97A::SAFE//223602590\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//SICVARPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR8888,88\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOARPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2005071100000156\n" + + ":23G:NEWM\n" + + ":98A::PREP//11111111\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//11111111\n" + + ":98A::SETT//11111111\n" + + ":90B::DEAL//ACTU/EUR22,22\n" + + ":35B:ISIN AR1234567890\n" + + "FOOO\n" + + ":70E::SPRO//123\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/333,00\n" + + ":97A::SAFE//0655013333\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/SICV/444\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::BUYR//FOOANL2A\n" + + ":97A::SAFE//223602590\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//SICVARPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR8888,88\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("543", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I543FOOOARPPXXXXN", b2.getBlockValue()); @@ -201,41 +197,40 @@ public void test543_3() { @Test public void test543_4() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOPRPPXXXXN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//2005071400000574\n" + - ":23G:NEWM\n" + - ":98A::PREP//20050714\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20050713\n" + - ":98A::SETT//20050718\n" + - ":90B::DEAL//ACTU/EUR9,99\n" + - ":35B:ISIN PR1234567890\n" + - "FOOBAR SA\n" + - ":70E::SPRO//4444\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/500,00\n" + - ":97A::SAFE//0655015035\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/SICV/4444\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::BUYR//FOOOPRPP\n" + - ":97A::SAFE//0655093044\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//SICVPRPP\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//EUR4999,00\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOPRPPXXXXN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//2005071400000574\n" + + ":23G:NEWM\n" + + ":98A::PREP//20050714\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20050713\n" + + ":98A::SETT//20050718\n" + + ":90B::DEAL//ACTU/EUR9,99\n" + + ":35B:ISIN PR1234567890\n" + + "FOOBAR SA\n" + + ":70E::SPRO//4444\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/500,00\n" + + ":97A::SAFE//0655015035\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/SICV/4444\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::BUYR//FOOOPRPP\n" + + ":97A::SAFE//0655093044\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//SICVPRPP\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//EUR4999,00\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("543", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I543FOOOPRPPXXXXN", b2.getBlockValue()); @@ -244,43 +239,41 @@ public void test543_4() { @Test public void test543_5() { - messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOUS33XASTN}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//B070905000173\n" + - ":23G:NEWM\n" + - ":98A::PREP//20020908\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20020906\n" + - ":98A::SETT//20020909\n" + - ":90B::DEAL//ACTU/USD3,33\n" + - ":35B:ISIN CA1234567890\n" + - "NORFOO NETW\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//UNIT/3666,66\n" + - ":97A::SAFE//096373\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/DTCYID/050\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::BUYR//MSNYUS44\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//DTCYUS44\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::SETT//USD12345,56\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - "-}"; + messageToParse = "{1:F01FOOBARXXXXXX0000000000}{2:I543FOOOUS33XASTN}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//B070905000173\n" + + ":23G:NEWM\n" + + ":98A::PREP//20020908\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20020906\n" + + ":98A::SETT//20020909\n" + + ":90B::DEAL//ACTU/USD3,33\n" + + ":35B:ISIN CA1234567890\n" + + "NORFOO NETW\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//UNIT/3666,66\n" + + ":97A::SAFE//096373\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/DTCYID/050\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::BUYR//MSNYUS44\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//DTCYUS44\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::SETT//USD12345,56\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + "-}"; assertEquals("543", parseMessage(messageToParse).getType()); assertEquals("F01FOOBARXXXXXX0000000000", b1.getBlockValue()); assertEquals("I543FOOOUS33XASTN", b2.getBlockValue()); assertEquals(30, b4.countAll()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT564ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT564ParserTest.java index 8942b3c73..b99d7c74c 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT564ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT564ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * MT564 tests @@ -32,53 +31,54 @@ public class MT564ParserTest extends BaseMessageTestcase { @Test public void test564_1() { - final String msg = "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//D455103\n" + - ":20C::SEME//029206016\n" + - ":23G:NEWM\n" + - ":22F::CAEV//DVCA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20070316143348\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN CH0011075394\n" + - "/XX/5983816\n" + - "ZURICH FIN SVS GRP\n" + - "CHF0.10\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//760043140\n" + - ":94F::SAFE//CUST/UBSWCHZH80A\n" + - ":93B::ELIG//UNIT/7000,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::WITF//35,\n" + - ":92A::GRSS//0,000001000\n" + - ":16S:CADETL\n" + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":11A::OPTN//CHF\n" + - ":17B::DFLT//Y\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::GRSS//0,000001000\n" + - ":16R:CASHMOVE\n" + - ":22H::CRDB//CRED\n" + - ":19B::ENTL//CHF0,01\n" + - ":19B::GRSS//CHF0,01\n" + - ":19B::NETT//CHF0,01\n" + - ":98A::PAYD//20111111\n" + - ":98A::VALU//20111111\n" + - ":16S:CASHMOVE\n" + - ":16S:CAOPTN\n" + - "-}"; + final String msg = + "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + + ":16R:GENL\n" + + ":20C::CORP//D455103\n" + + ":20C::SEME//029206016\n" + + ":23G:NEWM\n" + + ":22F::CAEV//DVCA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20070316143348\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN CH0011075394\n" + + "/XX/5983816\n" + + "ZURICH FIN SVS GRP\n" + + "CHF0.10\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//760043140\n" + + ":94F::SAFE//CUST/UBSWCHZH80A\n" + + ":93B::ELIG//UNIT/7000,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::WITF//35,\n" + + ":92A::GRSS//0,000001000\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":11A::OPTN//CHF\n" + + ":17B::DFLT//Y\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::GRSS//0,000001000\n" + + ":16R:CASHMOVE\n" + + ":22H::CRDB//CRED\n" + + ":19B::ENTL//CHF0,01\n" + + ":19B::GRSS//CHF0,01\n" + + ":19B::NETT//CHF0,01\n" + + ":98A::PAYD//20111111\n" + + ":98A::VALU//20111111\n" + + ":16S:CASHMOVE\n" + + ":16S:CAOPTN\n" + + "-}"; SwiftMessage o = parseMessage(msg); assertEquals(6, o.getBlock4().countByName("16R")); @@ -94,7 +94,6 @@ public void test564_1() { assertEquals("20C", t.getName()); assertEquals(":SEME//029206016", t.getValue()); - // Last sub block pos = b4Tags.indexOf(blocks[5]); @@ -128,53 +127,54 @@ public void test564_1() { */ @Test public void test564_2() { - messageToParse = "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//D455103\n" + - ":20C::SEME//029206016\n" + - ":23G:NEWM\n" + - ":22F::CAEV//DVCA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20070316143348\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN CH0011075394\n" + - "/XX/5983816\n" + - "ZURICH FIN SVS GRP\n" + - "CHF0.10\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//760043140\n" + - ":94F::SAFE//CUST/UBSWCHZH80A\n" + - ":93B::ELIG//UNIT/7000,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::WITF//35,\n" + - ":92A::GRSS//0,000001000\n" + - ":16S:CADETL\n" + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":11A::OPTN//CHF\n" + - ":17B::DFLT//Y\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::GRSS//0,000001000\n" + - ":16R:CASHMOVE\n" + - ":22H::CRDB//CRED\n" + - ":19B::ENTL//CHF0,01\n" + - ":19B::GRSS//CHF0,01\n" + - ":19B::NETT//CHF0,01\n" + - ":98A::PAYD//20111111\n" + - ":98A::VALU//20111111\n" + - ":16S:CASHMOVE\n" + - ":16S:CAOPTN\n" + - "-}"; + messageToParse = + "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + + ":16R:GENL\n" + + ":20C::CORP//D455103\n" + + ":20C::SEME//029206016\n" + + ":23G:NEWM\n" + + ":22F::CAEV//DVCA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20070316143348\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN CH0011075394\n" + + "/XX/5983816\n" + + "ZURICH FIN SVS GRP\n" + + "CHF0.10\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//760043140\n" + + ":94F::SAFE//CUST/UBSWCHZH80A\n" + + ":93B::ELIG//UNIT/7000,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::WITF//35,\n" + + ":92A::GRSS//0,000001000\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":11A::OPTN//CHF\n" + + ":17B::DFLT//Y\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::GRSS//0,000001000\n" + + ":16R:CASHMOVE\n" + + ":22H::CRDB//CRED\n" + + ":19B::ENTL//CHF0,01\n" + + ":19B::GRSS//CHF0,01\n" + + ":19B::NETT//CHF0,01\n" + + ":98A::PAYD//20111111\n" + + ":98A::VALU//20111111\n" + + ":16S:CASHMOVE\n" + + ":16S:CAOPTN\n" + + "-}"; assertEquals("564", parseMessage(messageToParse).getType()); assertEquals("F01MTGSUS6SAXXX3206837054", b1.getBlockValue()); assertEquals("O5641435070316CHASGB2LDGST07128160300703160735N", b2.getBlockValue()); @@ -183,56 +183,57 @@ public void test564_2() { @Test public void test564_3() { - messageToParse = "{1:F01MIDLGB22XJAC0000000000}{2:O5640601101117HKBAAU2SXSYD00000000001011160601N}{3:{108:103200583375}}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//123456\n" + - ":20C::SEME//FOOLLFIXIT2\n" + - ":23G:NEWM\n" + - ":22F::CAEV//RHDI\n" + - ":22F::CAMV//MAND\n" + - ":98A::PREP//20101117\n" + - ":25D::PROC//PREC\n" + - ":16R:LINK\n" + - ":22F::LINK//AFTE\n" + - ":13A::LINK//564\n" + - ":20C::PREV//123757326622300\n" + - ":16S:LINK\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN AU000000SFR8\n" + - "SANDFIRE RESOURCES NL\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//011-176591-061\n" + - ":93B::SETT//UNIT/14586,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::ANOU//20101116\n" + - ":98B::XDTE//UKWN\n" + - ":98A::EXPI//20101208\n" + - ":98B::MKDT//UKWN\n" + - ":98A::SUBS//20101208\n" + - ":98B::RDDT//UKWN\n" + - ":98A::RDTE//20101119\n" + - ":90B::PRPP//ACTU/AUD6,6\n" + - ":22F::RHDI//EXRI\n" + - ":16S:CADETL\n" + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//SECU\n" + - ":22F::DISF//RDDN\n" + - ":17B::DFLT//Y\n" + - ":35B:/AU/+SFRRZ\n" + - "FOO RESOURCES NON R RTS\n" + - ":98B::AVAL//UKWN\n" + - ":98A::PAYD//20101122\n" + - ":92D::ADEX//1,/12,\n" + - ":16S:CAOPTN\n" + - ":16R:ADDINFO\n" + - ":70E::ADTX//.\n" + - ":95Q::MERE//ATT: LEE FOO\n" + - ":16S:ADDINFO\n" + - "-}{5:{CHK:000000000000}}"; + messageToParse = + "{1:F01MIDLGB22XJAC0000000000}{2:O5640601101117HKBAAU2SXSYD00000000001011160601N}{3:{108:103200583375}}{4:\n" + + ":16R:GENL\n" + + ":20C::CORP//123456\n" + + ":20C::SEME//FOOLLFIXIT2\n" + + ":23G:NEWM\n" + + ":22F::CAEV//RHDI\n" + + ":22F::CAMV//MAND\n" + + ":98A::PREP//20101117\n" + + ":25D::PROC//PREC\n" + + ":16R:LINK\n" + + ":22F::LINK//AFTE\n" + + ":13A::LINK//564\n" + + ":20C::PREV//123757326622300\n" + + ":16S:LINK\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN AU000000SFR8\n" + + "SANDFIRE RESOURCES NL\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//011-176591-061\n" + + ":93B::SETT//UNIT/14586,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::ANOU//20101116\n" + + ":98B::XDTE//UKWN\n" + + ":98A::EXPI//20101208\n" + + ":98B::MKDT//UKWN\n" + + ":98A::SUBS//20101208\n" + + ":98B::RDDT//UKWN\n" + + ":98A::RDTE//20101119\n" + + ":90B::PRPP//ACTU/AUD6,6\n" + + ":22F::RHDI//EXRI\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//SECU\n" + + ":22F::DISF//RDDN\n" + + ":17B::DFLT//Y\n" + + ":35B:/AU/+SFRRZ\n" + + "FOO RESOURCES NON R RTS\n" + + ":98B::AVAL//UKWN\n" + + ":98A::PAYD//20101122\n" + + ":92D::ADEX//1,/12,\n" + + ":16S:CAOPTN\n" + + ":16R:ADDINFO\n" + + ":70E::ADTX//.\n" + + ":95Q::MERE//ATT: LEE FOO\n" + + ":16S:ADDINFO\n" + + "-}{5:{CHK:000000000000}}"; assertEquals("564", parseMessage(messageToParse).getType()); assertEquals(":SETT//UNIT/14586,", b4.getTagValue("93B")); @@ -240,5 +241,4 @@ public void test564_3() { b4.getTagByName("93B").setValue(":SETT//UNIT/0000,"); assertEquals(":SETT//UNIT/0000,", b4.getTagValue("93B")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java index 70370d9f9..ac0a13589 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,21 +28,20 @@ public class MT900ParserTest extends BaseMessageTestcase { @Test public void testImproperBlock4Ending() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO. FOOBANK NA (HONG KONG)\n" + - "ATTN. FOO - FOO OPERATIONS\n" + - "FROM.\n" + - "RE. FOO SUB A/C 123456\n" + - "A/C: 961XXX\n" + - ".\n" + - "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + - ".\n" + - "INSTRUCTIONS:\n" + - ".\n" + - "REGARDS,\n" + - "}" + - "{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:TO. FOOBANK NA (HONG KONG)\n" + + "ATTN. FOO - FOO OPERATIONS\n" + + "FROM.\n" + + "RE. FOO SUB A/C 123456\n" + + "A/C: 961XXX\n" + + ".\n" + + "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + + ".\n" + + "INSTRUCTIONS:\n" + + ".\n" + + "REGARDS,\n" + + "}" + + "{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; parseMessage(messageToParse); assertEquals("900", this.o.getType()); @@ -56,12 +55,11 @@ public void testImproperBlock4Ending() { @Test public void testMissingEOBandB5() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO FOO\n" + - "REGARDS,\n" + - "{" + - "{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:TO FOO\n" + + "REGARDS,\n" + + "{" + + "{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; parseMessage(messageToParse); assertEquals("900", this.o.getType()); @@ -74,11 +72,10 @@ public void testMissingEOBandB5() { @Test public void testMissingEOBAndEOF() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO FOO\n" + - "INSTRUCTIONS:\n" + - "{"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I900FOOBARXXXXXXN}{4:\n" + ":20:628735BKRU3X\n" + + ":79:TO FOO\n" + + "INSTRUCTIONS:\n" + + "{"; parseMessage(messageToParse); assertEquals("900", this.o.getType()); @@ -86,5 +83,4 @@ public void testMissingEOBAndEOF() { String last = b4.getTagByName("79").getValue(); assertTrue(last.endsWith("\n{")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT940ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT940ParserTest.java index fa5ded9a7..b40ac9832 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT940ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT940ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import com.prowidesoftware.swift.io.ConversionService; import com.prowidesoftware.swift.io.IConversionService; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; /** * MT940 tests @@ -32,44 +31,43 @@ public class MT940ParserTest extends BaseMessageTestcase { @Test public void test940_1() { - messageToParse = " {1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\n" + - ":20:REFXXXXX\n" + - ":25:K005201001004509050156\n" + - ":28C:00001\n" + - ":60F:C051007XOF2644893271,0\n" + - ":61:0710241024DF4105400,0FMSC1234567890\n" + - "TEST LIBELLE\n" + - ":61:0710251025DF3000000000,0FMSC1234567890\n" + - "TEST LIBELLE\n" + - ":61:0710251025CF959919691,0FMSC1234567890\n" + - "TEST LIBELLE\n" + - ":61:0710251025CF523237057,0FMSC1234567890\n" + - "TEST LIBELLE\n" + - ":61:0710251025CF3000000000,0FMSC1234567890\n" + - "TEST LIBELLE\n" + - ":62F:C061207XOF4123944619,0\n" + - ":86:Message de bienvenue\n" + - "-}"; + messageToParse = " {1:F01FOOBARXXAXXX0000000000}{2:I940FOOBARXXXXXXN}{4:\n" + ":20:REFXXXXX\n" + + ":25:K005201001004509050156\n" + + ":28C:00001\n" + + ":60F:C051007XOF2644893271,0\n" + + ":61:0710241024DF4105400,0FMSC1234567890\n" + + "TEST LIBELLE\n" + + ":61:0710251025DF3000000000,0FMSC1234567890\n" + + "TEST LIBELLE\n" + + ":61:0710251025CF959919691,0FMSC1234567890\n" + + "TEST LIBELLE\n" + + ":61:0710251025CF523237057,0FMSC1234567890\n" + + "TEST LIBELLE\n" + + ":61:0710251025CF3000000000,0FMSC1234567890\n" + + "TEST LIBELLE\n" + + ":62F:C061207XOF4123944619,0\n" + + ":86:Message de bienvenue\n" + + "-}"; assertEquals("940", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXAXXX0000000000", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); - //assertEquals("ABCDEFGHIJKX", b1.getLogicalTerminal()); - //assertEquals("3227", b1.getSessionNumber()); - //assertEquals("607589", b1.getSequenceNumber()); + // assertEquals("ABCDEFGHIJKX", b1.getLogicalTerminal()); + // assertEquals("3227", b1.getSessionNumber()); + // assertEquals("607589", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("I940FOOBARXXXXXXN", b2.getBlockValue()); assertEquals("940", b2.getMessageType()); - //assertEquals("FOOBARXXXXXX", ((SwiftBlock2Input)b2).getReceiverAddress()); - //assertEquals("N", ((SwiftBlock2Input)b2).getMessagePriority()); - //assertNull(((SwiftBlock2Input)b2).getDeliveryMonitoring()); - //assertNull(((SwiftBlock2Input)b2).getObsolescencePeriod()); + // assertEquals("FOOBARXXXXXX", ((SwiftBlock2Input)b2).getReceiverAddress()); + // assertEquals("N", ((SwiftBlock2Input)b2).getMessagePriority()); + // assertNull(((SwiftBlock2Input)b2).getDeliveryMonitoring()); + // assertNull(((SwiftBlock2Input)b2).getObsolescencePeriod()); - //check b4 + // check b4 assertEquals(11, b4.countAll()); assertEquals("REFXXXXX", b4.getTagValue("20")); assertEquals("K005201001004509050156", b4.getTagValue("25")); @@ -93,101 +91,99 @@ public void test940_1() { */ @Test public void test940_2() throws IOException { - String expectedMT940 = "{1:F01SBZAZAJJXXXX0000999999}{2:I940SBZAZAJJTINXN2999}{4:\r\n" + - ":20:S00147 L00001\r\n" + - ":25:401450139\r\n" + - ":28C:00147/00001\r\n" + - ":60F:C100915ZAR504917,30\r\n" + - ":61:1009150915C228,00FTRF019440587//019440587\r\n" + - ":86:CREDIT TRANSFER\r\n" + - "019440587\r\n" + - "9119\r\n" + - "000000000000036\r\n" + - "0,00\r\n" + - ":61:1009150915D500,00FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009150915D100,00FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009150915D6,70FDDT000000094//000000094\r\n" + - ":86:PAYMENT\r\n" + - "000000094\r\n" + - "1509\r\n" + - "000000000000071\r\n" + - "0,00\r\n" + - ":61:1009150915D4,85FDDT000000094//000000094\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000094\r\n" + - "1509\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009170917D500,00FCHG000301284//000301284\r\n" + - ":86:CHEQUE CASHED\r\n" + - "000301284\r\n" + - "\r\n" + - "000000000000062\r\n" + - "0,00\r\n" + - ":61:1009170917D350,00FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009170917D6,70FDDT000000094//000000094\r\n" + - ":86:PAYMENT\r\n" + - "000000094\r\n" + - "1709\r\n" + - "000000000000071\r\n" + - "0,00\r\n" + - ":61:1009170917D7,60FDDT000000094//000000094\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000094\r\n" + - "1709\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009200920D350,00FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009200920D3554,92FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009200920D6,70FDDT000000094//000000094\r\n" + - ":86:PAYMENT\r\n" + - "000000094\r\n" + - "2009\r\n" + - "000000000000071\r\n" + - "0,00\r\n" + - ":61:1009200920D7,60FDDT000000094//000000094\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000094\r\n" + - "2009\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":61:1009210921D100,00FDDT000000083//000000083\r\n" + - ":86:MONEY TRANSFER DEBIT\r\n" + - "000000083\r\n" + - "\r\n" + - "000000000000072\r\n" + - "0,00\r\n" + - ":62M:C100921ZAR499650,23\r\n" + - "-}"; + String expectedMT940 = "{1:F01SBZAZAJJXXXX0000999999}{2:I940SBZAZAJJTINXN2999}{4:\r\n" + ":20:S00147 L00001\r\n" + + ":25:401450139\r\n" + + ":28C:00147/00001\r\n" + + ":60F:C100915ZAR504917,30\r\n" + + ":61:1009150915C228,00FTRF019440587//019440587\r\n" + + ":86:CREDIT TRANSFER\r\n" + + "019440587\r\n" + + "9119\r\n" + + "000000000000036\r\n" + + "0,00\r\n" + + ":61:1009150915D500,00FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009150915D100,00FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009150915D6,70FDDT000000094//000000094\r\n" + + ":86:PAYMENT\r\n" + + "000000094\r\n" + + "1509\r\n" + + "000000000000071\r\n" + + "0,00\r\n" + + ":61:1009150915D4,85FDDT000000094//000000094\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000094\r\n" + + "1509\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009170917D500,00FCHG000301284//000301284\r\n" + + ":86:CHEQUE CASHED\r\n" + + "000301284\r\n" + + "\r\n" + + "000000000000062\r\n" + + "0,00\r\n" + + ":61:1009170917D350,00FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009170917D6,70FDDT000000094//000000094\r\n" + + ":86:PAYMENT\r\n" + + "000000094\r\n" + + "1709\r\n" + + "000000000000071\r\n" + + "0,00\r\n" + + ":61:1009170917D7,60FDDT000000094//000000094\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000094\r\n" + + "1709\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009200920D350,00FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009200920D3554,92FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009200920D6,70FDDT000000094//000000094\r\n" + + ":86:PAYMENT\r\n" + + "000000094\r\n" + + "2009\r\n" + + "000000000000071\r\n" + + "0,00\r\n" + + ":61:1009200920D7,60FDDT000000094//000000094\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000094\r\n" + + "2009\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":61:1009210921D100,00FDDT000000083//000000083\r\n" + + ":86:MONEY TRANSFER DEBIT\r\n" + + "000000083\r\n" + + "\r\n" + + "000000000000072\r\n" + + "0,00\r\n" + + ":62M:C100921ZAR499650,23\r\n" + + "-}"; IConversionService conversionService = new ConversionService(); String actualMT940 = conversionService.getFIN(new SwiftParser(expectedMT940).message()); assertEquals(actualMT940, expectedMT940); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MT950ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MT950ParserTest.java index 51e22f803..4e3b11505 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MT950ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MT950ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,19 +29,18 @@ public class MT950ParserTest extends BaseMessageTestcase { @Test public void test535_1() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I950FOOBARXXXXXXN}{4:\n" + - ":20:12345678070403\n" + - ":25:12345678\n" + - ":28C:93/1\n" + - ":60F:C070403USD0,\n" + - ":61:0704050402C115454,92NSALNONREF\n" + - "/US/037833100/SHS/1235,\n" + - ":62M:C070403USD115454,92\n" + - "-}{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I950FOOBARXXXXXXN}{4:\n" + ":20:12345678070403\n" + + ":25:12345678\n" + + ":28C:93/1\n" + + ":60F:C070403USD0,\n" + + ":61:0704050402C115454,92NSALNONREF\n" + + "/US/037833100/SHS/1235,\n" + + ":62M:C070403USD115454,92\n" + + "-}{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; assertEquals("950", parseMessage(messageToParse).getType()); - //check b1 + // check b1 assertEquals("F01FOOBARXXAXXX3227607589", b1.getBlockValue()); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -49,7 +48,7 @@ public void test535_1() { assertEquals("3227", b1.getSessionNumber()); assertEquals("607589", b1.getSequenceNumber()); - //check b2 + // check b2 assertEquals("I950FOOBARXXXXXXN", b2.getBlockValue()); assertEquals("950", b2.getMessageType()); assertEquals("FOOBARXXXXXX", ((SwiftBlock2Input) b2).getReceiverAddress()); @@ -57,7 +56,7 @@ public void test535_1() { assertNull(((SwiftBlock2Input) b2).getDeliveryMonitoring()); assertNull(((SwiftBlock2Input) b2).getObsolescencePeriod()); - //check b4 + // check b4 assertEquals(6, b4.countAll()); assertEquals("12345678070403", b4.getTagValue("20")); assertEquals("12345678", b4.getTagValue("25")); @@ -66,13 +65,12 @@ public void test535_1() { assertEquals("0704050402C115454,92NSALNONREF\n" + "/US/037833100/SHS/1235,", b4.getTagValue("61")); assertEquals("C070403USD115454,92", b4.getTagValue("62M")); - //check b5 + // check b5 assertEquals(1, b5.countAll()); assertEquals("12C48A7C53B2", b5.getTagValue("CHK")); - //user block (extra data, not swift standard, attached to the message as a trailer block) + // user block (extra data, not swift standard, attached to the message as a trailer block) assertNotNull(o.getUserBlock("S")); assertEquals("I20070404.763727356.out/1/1", o.getUserBlock("S").getTagValue("REF")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/MTn9nParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/MTn9nParserTest.java index cd5a6d04c..09bf9491c 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/MTn9nParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/MTn9nParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,11 +26,10 @@ public class MTn9nParserTest extends BaseMessageTestcase { @Test public void test192_1() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":11S:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":11S:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("192", parseMessage(messageToParse).getType()); assertEquals(3, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -40,12 +39,11 @@ public void test192_1() { @Test public void test192_2() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":11S:FOO\n" + - ":79:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":11S:FOO\n" + + ":79:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("192", parseMessage(messageToParse).getType()); assertEquals(4, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -56,14 +54,13 @@ public void test192_2() { @Test public void test192_3() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":11S:FOO\n" + - ":79:FOO\n" + - ":52A:FOO\n" + - ":23G:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":11S:FOO\n" + + ":79:FOO\n" + + ":52A:FOO\n" + + ":23G:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("192", parseMessage(messageToParse).getType()); assertEquals(6, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -76,13 +73,12 @@ public void test192_3() { @Test public void test192_4() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":11S:FOO\n" + - ":52A:FOO\n" + - ":23G:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":11S:FOO\n" + + ":52A:FOO\n" + + ":23G:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("192", parseMessage(messageToParse).getType()); assertEquals(5, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -94,14 +90,13 @@ public void test192_4() { @Test public void test192_5() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":11S:FOO\n" + - ":59:FOO\n" + - "FOO2\n" + - ":23G:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I192FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":11S:FOO\n" + + ":59:FOO\n" + + "FOO2\n" + + ":23G:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("192", parseMessage(messageToParse).getType()); assertEquals(5, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -113,11 +108,10 @@ public void test192_5() { @Test public void test195_1() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("195", parseMessage(messageToParse).getType()); assertEquals(3, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -127,12 +121,11 @@ public void test195_1() { @Test public void test195_2() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - ":79:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + ":79:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("195", parseMessage(messageToParse).getType()); assertEquals(4, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -143,14 +136,13 @@ public void test195_2() { @Test public void test195_3() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - ":79:FOO\n" + - ":20:FOO\n" + - ":21:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + ":79:FOO\n" + + ":20:FOO\n" + + ":21:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("195", parseMessage(messageToParse).getType()); assertEquals(6, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -163,15 +155,14 @@ public void test195_3() { @Test public void test195_4() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - ":11R:FOO\n" + - ":21:FOO\n" + - ":52A:FOO\n" + - ":23G:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + ":11R:FOO\n" + + ":21:FOO\n" + + ":52A:FOO\n" + + ":23G:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("195", parseMessage(messageToParse).getType()); assertEquals(7, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -185,18 +176,17 @@ public void test195_4() { @Test public void test195_5() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - ":11R:FOO\n" + - ":21:FOO\n" + - ":52A:FOO\n" + - ":23G:FOO\n" + - ":59:FOO\n" + - "FOO2\n" + - ":20:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I195FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + ":11R:FOO\n" + + ":21:FOO\n" + + ":52A:FOO\n" + + ":23G:FOO\n" + + ":59:FOO\n" + + "FOO2\n" + + ":20:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("195", parseMessage(messageToParse).getType()); assertEquals(9, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -212,18 +202,17 @@ public void test195_5() { @Test public void test196_1() { - messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I196FOOBARXXXXXXN}{4:\n" + - ":20:FOO\n" + - ":21:FOO\n" + - ":75:FOO\n" + - ":11R:FOO\n" + - ":21:FOO\n" + - ":52A:FOO\n" + - ":23G:FOO\n" + - ":59:FOO\n" + - "FOO2\n" + - ":20:FOO\n" + - "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; + messageToParse = "{1:F01FOOBARXXAXXX3227607589}{2:I196FOOBARXXXXXXN}{4:\n" + ":20:FOO\n" + + ":21:FOO\n" + + ":75:FOO\n" + + ":11R:FOO\n" + + ":21:FOO\n" + + ":52A:FOO\n" + + ":23G:FOO\n" + + ":59:FOO\n" + + "FOO2\n" + + ":20:FOO\n" + + "-}{5:{MAC:0D3E6718}{CHK:76FFBA03C41F}}"; assertEquals("196", parseMessage(messageToParse).getType()); assertEquals(9, b4.countAll()); assertEquals("FOO", b4.getTagValue("20")); @@ -236,5 +225,4 @@ public void test196_1() { assertEquals("FOO\nFOO2", b4.getTagValue("59")); assertEquals("FOO", b4.getTagValue("20")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/ParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/ParserTest.java index 82b76a79f..b3afd3ba7 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/ParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,11 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.mt.mt1xx.MT101; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - import java.io.File; import java.io.IOException; import java.io.InputStream; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ParserTest { @@ -92,5 +91,4 @@ protected SwiftMessage parseMessage(String messagePath) { } return null; } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java index 48e6b64ef..d4d5a27fe 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import com.prowidesoftware.swift.Constants; import com.prowidesoftware.swift.model.*; +import java.io.IOException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.IOException; - /** * Swift parser tests using the default lenient (permissive) mode. * @@ -104,69 +103,56 @@ public void testConsumeBock3MissingClosingBracket() throws IOException { @Test public void testBlock4MissingClossingBracket() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO"); + parser.setData("{4:\r\n" + ":79:FOO"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingBracket2() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n"); + parser.setData("{4:\r\n" + ":79:FOO\r\n"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingBracket3() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "-"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "-"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingBracket4() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "-{"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "-{"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingBracket5() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "-{5:CHK:ABSH}"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "-{5:CHK:ABSH}"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingHyphen() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "}"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "}"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4MissingClossingHyphen2() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO}"); + parser.setData("{4:\r\n" + ":79:FOO}"); parser.consumeBlock(null); assertError(); } @Test public void testBlock4ClossingBracketOk() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "-}"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "-}"); parser.consumeBlock(null); } @@ -195,40 +181,39 @@ public void testConsumeBock_02() throws IOException { @Test public void testConsumeBock_03() throws IOException { - parser.setData("{1:F01FOOBARXXXXXX0000000000}{2:I541CITIGB2LXXXXN}{4:\r\n" + - ":16R:GENL\r\n" + - ":20C::SEME//2005070600000006\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050706\r\n" + - ":16S:GENL\r\n" + - ":16R:TRADDET\r\n" + - ":98A::TRAD//20050706\r\n" + - ":98A::SETT//20050711\r\n" + - ":90B::DEAL//ACTU/GBP1,38\r\n" + - ":35B:ISIN GB0007192106\r\n" + - "VODAFONE\r\n" + - ":16S:TRADDET\r\n" + - ":16R:FIAC\r\n" + - ":36B::SETT//UNIT/5000,00\r\n" + - ":97A::SAFE//6990457647\r\n" + - ":16S:FIAC\r\n" + - ":16R:SETDET\r\n" + - ":22F::SETR//TRAD\r\n" + - ":16R:SETPRTY\r\n" + - ":95R::DEAG/CRST/382\r\n" + - ":16S:SETPRTY\r\n" + - ":16R:SETPRTY\r\n" + - ":95P::SELL//ISNTGB2L\r\n" + - ":16S:SETPRTY\r\n" + - ":16R:SETPRTY\r\n" + - ":95P::PSET//CRSTGB22\r\n" + - ":16S:SETPRTY\r\n" + - ":16R:AMT\r\n" + - ":19A::SETT//GBP6958,31\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET\r\n" + - "-}\r\n" + - ""); + parser.setData("{1:F01FOOBARXXXXXX0000000000}{2:I541CITIGB2LXXXXN}{4:\r\n" + ":16R:GENL\r\n" + + ":20C::SEME//2005070600000006\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050706\r\n" + + ":16S:GENL\r\n" + + ":16R:TRADDET\r\n" + + ":98A::TRAD//20050706\r\n" + + ":98A::SETT//20050711\r\n" + + ":90B::DEAL//ACTU/GBP1,38\r\n" + + ":35B:ISIN GB0007192106\r\n" + + "VODAFONE\r\n" + + ":16S:TRADDET\r\n" + + ":16R:FIAC\r\n" + + ":36B::SETT//UNIT/5000,00\r\n" + + ":97A::SAFE//6990457647\r\n" + + ":16S:FIAC\r\n" + + ":16R:SETDET\r\n" + + ":22F::SETR//TRAD\r\n" + + ":16R:SETPRTY\r\n" + + ":95R::DEAG/CRST/382\r\n" + + ":16S:SETPRTY\r\n" + + ":16R:SETPRTY\r\n" + + ":95P::SELL//ISNTGB2L\r\n" + + ":16S:SETPRTY\r\n" + + ":16R:SETPRTY\r\n" + + ":95P::PSET//CRSTGB22\r\n" + + ":16S:SETPRTY\r\n" + + ":16R:AMT\r\n" + + ":19A::SETT//GBP6958,31\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET\r\n" + + "-}\r\n" + + ""); final SwiftBlock1 b1 = (SwiftBlock1) parser.consumeBlock(null); assertNotNull(b1); assertEquals(1, b1.getNumber().intValue()); @@ -242,7 +227,7 @@ public void testConsumeBock_03() throws IOException { final SwiftBlock4 b4 = (SwiftBlock4) parser.consumeBlock(null); assertNotNull(b4); assertEquals(4, b4.getNumber().intValue()); - //assertEquals("", b4.getBlockValue()); + // assertEquals("", b4.getBlockValue()); final SwiftBlock nil = parser.consumeBlock(null); assertNull(nil); @@ -342,5 +327,4 @@ public void testConsumeEmptyLinesField() { this.parser.consumeBlock4(b4, "\n:20:FOO\r\n\r\n"); assertEquals("FOO\r\n", b4.getTags().get(4).getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockStrictTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockStrictTest.java index 70d5e5937..77afcff0c 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockStrictTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockStrictTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,11 @@ */ package com.prowidesoftware.swift.io.parser; +import java.io.IOException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.IOException; - /** * Swift parser tests using the non lenient (strict) configuration. * @@ -42,7 +41,6 @@ public void testConsumeBock1InvalidValueSize() { parser.setData("{1:012345678901}"); parser.consumeBlock(null); }); - } @Test @@ -51,7 +49,6 @@ public void testConsumeBock1MissingClossingBracket() { parser.setData("{1:0123456789012345678901234"); parser.consumeBlock(null); }); - } @Test @@ -69,7 +66,6 @@ public void testConsumeBock2InvalidValueSize() { parser.consumeBlock(null); // block 1 parser.consumeBlock(null); }); // block 2 - } @Test @@ -80,7 +76,6 @@ public void testConsumeBock2MissingClosingBracket() { parser.consumeBlock(null); // block 1 parser.consumeBlock(null); }); // block 2 - } @Test @@ -154,7 +149,6 @@ public void testBlock4MissingClossingHyphen() { parser.setData("{4:\r\n" + ":79:FOO\r\n" + "}"); parser.consumeBlock(null); }); - } @Test @@ -167,10 +161,7 @@ public void testBlock4MissingClossingHyphen2() { @Test public void testBlock4ClossingBracketOk() throws IOException { - parser.setData("{4:\r\n" + - ":79:FOO\r\n" + - "-}"); + parser.setData("{4:\r\n" + ":79:FOO\r\n" + "-}"); parser.consumeBlock(null); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeTagTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeTagTest.java index 2b2e3242d..e83ed5894 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeTagTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeTagTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,10 @@ import com.prowidesoftware.swift.Constants; import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.io.StringReader; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test cases for the consumeTag and related methos in the parser implementation @@ -67,8 +66,7 @@ public void testConsumeTagWithBraquets() { @Test public void testConsumeTagColons1() { - Tag o = this.parser.consumeTag(":86:/FOO\n" + - ":BAR\n"); + Tag o = this.parser.consumeTag(":86:/FOO\n" + ":BAR\n"); assertTrue(o.getValue().contains("BAR")); } @@ -96,25 +94,24 @@ public void testTagStartsFalse() { @Test public void testFindEndOfTag1() { - final String s = "4:\n" + - ":20:628735BKRU3X\n" + - ":79:TO FOO\n" + - "ATTN. FOO OPERATIONS\n" + - "FROM.\n" + - "RE. JOE DOE A/C 1111\n" + - "A/C: 961XXX\n" + - ".\n" + - "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + - "RATE 10.0000\n" + - ".\n" + - "INSTRUCTIONS:\n" + - "STATE STREET BANK AND TRUST CO, NA NEW YORK\n" + - "SWIFT CODE: FOOSUS3N\n" + - "VALUE 22 MAY 2012\n" + - ".\n" + - "REGARDS,\n" + - "}\n" + - "-"; + final String s = "4:\n" + ":20:628735BKRU3X\n" + + ":79:TO FOO\n" + + "ATTN. FOO OPERATIONS\n" + + "FROM.\n" + + "RE. JOE DOE A/C 1111\n" + + "A/C: 961XXX\n" + + ".\n" + + "WE CONFIRM TO INCREASE THE FOLLOWING DEPOSIT FROM\n" + + "RATE 10.0000\n" + + ".\n" + + "INSTRUCTIONS:\n" + + "STATE STREET BANK AND TRUST CO, NA NEW YORK\n" + + "SWIFT CODE: FOOSUS3N\n" + + "VALUE 22 MAY 2012\n" + + ".\n" + + "REGARDS,\n" + + "}\n" + + "-"; final int start = 21; final int end = this.parser.findEndOfTagByLineFeed(s, start, true); final String tag = s.substring(start, end); @@ -177,18 +174,15 @@ public void testFindEndOfTag7() { assertEquals('\r', s.charAt(end)); } - @Test public void testFieldStartingWithColon() throws Exception { - final String val = "/PY/OSA PAYMENT/BN/FOO LIMITED/BN1/6/F,HONGCHANG PLAZA,N\n" + - ":6542670O2001,/BN2/SHENNAN ROAD EAST,LUOHU DIST,/BN3/SHENZHEN,CHINA/BI/12\n" + - "44712009/BO/INFINITY HOME LIMITED ROOM 2105 FZ2250 TREND CTR 29-3\n" + - "1 CH/BO3/EUNG LEE STREET CHAI WAN HK/CM/USD1,00/CA/1244712009/OB/\n" + - "CHINA FOO BANK/PT/FT/PO/0005/OCMT/USD2620,80/XT/CD/REF/1029\n" + - "200004099"; - final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + - ":86:" + val + "\n" + - "-}"; + final String val = "/PY/OSA PAYMENT/BN/FOO LIMITED/BN1/6/F,HONGCHANG PLAZA,N\n" + + ":6542670O2001,/BN2/SHENNAN ROAD EAST,LUOHU DIST,/BN3/SHENZHEN,CHINA/BI/12\n" + + "44712009/BO/INFINITY HOME LIMITED ROOM 2105 FZ2250 TREND CTR 29-3\n" + + "1 CH/BO3/EUNG LEE STREET CHAI WAN HK/CM/USD1,00/CA/1244712009/OB/\n" + + "CHINA FOO BANK/PT/FT/PO/0005/OCMT/USD2620,80/XT/CD/REF/1029\n" + + "200004099"; + final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + ":86:" + val + "\n" + "-}"; final SwiftParser p = new SwiftParser(new StringReader(fin)); final SwiftMessage msg = p.message(); assertEquals(1, msg.getBlock4().countAll()); @@ -198,10 +192,7 @@ public void testFieldStartingWithColon() throws Exception { @Test public void testFieldStartingWithColonTrimmed() throws Exception { - final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + - ":86:/FOO\n" + - ":123BAR\n" + - "-}"; + final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + ":86:/FOO\n" + ":123BAR\n" + "-}"; final SwiftParser p = new SwiftParser(new StringReader(fin)); final SwiftMessage msg = p.message(); assertEquals(1, msg.getBlock4().countAll()); @@ -209,10 +200,7 @@ public void testFieldStartingWithColonTrimmed() throws Exception { @Test public void testFieldStartingWithColonTrimmedColonAndText() throws Exception { - final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + - ":86:/FOO\n" + - ":BAR\n" + - "-}"; + final String fin = "{1:" + Constants.B1_DATA + "}{4:\n" + ":86:/FOO\n" + ":BAR\n" + "-}"; final SwiftParser p = new SwiftParser(new StringReader(fin)); final SwiftMessage msg = p.message(); assertEquals(1, msg.getBlock4().countAll()); @@ -220,12 +208,13 @@ public void testFieldStartingWithColonTrimmedColonAndText() throws Exception { @Test public void testTag77Exceptions_1() throws Exception { - final String m = "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:^M\r\n" + - ":77E: \r\n" + - "ABCDEFG\r\n" + - "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + - "\r\n" + - ""; + final String m = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:^M\r\n" + + ":77E: \r\n" + + "ABCDEFG\r\n" + + "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + + "\r\n" + + ""; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); assertEquals(msg.getBlock4().getTagByName("77E").getValue(), " \r\n" + "ABCDEFG"); @@ -233,12 +222,13 @@ public void testTag77Exceptions_1() throws Exception { @Test public void testTag77Exceptions_2() throws Exception { - final String m = "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + - ":77E:\r\n" + - "ABCDEFG\r\n" + - "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + - "\r\n" + - ""; + final String m = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + + ":77E:\r\n" + + "ABCDEFG\r\n" + + "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + + "\r\n" + + ""; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); assertEquals(msg.getBlock4().getTagByName("77E").getValue(), "\r\n" + "ABCDEFG"); @@ -246,13 +236,14 @@ public void testTag77Exceptions_2() throws Exception { @Test public void testTag77Exceptions_3() throws Exception { - final String m = "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + - ":77E::\r\n" + - ":\r\n" + - "QWERTYU\r\n" + - "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + - "\r\n" + - ""; + final String m = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + + ":77E::\r\n" + + ":\r\n" + + "QWERTYU\r\n" + + "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + + "\r\n" + + ""; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); assertEquals(msg.getBlock4().getTagByName("77E").getValue(), ":\r\n" + ":\r\n" + "QWERTYU"); @@ -260,13 +251,14 @@ public void testTag77Exceptions_3() throws Exception { @Test public void testTag77Exceptions_4() throws Exception { - final String m = "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + - ":77E:-\r\n" + - ":\r\n" + - "ZXCVBNM\r\n" + - "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + - "\r\n" + - ""; + final String m = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030811060227FOOBBSMMAXXX55529746000602270811N}{3:{113:NOMF}{108:0602021485081594}{119:STP}}{4:\r\n" + + ":77E:-\r\n" + + ":\r\n" + + "ZXCVBNM\r\n" + + "-}{5:{MAC:80C69B21}{CHK:63035B4672E0}}\r\n" + + "\r\n" + + ""; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); assertEquals(msg.getBlock4().getTagByName("77E").getValue(), "-\r\n" + ":\r\n" + "ZXCVBNM"); @@ -277,39 +269,41 @@ public void testTag77Exceptions_4() throws Exception { */ @Test public void test_MT535_35B_with_colon() throws Exception { - final String m = "{1:F01BFOOUS3IADNC0147771111}{2:O5350837080313FOOSGB2LIXXX06988488300803130437N}{3:{108:000952CQ1650453}}{4:\r\n" + - ":16R:GENL\r\n" + - ":28E:6/MORE\r\n" + - ":20C::SEME//H200803121132222\r\n" + - ":23G:NEWM\r\n" + - ":98A::STAT//20080312\r\n" + - ":22F::SFRE//DAIL\r\n" + - ":22F::CODE//COMP\r\n" + - ":22F::STTY//CUST\r\n" + - ":22F::STBA//TRAD\r\n" + - ":97A::SAFE//S 02500\r\n" + - ":17B::ACTI//Y\r\n" + - ":17B::AUDT//N\r\n" + - ":17B::CONS//N\r\n" + - ":16S:GENL\r\n" + - ":16R:SUBSAFE\r\n" + - ":16R:FIN\r\n" + - // :35B:ISIN XS0222550880 4,125? LANXESS FIN.B.V.NT.V.05 21.6 :12 - ":35B:/US/AGGR_AVAI\r\n" + - "AGGR=300, AVAI:=200\r\n" + - ":16R:FIA\r\n" + - ":12A::CLAS/ISIT/STF\r\n" + - ":16S:FIA\r\n" + - ":93B::AGGR//FAMT/300,\r\n" + - ":93B::AVAI//FAMT/200,\r\n" + - ":16R:SUBBAL\r\n" + - ":93B::AGGR//FAMT/50,\r\n" + - ":94F::SAFE//CUST/FOOSUS33\r\n" + - ":70C::SUBB//REGISTRATION CODE MEMR\n" + - ":16S:SUBBAL\r\n" + - ":16S:FIN\r\n" + - ":16R:FIN\r\n" + - "-}"; + final String m = + "{1:F01BFOOUS3IADNC0147771111}{2:O5350837080313FOOSGB2LIXXX06988488300803130437N}{3:{108:000952CQ1650453}}{4:\r\n" + + ":16R:GENL\r\n" + + ":28E:6/MORE\r\n" + + ":20C::SEME//H200803121132222\r\n" + + ":23G:NEWM\r\n" + + ":98A::STAT//20080312\r\n" + + ":22F::SFRE//DAIL\r\n" + + ":22F::CODE//COMP\r\n" + + ":22F::STTY//CUST\r\n" + + ":22F::STBA//TRAD\r\n" + + ":97A::SAFE//S 02500\r\n" + + ":17B::ACTI//Y\r\n" + + ":17B::AUDT//N\r\n" + + ":17B::CONS//N\r\n" + + ":16S:GENL\r\n" + + ":16R:SUBSAFE\r\n" + + ":16R:FIN\r\n" + + + // :35B:ISIN XS0222550880 4,125? LANXESS FIN.B.V.NT.V.05 21.6 :12 + ":35B:/US/AGGR_AVAI\r\n" + + "AGGR=300, AVAI:=200\r\n" + + ":16R:FIA\r\n" + + ":12A::CLAS/ISIT/STF\r\n" + + ":16S:FIA\r\n" + + ":93B::AGGR//FAMT/300,\r\n" + + ":93B::AVAI//FAMT/200,\r\n" + + ":16R:SUBBAL\r\n" + + ":93B::AGGR//FAMT/50,\r\n" + + ":94F::SAFE//CUST/FOOSUS33\r\n" + + ":70C::SUBB//REGISTRATION CODE MEMR\n" + + ":16S:SUBBAL\r\n" + + ":16S:FIN\r\n" + + ":16R:FIN\r\n" + + "-}"; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); assertEquals(msg.getBlock4().getTagByName("35B").getValue(), "/US/AGGR_AVAI\r\nAGGR=300, AVAI:=200"); @@ -320,45 +314,46 @@ public void test_MT535_35B_with_colon() throws Exception { */ @Test public void test_MT535_35B_with_colon_2() throws Exception { - final String m = "{1:F01BFOOUS3IADNC0147771111}{2:O5350837080313FOOSGB2LIXXX06988488300803130437N}{3:{108:000952CQ1650453}}{4:\r\n" + - ":16R:GENL\r\n" + - ":28E:6/MORE\r\n" + - ":20C::SEME//H200803121132222\r\n" + - ":23G:NEWM\r\n" + - ":98A::STAT//20080312\r\n" + - ":22F::SFRE//DAIL\r\n" + - ":22F::CODE//COMP\r\n" + - ":22F::STTY//CUST\r\n" + - ":22F::STBA//TRAD\r\n" + - ":97A::SAFE//S 02500\r\n" + - ":17B::ACTI//Y\r\n" + - ":17B::AUDT//N\r\n" + - ":17B::CONS//N\r\n" + - ":16S:GENL\r\n" + - ":16R:SUBSAFE\r\n" + - ":16R:FIN\r\n" + - ":35B:ISIN XS0222550880\r\n" + - "4,125? LANXESS FIN.B.V.NT.V.05 21.6\r\n" + - //":12\r\n" + - /* - * within the field content, a colon ':' must never be used as the first character - * of a line (the combination 'CrLf:' always indicates a new field tag) - */ - ":16R:FIA\r\n" + - ":12A::CLAS/ISIT/STF\r\n" + - ":16S:FIA\r\n" + - ":93B::AGGR//FAMT/300,\r\n" + - ":93B::AVAI//FAMT/200,\r\n" + - ":16R:SUBBAL\r\n" + - ":93B::AGGR//FAMT/50,\r\n" + - ":94F::SAFE//CUST/FOOSUS33\r\n" + - ":70C::SUBB//REGISTRATION CODE MEMR\n" + - ":16S:SUBBAL\r\n" + - ":16S:FIN\r\n" + - ":16R:FIN\r\n" + - "-}"; + final String m = + "{1:F01BFOOUS3IADNC0147771111}{2:O5350837080313FOOSGB2LIXXX06988488300803130437N}{3:{108:000952CQ1650453}}{4:\r\n" + + ":16R:GENL\r\n" + + ":28E:6/MORE\r\n" + + ":20C::SEME//H200803121132222\r\n" + + ":23G:NEWM\r\n" + + ":98A::STAT//20080312\r\n" + + ":22F::SFRE//DAIL\r\n" + + ":22F::CODE//COMP\r\n" + + ":22F::STTY//CUST\r\n" + + ":22F::STBA//TRAD\r\n" + + ":97A::SAFE//S 02500\r\n" + + ":17B::ACTI//Y\r\n" + + ":17B::AUDT//N\r\n" + + ":17B::CONS//N\r\n" + + ":16S:GENL\r\n" + + ":16R:SUBSAFE\r\n" + + ":16R:FIN\r\n" + + ":35B:ISIN XS0222550880\r\n" + + "4,125? LANXESS FIN.B.V.NT.V.05 21.6\r\n" + + + // ":12\r\n" + + /* + * within the field content, a colon ':' must never be used as the first character + * of a line (the combination 'CrLf:' always indicates a new field tag) + */ + ":16R:FIA\r\n" + + ":12A::CLAS/ISIT/STF\r\n" + + ":16S:FIA\r\n" + + ":93B::AGGR//FAMT/300,\r\n" + + ":93B::AVAI//FAMT/200,\r\n" + + ":16R:SUBBAL\r\n" + + ":93B::AGGR//FAMT/50,\r\n" + + ":94F::SAFE//CUST/FOOSUS33\r\n" + + ":70C::SUBB//REGISTRATION CODE MEMR\n" + + ":16S:SUBBAL\r\n" + + ":16S:FIN\r\n" + + ":16R:FIN\r\n" + + "-}"; final SwiftMessage msg = new SwiftParser(m).message(); assertNotNull(msg); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserParseBlockTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserParseBlockTest.java index f0cc2c3fe..3f1dc030f 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserParseBlockTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserParseBlockTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,14 +30,13 @@ public class SwiftParserParseBlockTest { @Test public void testGetBlock4() { - final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + - ":16R:GENL\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050711\r\n" + - ":16S:GENL\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET\r\n" + - "-}"); + final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + ":16R:GENL\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050711\r\n" + + ":16S:GENL\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET\r\n" + + "-}"); assertNotNull(b4); assertEquals(6, b4.size()); assertEquals("16R", b4.getTag(0).getName()); @@ -48,9 +47,7 @@ public void testGetBlock4() { @Test public void testGetBlock4Brackets1() { - final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + - ":79:foobar{bad\r\n" + - "-}"); + final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + ":79:foobar{bad\r\n" + "-}"); assertNotNull(b4); assertEquals(1, b4.size()); assertEquals("foobar{bad", b4.getTag(0).getValue()); @@ -58,9 +55,7 @@ public void testGetBlock4Brackets1() { @Test public void testGetBlock4Brackets2() { - final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + - ":79:foobar{bad\r\n" + - "-}"); + final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + ":79:foobar{bad\r\n" + "-}"); assertNotNull(b4); assertEquals(1, b4.size()); assertEquals("foobar{bad", b4.getTag(0).getValue()); @@ -68,36 +63,34 @@ public void testGetBlock4Brackets2() { @Test public void testGetBlock4WithMultiline() { - final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + - ":98A::SETT//20050708\r\n" + - ":90B::DEAL//ACTU/USD28,86\r\n" + - ":35B:ISIN US1112223330\r\n" + - "MY COMPANY\r\n" + - ":16S:TRADDET\r\n" + - ":16R:FIAC\r\n" + - ":36B::SETT//UNIT/370,00\r\n" + - ":97A::SAFE//111222\r\n" + - ":16S:FIAC\r\n" + - ":16R:SETDET\r\n" + - "-}"); + final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + ":98A::SETT//20050708\r\n" + + ":90B::DEAL//ACTU/USD28,86\r\n" + + ":35B:ISIN US1112223330\r\n" + + "MY COMPANY\r\n" + + ":16S:TRADDET\r\n" + + ":16R:FIAC\r\n" + + ":36B::SETT//UNIT/370,00\r\n" + + ":97A::SAFE//111222\r\n" + + ":16S:FIAC\r\n" + + ":16R:SETDET\r\n" + + "-}"); assertNotNull(b4); assertEquals(9, b4.size()); assertEquals("35B", b4.getTag(2).getName()); - assertEquals("ISIN US1112223330\r\n" + - "MY COMPANY", b4.getTagByName("35B").getValue()); + assertEquals( + "ISIN US1112223330\r\n" + "MY COMPANY", b4.getTagByName("35B").getValue()); } @Test public void testTicket28() { - final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + - ":16R:GENL\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050711\r\n" + - ":16S:GENL\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET" + - "-}"); + final SwiftBlock4 b4 = SwiftParser.parseBlock4("{4:\r\n" + ":16R:GENL\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050711\r\n" + + ":16S:GENL\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET" + + "-}"); assertNotNull(b4); assertEquals(6, b4.size()); } @@ -108,11 +101,12 @@ public void testTicket28() { @Disabled @Test public void testNestedBlocks() throws Exception { - String fin = "{1:F01OURSGB33AXXX0000000000}{2:O0961625170421ABLRXXXXGXXX00000000001704201625N}{3:{103:CLH}{108:SWIFTBICAXXX0000890}}{4:{1:F01PTY1US33AXXX0000000000}{2:I300PTY2GB33AXXXU3003}{3:{103:ABC}}{4:\n" + - ":15A:\n" + - ":20:R317703\n" + - ":22A:NEWT\n" + - "-}{5:{CHK:73AC90A7A3F1}{SYS:1309041018SMAIBE22AXXX0246001570}}}"; + String fin = + "{1:F01OURSGB33AXXX0000000000}{2:O0961625170421ABLRXXXXGXXX00000000001704201625N}{3:{103:CLH}{108:SWIFTBICAXXX0000890}}{4:{1:F01PTY1US33AXXX0000000000}{2:I300PTY2GB33AXXXU3003}{3:{103:ABC}}{4:\n" + + ":15A:\n" + + ":20:R317703\n" + + ":22A:NEWT\n" + + "-}{5:{CHK:73AC90A7A3F1}{SYS:1309041018SMAIBE22AXXX0246001570}}}"; // parse with SwiftMessage SwiftMessage sm = SwiftMessage.parse(fin); @@ -126,7 +120,7 @@ public void testNestedBlocks() throws Exception { mt.addBlock(SwiftParser.parseBlock2(nested.getTagByNumber(2).getValue())); } if (nested.getTagByNumber(3) != null) { - //System.out.println(nested.getTagByNumber(3).getValue()); + // System.out.println(nested.getTagByNumber(3).getValue()); mt.addBlock(SwiftParser.parseBlock3(nested.getTagByNumber(3).getValue())); } if (nested.getTagByNumber(4) != null) { @@ -147,5 +141,4 @@ public void testNestedBlocks() throws Exception { assertEquals("{CHK:73AC90A7A3F1}{SYS:1309041018SMAIBE22AXXX0246001570}", nested.getTagValue("5")); } } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserReadBlockTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserReadBlockTest.java index 052b65872..af76a2533 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserReadBlockTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserReadBlockTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,10 @@ import com.prowidesoftware.swift.Constants; import com.prowidesoftware.swift.io.writer.FINWriterVisitor; import com.prowidesoftware.swift.model.SwiftMessage; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.io.StringReader; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test cases for readUntilBlockEnds and related methods in the parser implementation @@ -65,23 +64,23 @@ public void testReadBlock3() throws IOException { @Test public void testReadBlock4() throws IOException { - parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + - ":16R:GENL" + FINWriterVisitor.SWIFT_EOL + - ":23G:NEWM" + FINWriterVisitor.SWIFT_EOL + - ":98A::PREP//20050711" + FINWriterVisitor.SWIFT_EOL + - ":16S:GENL" + FINWriterVisitor.SWIFT_EOL + - ":16S:AMT" + FINWriterVisitor.SWIFT_EOL + - ":16S:SETDET" + FINWriterVisitor.SWIFT_EOL + - "-}"); + parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + ":16R:GENL" + + FINWriterVisitor.SWIFT_EOL + ":23G:NEWM" + + FINWriterVisitor.SWIFT_EOL + ":98A::PREP//20050711" + + FINWriterVisitor.SWIFT_EOL + ":16S:GENL" + + FINWriterVisitor.SWIFT_EOL + ":16S:AMT" + + FINWriterVisitor.SWIFT_EOL + ":16S:SETDET" + + FINWriterVisitor.SWIFT_EOL + "-}"); final String m = parser.readUntilBlockEnds(); - assertEquals("4:\r\n" + - ":16R:GENL\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050711\r\n" + - ":16S:GENL\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET\r\n" + - "-", m); + assertEquals( + "4:\r\n" + ":16R:GENL\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050711\r\n" + + ":16S:GENL\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET\r\n" + + "-", + m); } @Test @@ -151,44 +150,44 @@ public void testReadUntilBlockEnds2WithBraquetsB() throws IOException { @Test public void testReadBlock4WithStartingBraquetInFieldValue() throws IOException { - parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + - ":16R:GENL" + FINWriterVisitor.SWIFT_EOL + - ":23G:NEWM" + FINWriterVisitor.SWIFT_EOL + - ":98A::PREP//20050711" + FINWriterVisitor.SWIFT_EOL + - ":16S:GE{NL" + FINWriterVisitor.SWIFT_EOL + - ":16S:AMT" + FINWriterVisitor.SWIFT_EOL + - ":16S:SETDET" + FINWriterVisitor.SWIFT_EOL + - "-}"); + parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + ":16R:GENL" + + FINWriterVisitor.SWIFT_EOL + ":23G:NEWM" + + FINWriterVisitor.SWIFT_EOL + ":98A::PREP//20050711" + + FINWriterVisitor.SWIFT_EOL + ":16S:GE{NL" + + FINWriterVisitor.SWIFT_EOL + ":16S:AMT" + + FINWriterVisitor.SWIFT_EOL + ":16S:SETDET" + + FINWriterVisitor.SWIFT_EOL + "-}"); final String m = parser.readUntilBlockEnds(); - assertEquals("4:\r\n" + - ":16R:GENL\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050711\r\n" + - ":16S:GE{NL\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET\r\n" + - "-", m); + assertEquals( + "4:\r\n" + ":16R:GENL\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050711\r\n" + + ":16S:GE{NL\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET\r\n" + + "-", + m); } @Test public void testReadBlock4WithClosingBraquetInFieldValue() throws IOException { - parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + - ":16R:GENL" + FINWriterVisitor.SWIFT_EOL + - ":23G:NEWM" + FINWriterVisitor.SWIFT_EOL + - ":98A::PREP//20050711" + FINWriterVisitor.SWIFT_EOL + - ":16S:GE}NL" + FINWriterVisitor.SWIFT_EOL + - ":16S:AMT" + FINWriterVisitor.SWIFT_EOL + - ":16S:SETDET" + FINWriterVisitor.SWIFT_EOL + - "-}"); + parser.setData("4:" + FINWriterVisitor.SWIFT_EOL + ":16R:GENL" + + FINWriterVisitor.SWIFT_EOL + ":23G:NEWM" + + FINWriterVisitor.SWIFT_EOL + ":98A::PREP//20050711" + + FINWriterVisitor.SWIFT_EOL + ":16S:GE}NL" + + FINWriterVisitor.SWIFT_EOL + ":16S:AMT" + + FINWriterVisitor.SWIFT_EOL + ":16S:SETDET" + + FINWriterVisitor.SWIFT_EOL + "-}"); final String m = parser.readUntilBlockEnds(); - assertEquals("4:\r\n" + - ":16R:GENL\r\n" + - ":23G:NEWM\r\n" + - ":98A::PREP//20050711\r\n" + - ":16S:GE}NL\r\n" + - ":16S:AMT\r\n" + - ":16S:SETDET\r\n" + - "-", m); + assertEquals( + "4:\r\n" + ":16R:GENL\r\n" + + ":23G:NEWM\r\n" + + ":98A::PREP//20050711\r\n" + + ":16S:GE}NL\r\n" + + ":16S:AMT\r\n" + + ":16S:SETDET\r\n" + + "-", + m); } @Test @@ -221,9 +220,7 @@ public void testBug1539324_3() throws IOException { @Test public void testOneTagSimilarToBug1540294_1() throws IOException { - final String fin = "{4:\r\n" + - ":t2:v2\r\n" + - "-}"; + final String fin = "{4:\r\n" + ":t2:v2\r\n" + "-}"; final SwiftParser p = new SwiftParser(new StringReader(fin)); final SwiftMessage msg = p.message(); assertNotNull(msg.getBlock4()); @@ -241,5 +238,4 @@ public void testBug1601122_1() throws IOException { assertEquals("32D7EA50", msg.getBlock5().getTagValue("MAC")); assertEquals("AB1538FB729E", msg.getBlock5().getTagValue("CHK")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserTest.java index 1e2721b63..8a90ec53b 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserTest.java @@ -1,492 +1,501 @@ -/* - * Copyright 2006-2021 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.io.parser; - -import static org.junit.jupiter.api.Assertions.*; - -import com.prowidesoftware.ProwideException; -import com.prowidesoftware.swift.io.writer.FINWriterVisitor; -import com.prowidesoftware.swift.model.MtSwiftMessage; -import com.prowidesoftware.swift.model.SwiftBlock2Output; -import com.prowidesoftware.swift.model.SwiftMessage; -import com.prowidesoftware.swift.model.SwiftTagListBlock; -import com.prowidesoftware.swift.model.field.Field27; -import com.prowidesoftware.swift.model.mt.mt1xx.MT103; -import com.prowidesoftware.swift.model.mt.mt7xx.MT798; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.io.StringReader; - -public class SwiftParserTest { - - @Test - public void test103_1() throws IOException { - String messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:D051026EUR100057\n" + - ":13C:/RNCTIME/0802+0000\n" + - ":23B:CRED\n" + - ":32A:051028EUR6740,91\n" + - ":33B:EUR6740,91\n" + - ":50A:SSSSESMMXXX\n" + - ":53A:BBBBESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/ES0123456789012345671234\n" + - "FOOOOO 1000 FOOBAR S.A.\n" + - ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + - "/123123123: FOOVIMAR 2000 FOOBAR\n" + - ":71A:SHA\n" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; - - SwiftMessage m = new SwiftParser(messageToParse).message(); - - //get a simple value tag - @SuppressWarnings("unused") - String val32a = m.getBlock3().getTagValue("32A"); - - //get a repeated value tag - @SuppressWarnings("unused") - String[] list71 = m.getBlock3().getTagValues("71F"); - - assertEquals("103", m.getType()); - - //check b1 - assertEquals("F01FOOBARYYAXXX1234123456", m.getBlock1().getBlockValue()); - assertEquals("F", m.getBlock1().getApplicationId()); - assertEquals("01", m.getBlock1().getServiceId()); - assertEquals("FOOBARYYAXXX", m.getBlock1().getLogicalTerminal()); - assertEquals("1234", m.getBlock1().getSessionNumber()); - assertEquals("123456", m.getBlock1().getSequenceNumber()); - - //check b2 - assertEquals("O1030803051028AAPBESMMAXXX54237368560510280803N", m.getBlock2().getBlockValue()); - assertEquals("103", m.getBlock2().getMessageType()); - assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getSenderInputTime()); - assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getMIRDate()); - assertEquals("AAPBESMMAXXX", ((SwiftBlock2Output) m.getBlock2()).getMIRLogicalTerminal()); - assertEquals("5423", ((SwiftBlock2Output) m.getBlock2()).getMIRSessionNumber()); - assertEquals("736856", ((SwiftBlock2Output) m.getBlock2()).getMIRSequenceNumber()); - assertEquals("051028AAPBESMMAXXX5423736856", ((SwiftBlock2Output) m.getBlock2()).getMIR()); - assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputDate()); - assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputTime()); - assertEquals("N", m.getBlock2().getMessagePriority()); - - //check b3 - assertEquals(3, m.getBlock3().countAll()); - assertEquals("NOMF", m.getBlock3().getTagValue("113")); - assertEquals("0510280086100057", m.getBlock3().getTagValue("108")); - assertEquals("STP", m.getBlock3().getTagValue("119")); - - //check b4 - assertEquals(11, m.getBlock4().countAll()); - assertEquals("D051026EUR100057", m.getBlock4().getTagValue("20")); - assertEquals("/RNCTIME/0802+0000", m.getBlock4().getTagValue("13C")); - assertEquals("CRED", m.getBlock4().getTagValue("23B")); - assertEquals("051028EUR6740,91", m.getBlock4().getTagValue("32A")); - assertEquals("EUR6740,91", m.getBlock4().getTagValue("33B")); - assertEquals("SSSSESMMXXX", m.getBlock4().getTagValue("50A")); - assertEquals("BBBBESMMXXX", m.getBlock4().getTagValue("53A")); - assertEquals("FOOBARYYXXX", m.getBlock4().getTagValue("57A")); - assertEquals("/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.", m.getBlock4().getTagValue("59")); - assertEquals("REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR", m.getBlock4().getTagValue("70")); - assertEquals("SHA", m.getBlock4().getTagValue("71A")); - - //check b5 - assertEquals(2, m.getBlock5().countAll()); - assertEquals("D9D8FA56", m.getBlock5().getTagValue("MAC")); - assertEquals("46E46A6460F2", m.getBlock5().getTagValue("CHK")); - } - - @Test - public void test103_2() throws IOException { - String messageToParse = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:D051026EUR100057\n" + - ":13C:/RNCTIME/0802+0000\n" + - ":23B:CRED\n" + - ":32A:051028EUR6740,91\n" + - ":33B:EUR6740,91\n" + - ":50A:SSSSESMMXXX\n" + - ":53A:BBBBESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/ES0123456789012345671234\n" + - "FOOOOO 1000 FOOBAR S.A.\n" + - ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + - "/123123123: FOOVIMAR 2000 FOOBAR\n" + - ":71A:SHA\n" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; - - SwiftMessage m = SwiftMessage.parse(messageToParse); - - assertEquals("103", m.getType()); - - //check b1 - assertEquals("F01FOOBARYYAXXX1234123456", m.getBlock1().getBlockValue()); - assertEquals("F", m.getBlock1().getApplicationId()); - assertEquals("01", m.getBlock1().getServiceId()); - assertEquals("FOOBARYYAXXX", m.getBlock1().getLogicalTerminal()); - assertEquals("1234", m.getBlock1().getSessionNumber()); - assertEquals("123456", m.getBlock1().getSequenceNumber()); - - //check b2 - assertEquals("O1030803051028AAPBESMMAXXX54237368560510280803N", m.getBlock2().getBlockValue()); - assertEquals("103", m.getBlock2().getMessageType()); - assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getSenderInputTime()); - assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getMIRDate()); - assertEquals("AAPBESMMAXXX", ((SwiftBlock2Output) m.getBlock2()).getMIRLogicalTerminal()); - assertEquals("5423", ((SwiftBlock2Output) m.getBlock2()).getMIRSessionNumber()); - assertEquals("736856", ((SwiftBlock2Output) m.getBlock2()).getMIRSequenceNumber()); - assertEquals("051028AAPBESMMAXXX5423736856", ((SwiftBlock2Output) m.getBlock2()).getMIR()); - assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputDate()); - assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputTime()); - assertEquals("N", m.getBlock2().getMessagePriority()); - - //check b3 - assertEquals(3, m.getBlock3().countAll()); - assertEquals("NOMF", m.getBlock3().getTagValue("113")); - assertEquals("0510280086100057", m.getBlock3().getTagValue("108")); - assertEquals("STP", m.getBlock3().getTagValue("119")); - - //check b4 - assertEquals(11, m.getBlock4().countAll()); - assertEquals("D051026EUR100057", m.getBlock4().getTagValue("20")); - assertEquals("/RNCTIME/0802+0000", m.getBlock4().getTagValue("13C")); - assertEquals("CRED", m.getBlock4().getTagValue("23B")); - assertEquals("051028EUR6740,91", m.getBlock4().getTagValue("32A")); - assertEquals("EUR6740,91", m.getBlock4().getTagValue("33B")); - assertEquals("SSSSESMMXXX", m.getBlock4().getTagValue("50A")); - assertEquals("BBBBESMMXXX", m.getBlock4().getTagValue("53A")); - assertEquals("FOOBARYYXXX", m.getBlock4().getTagValue("57A")); - assertEquals("/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.", m.getBlock4().getTagValue("59")); - assertEquals("REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR", m.getBlock4().getTagValue("70")); - assertEquals("SHA", m.getBlock4().getTagValue("71A")); - - //check b5 - assertEquals(2, m.getBlock5().countAll()); - assertEquals("D9D8FA56", m.getBlock5().getTagValue("MAC")); - assertEquals("46E46A6460F2", m.getBlock5().getTagValue("CHK")); - } - - @Test - public void testPatchWalterBirch() throws IOException { - final String fin = "{1:F01VONTCHZZAXXX7586415286}{2:I202CHASUS33XXXXN}{3:{108:129324618/1XXXXX}}{4:" + FINWriterVisitor.SWIFT_EOL + - ":20:129324618/1XXXXX" + FINWriterVisitor.SWIFT_EOL + - ":21:NONREF" + FINWriterVisitor.SWIFT_EOL + - ":32A:110705USD20079,39" + FINWriterVisitor.SWIFT_EOL + - ":57A:CITIUS33XXX" + FINWriterVisitor.SWIFT_EOL + - ":58A:NBSZCHZZXXX" + FINWriterVisitor.SWIFT_EOL + - ":72:/BNF/30.05.11 10000" + FINWriterVisitor.SWIFT_EOL + - "" + FINWriterVisitor.SWIFT_EOL + - "-}{5:{CHK:88C7BBB37D50}}"; - final SwiftParser p = new SwiftParser(new StringReader(fin)); - final SwiftMessage msg = p.message(); - assertNotNull(msg.getBlock1()); - assertNotNull(msg.getBlock4()); - assertEquals(6, msg.getBlock4().size(), "Expected 6 tags but found " + msg.getBlock4().size() + ", " + msg.getBlock4().tagNamesList()); - - } - - @Test - public void testAck1() throws Exception { - final String msg = "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":23E:SDVA\n" + - ":26T:001\n" + - ":32A:151104XOF27000000,\n" + - ":50K:/0020121503484101\n" + - "SOXNYFAYTONU VORYEAUGEIS\n" + - ":53A:/D/D00030901\n" + - "ECOCMLBA\n" + - ":57A:/C/A00031061\n" + - "OMFNCIAB\n" + - ":59:/010010100100014010010160\n" + - "FOO VOYAGES\n" + - ":70:TRANSFERT\n" + - ":71A:SHA\n" + - ":72:/CODTYPTR/001\n" + - "//REGLEMENT\n" + - "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; - SwiftMessage sm = new SwiftParser(msg).message(); - assertNotNull(sm); - assertTrue(sm.isAck()); - } - - @Test - public void testAck2() throws Exception { - final String msg = "{1:F21OMFNCIABAXXX6368087504}{4:{177:1511041718}{451:0}}{1:F01OMFNCIABAXXX6368087504}{2:O1031746151104CCEICMCXAXXX64953042471511041646N}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":32A:151104XOF14773500,\n" + - ":50K:/00057 03363591001 84\n" + - "FOO SARL \n" + - "AKWA, FACE ANCIEN DIRECTION NOBRA\n" + - "BP 1432 DOURAZLA\n" + - "237 CAMEROUN\n" + - ":57A:CBAOSNDA\n" + - ":59:/SN 012 01201 036169011401 63\n" + - "TSAEMOXU FOO INTERUNATIONALE SARL\n" + - "DIAMNIADO, DAKAR\n" + - "SENEGAL\n" + - ":70:/INV/TFI-ZS-15002\n" + - ":71A:SHA\n" + - "-}{5:{MAC:00000000}{CHK:50085EDF60EC}}{S:{SPD:}{SAC:}{COP:P}}"; - SwiftMessage sm = new SwiftParser(msg).message(); - assertNotNull(sm); - assertTrue(sm.isAck()); - } - - /** - * Extra data simple - */ - @Test - public void testExtraDataSimple() throws IOException { - final String fin = "{1:F01MOSWRUMMAXXX0000000000}{2:I103COBADEFFXXXXN}{3:{108:02161OKP00130914}}{4:\n" + - ":20:12345677890\n" + - ":23B:CRED\n" + - ":32A:160217EUR500,\n" + - ":50K:/42301978502050100067\n" + - "SHEPTUKHA VIKTORIA PAS45 15 362057\n" + - "CCC MOSCOW MOSCOW UL. AVIACIONNAYA\n" + - "DON. 99 KV. 123\n" + - ":52D:BANK OF MOSCOW\n" + - ":57A:CAIXESBBXXX\n" + - ":59:/ES3021000122390200002631\n" + - "FOO TRADE SL SPAIN CASTELLO D E\n" + - "FOO PLACA JOC DE LA PILOTA , NU\n" + - "M 1\n" + - ":70:PAYMENT FOR NALOG ZA APARTAMENT\n" + - ":71A:OUR\n" + - ":72:/ACC/UR LIZO BBBB ))))))))::::::\n" + - "-}foo"; - SwiftParser p = new SwiftParser(fin); - SwiftMessage m = p.message(); - assertNotEquals(0, (int) m.getUnparsedTextsSize()); - } - - /** - * Expected extra "}}}}" reported as error - */ - @Test - public void testExtraData() throws IOException { - final String fin = "{1:F01MOSWRUMMAXXX0000000000}{2:I103COBADEFFXXXXN}{3:{108:02161OKP00130914}}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":32A:160217EUR500,\n" + - ":50K:/42301978502050100067\n" + - "FOO VIKTORIA PAS45 15 362057\n" + - "CCC MOSCOW MOSCOW UL. FOO\n" + - "DON. 13 KV. 131\n" + - ":52D:BANK OF MOSCOW\n" + - ":57A:CAIXESBBXXX\n" + - ":59:/ES3021000122390200002631\n" + - "FOO TRADE SL SPAIN CASTELLO D E\n" + - "FOO PLACA JOC DE LA PILOTA , NU\n" + - "M 1\n" + - ":70:PAYMENT FOR NALOG ZA APARTAMENT\n" + - ":71A:OUR\n" + - ":72:/ACC/UR LIZO BBBB ))))))))::::::\n" + - "-}}}}}"; - SwiftParser p = new SwiftParser(fin); - SwiftMessage m = p.message(); - assertNotEquals(0, (int) m.getUnparsedTextsSize()); - } - - /* - * https://sourceforge.net/p/wife/bugs/80/ - */ - @Test - public void testParse() throws IOException { - final String fin = "{1:F01TESTAR00AXXX7607663781}{2:O1010824170510TESTAR00AXXX94149133901705101425N}{4:\n" + - ":20:DG942_171206-004\n" + - ":28D:00001/00001\n" + - ":50H:/344110001637\n" + - "TESTAR00AXXX\n" + - "Utrecht\n" + - "Netherlands\n" + - ":30:170502\n" + - ":21:010735904\n" + - ":32B:CNY14,00\n" + - ":57A:CIBKCNBJ473\n" + - ":59:/344110000361\n" + - "CASH CUSTOMER I\n" + - "TESTAR00AXXX\n" + - "Utrecht\n" + - "Netherlands\n" + - ":70:/RFB/C767405OCP021001\n" + - ":71A:SHA\n" + - "-}{5:{CHK:B3BF0D846AFD}}"; - SwiftMessage msg = new SwiftParser(fin).message(); - assertNotNull(msg); - assertNotNull(msg.getBlock1()); - assertNotNull(msg.getBlock2()); - assertNotNull(msg.getBlock4()); - assertNotNull(msg.getBlock5()); - assertEquals("TESTAR00AXXX", msg.getBlock1().getLogicalTerminal()); - assertEquals("101", msg.getBlock2().getMessageType()); - assertEquals("DG942_171206-004", msg.getBlock4().getFieldByName("20").getValue()); - } - - @Test - public void testEmptyLines() throws IOException { - String fin = "{1:F01TESTARZZAXXX0000000000}{2:I199TESTARZZXXXXN}{4:\n" + - ":20:1111\n" + - "\n" + - ":21:2222\n" + - "\r\n" + - ":59:3333\r\n4444\r\n" + - ":79:5555\r6666\n" + - ":72:7777\n\r\n\n\r\n\n" + - "-}"; - SwiftMessage sm = SwiftMessage.parse(fin); - assertEquals("1111\n", sm.getBlock4().getTagByName("20").getValue()); - assertEquals("2222\n", sm.getBlock4().getTagByName("21").getValue()); - assertEquals("3333\r\n4444", sm.getBlock4().getTagByName("59").getValue()); - assertEquals("5555\r6666", sm.getBlock4().getTagByName("79").getValue()); - assertEquals("7777\n\r\n\n\r\n", sm.getBlock4().getTagByName("72").getValue()); - } - - @Test - void reproduce_parse_stringWithNonsenseHeadersButUsefulContentBlock_returnsNullForHeadersAndValidValuesFieldsInContent() { - MtSwiftMessage msg = MtSwiftMessage.parse("Big blue sea{4:\n" + - ":20:123456789\n" + - ":77E:\n" + - ":15A:\n" + - ":27:3/5\n" + - "-}dark green forrest"); - // We simply claim that this is an MT798, and it works! - MT798 mt798 = new MT798(msg); - assertEquals("798", mt798.getMessageType()); - // Submessage type is null, as expected - assertNull(mt798.getField12()); - // The content of block 4 is available - SwiftTagListBlock contentMessage = mt798.getSwiftMessage().getBlock4().getSubBlockAfterFirst("77E", false); - - Field27 field27 = (Field27) contentMessage.getFieldByName("27"); - assertEquals(3, field27.getNumberAsLong()); - assertEquals(5, field27.getTotalAsLong()); - assertNull(contentMessage.getFieldByName("52A")); - } - - @Test - void testParseInvalidPayload() throws IOException { - SwiftMessage msg = SwiftMessage.parse("foo bar"); - assertNull(msg.getBlock1()); - assertNull(msg.getBlock2()); - assertNull(msg.getBlock3()); - assertNull(msg.getBlock4()); - assertNull(msg.getBlock5()); - assertNull(msg.getUserBlocks()); - - // Although we may wrap it as an MT - MT103 mt103 = new MT103(msg); - - // thew MT content is null - assertNull(mt103.getField20()); - assertNull(mt103.getField32A()); - } - - @Test - void testParseEmptyContent() throws IOException { - SwiftMessage msg = SwiftMessage.parse(""); - assertNull(msg.getBlock1()); - assertNull(msg.getBlock2()); - assertNull(msg.getBlock3()); - assertNull(msg.getBlock4()); - assertNull(msg.getBlock5()); - assertNull(msg.getUserBlocks()); - - // Although we may wrap it as an MT - MT103 mt103 = new MT103(msg); - - // thew MT content is null - assertNull(mt103.getField20()); - assertNull(mt103.getField32A()); - } - - @Test - void testParseInvalidHeader() throws IOException { - SwiftMessage msg = SwiftMessage.parse("Big blue sea{4:\n" + - ":20:123456789\n" + - ":77E:\n" + - ":15A:\n" + - ":27:3/5\n" + - "-}dark green forrest"); - - // Still cast to a specific type - MT798 mt798 = new MT798(msg); - - assertEquals("798", mt798.getMessageType()); - - // missing field is null, as expected - assertNull(mt798.getField12()); - - // The content of block 4 is still available - assertEquals("123456789", mt798.getField20().getValue()); - - SwiftTagListBlock contentMessage = mt798.getSwiftMessage().getBlock4().getSubBlockAfterFirst("77E", false); - - Field27 field27 = (Field27) contentMessage.getFieldByName("27"); - assertEquals(3, field27.getNumberAsLong()); - assertEquals(5, field27.getTotalAsLong()); - assertNull(contentMessage.getFieldByName("52A")); - } - - @Test - void test_parse_system_message_MT094_from_String_lenient_true() throws IOException { - String fin_MT094 = "{1:F01AAAACNBJBXXX1010000000}{2:O0941836210827NXNXXXXX0XXX00080000012345678911S}\n" + - "{4:{135:N}{136:X12345}{130:/01/BANK\n" + - "/01/XXXXXYYYYYX}{134:FOOABHBX\n" + - "ABCDFGGH N.A.\n" + - "ABCANA}{312:SUBJECT: xxxx XXXX AAA AASX YXYXY FOR SSS YXYXYXYX-XXX YXYX\n" + - "XXXXXX YYY YYYYYYY TO FFF WWWWW REF X00000000 ON 00\n" + - "XXX0000 YYY XXXXX YXYXYXY CODES YXYXYX FOR IPSUM LOERM\n" + - "S YSYSY XXXX XXXX,THE XXXXX OF THE XXXXXX IPSUM AAA\n" + - "XXXX XXX XXX MXXXAY XXXX IN XXX AND XXXX.}}{\n" + // unexpected LF - "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894}}"; - SwiftParser parser = new SwiftParser(fin_MT094); - SwiftParserConfiguration configuration = new SwiftParserConfiguration(); - configuration.setLenient(true); - parser.setConfiguration(configuration); - parser.message(); - - String errorMessage = "The block \n" + - "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894} could not be identified"; - assertEquals(parser.getErrors().size(), 1); - assertEquals(parser.getErrors().get(0), errorMessage); - } - - @Test - void test_parse_system_message_MT094_from_String_lenient_false() { - String fin_MT094 = "{1:F01AAAACNBJBXXX1010000000}{2:O0941836210827NXNXXXXX0XXX00080000012345678911S}\n" + - "{4:{135:N}{136:X12345}{130:/01/BANK\n" + - "/01/XXXXXYYYYYX}{134:FOOABHBX\n" + - "ABCDFGGH N.A.\n" + - "ABCANA}{312:SUBJECT: xxxx XXXX AAA AASX YXYXY FOR SSS YXYXYXYX-XXX YXYX\n" + - "XXXXXX YYY YYYYYYY TO FFF WWWWW REF X00000000 ON 00\n" + - "XXX0000 YYY XXXXX YXYXYXY CODES YXYXYX FOR IPSUM LOERM\n" + - "S YSYSY XXXX XXXX,THE XXXXX OF THE XXXXXX IPSUM AAA\n" + - "XXXX XXX XXX MXXXAY XXXX IN XXX AND XXXX.}}{\n" + // unexpected LF - "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894}}"; - SwiftParser parser = new SwiftParser(fin_MT094); - SwiftParserConfiguration configuration = new SwiftParserConfiguration(); - configuration.setLenient(false); - parser.setConfiguration(configuration); - - Assertions.assertThrows(ProwideException.class, parser::message); - } - -} \ No newline at end of file +/* + * Copyright 2006-2023 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.io.parser; + +import static org.junit.jupiter.api.Assertions.*; + +import com.prowidesoftware.ProwideException; +import com.prowidesoftware.swift.io.writer.FINWriterVisitor; +import com.prowidesoftware.swift.model.MtSwiftMessage; +import com.prowidesoftware.swift.model.SwiftBlock2Output; +import com.prowidesoftware.swift.model.SwiftMessage; +import com.prowidesoftware.swift.model.SwiftTagListBlock; +import com.prowidesoftware.swift.model.field.Field27; +import com.prowidesoftware.swift.model.mt.mt1xx.MT103; +import com.prowidesoftware.swift.model.mt.mt7xx.MT798; +import java.io.IOException; +import java.io.StringReader; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SwiftParserTest { + + @Test + public void test103_1() throws IOException { + String messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + + ":13C:/RNCTIME/0802+0000\n" + + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + + ":33B:EUR6740,91\n" + + ":50A:SSSSESMMXXX\n" + + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/ES0123456789012345671234\n" + + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + + "/123123123: FOOVIMAR 2000 FOOBAR\n" + + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + + SwiftMessage m = new SwiftParser(messageToParse).message(); + + // get a simple value tag + @SuppressWarnings("unused") + String val32a = m.getBlock3().getTagValue("32A"); + + // get a repeated value tag + @SuppressWarnings("unused") + String[] list71 = m.getBlock3().getTagValues("71F"); + + assertEquals("103", m.getType()); + + // check b1 + assertEquals("F01FOOBARYYAXXX1234123456", m.getBlock1().getBlockValue()); + assertEquals("F", m.getBlock1().getApplicationId()); + assertEquals("01", m.getBlock1().getServiceId()); + assertEquals("FOOBARYYAXXX", m.getBlock1().getLogicalTerminal()); + assertEquals("1234", m.getBlock1().getSessionNumber()); + assertEquals("123456", m.getBlock1().getSequenceNumber()); + + // check b2 + assertEquals( + "O1030803051028AAPBESMMAXXX54237368560510280803N", m.getBlock2().getBlockValue()); + assertEquals("103", m.getBlock2().getMessageType()); + assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getSenderInputTime()); + assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getMIRDate()); + assertEquals("AAPBESMMAXXX", ((SwiftBlock2Output) m.getBlock2()).getMIRLogicalTerminal()); + assertEquals("5423", ((SwiftBlock2Output) m.getBlock2()).getMIRSessionNumber()); + assertEquals("736856", ((SwiftBlock2Output) m.getBlock2()).getMIRSequenceNumber()); + assertEquals("051028AAPBESMMAXXX5423736856", ((SwiftBlock2Output) m.getBlock2()).getMIR()); + assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputDate()); + assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputTime()); + assertEquals("N", m.getBlock2().getMessagePriority()); + + // check b3 + assertEquals(3, m.getBlock3().countAll()); + assertEquals("NOMF", m.getBlock3().getTagValue("113")); + assertEquals("0510280086100057", m.getBlock3().getTagValue("108")); + assertEquals("STP", m.getBlock3().getTagValue("119")); + + // check b4 + assertEquals(11, m.getBlock4().countAll()); + assertEquals("D051026EUR100057", m.getBlock4().getTagValue("20")); + assertEquals("/RNCTIME/0802+0000", m.getBlock4().getTagValue("13C")); + assertEquals("CRED", m.getBlock4().getTagValue("23B")); + assertEquals("051028EUR6740,91", m.getBlock4().getTagValue("32A")); + assertEquals("EUR6740,91", m.getBlock4().getTagValue("33B")); + assertEquals("SSSSESMMXXX", m.getBlock4().getTagValue("50A")); + assertEquals("BBBBESMMXXX", m.getBlock4().getTagValue("53A")); + assertEquals("FOOBARYYXXX", m.getBlock4().getTagValue("57A")); + assertEquals( + "/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.", + m.getBlock4().getTagValue("59")); + assertEquals( + "REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR", + m.getBlock4().getTagValue("70")); + assertEquals("SHA", m.getBlock4().getTagValue("71A")); + + // check b5 + assertEquals(2, m.getBlock5().countAll()); + assertEquals("D9D8FA56", m.getBlock5().getTagValue("MAC")); + assertEquals("46E46A6460F2", m.getBlock5().getTagValue("CHK")); + } + + @Test + public void test103_2() throws IOException { + String messageToParse = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + + ":13C:/RNCTIME/0802+0000\n" + + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + + ":33B:EUR6740,91\n" + + ":50A:SSSSESMMXXX\n" + + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/ES0123456789012345671234\n" + + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + + "/123123123: FOOVIMAR 2000 FOOBAR\n" + + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + + SwiftMessage m = SwiftMessage.parse(messageToParse); + + assertEquals("103", m.getType()); + + // check b1 + assertEquals("F01FOOBARYYAXXX1234123456", m.getBlock1().getBlockValue()); + assertEquals("F", m.getBlock1().getApplicationId()); + assertEquals("01", m.getBlock1().getServiceId()); + assertEquals("FOOBARYYAXXX", m.getBlock1().getLogicalTerminal()); + assertEquals("1234", m.getBlock1().getSessionNumber()); + assertEquals("123456", m.getBlock1().getSequenceNumber()); + + // check b2 + assertEquals( + "O1030803051028AAPBESMMAXXX54237368560510280803N", m.getBlock2().getBlockValue()); + assertEquals("103", m.getBlock2().getMessageType()); + assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getSenderInputTime()); + assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getMIRDate()); + assertEquals("AAPBESMMAXXX", ((SwiftBlock2Output) m.getBlock2()).getMIRLogicalTerminal()); + assertEquals("5423", ((SwiftBlock2Output) m.getBlock2()).getMIRSessionNumber()); + assertEquals("736856", ((SwiftBlock2Output) m.getBlock2()).getMIRSequenceNumber()); + assertEquals("051028AAPBESMMAXXX5423736856", ((SwiftBlock2Output) m.getBlock2()).getMIR()); + assertEquals("051028", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputDate()); + assertEquals("0803", ((SwiftBlock2Output) m.getBlock2()).getReceiverOutputTime()); + assertEquals("N", m.getBlock2().getMessagePriority()); + + // check b3 + assertEquals(3, m.getBlock3().countAll()); + assertEquals("NOMF", m.getBlock3().getTagValue("113")); + assertEquals("0510280086100057", m.getBlock3().getTagValue("108")); + assertEquals("STP", m.getBlock3().getTagValue("119")); + + // check b4 + assertEquals(11, m.getBlock4().countAll()); + assertEquals("D051026EUR100057", m.getBlock4().getTagValue("20")); + assertEquals("/RNCTIME/0802+0000", m.getBlock4().getTagValue("13C")); + assertEquals("CRED", m.getBlock4().getTagValue("23B")); + assertEquals("051028EUR6740,91", m.getBlock4().getTagValue("32A")); + assertEquals("EUR6740,91", m.getBlock4().getTagValue("33B")); + assertEquals("SSSSESMMXXX", m.getBlock4().getTagValue("50A")); + assertEquals("BBBBESMMXXX", m.getBlock4().getTagValue("53A")); + assertEquals("FOOBARYYXXX", m.getBlock4().getTagValue("57A")); + assertEquals( + "/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.", + m.getBlock4().getTagValue("59")); + assertEquals( + "REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR", + m.getBlock4().getTagValue("70")); + assertEquals("SHA", m.getBlock4().getTagValue("71A")); + + // check b5 + assertEquals(2, m.getBlock5().countAll()); + assertEquals("D9D8FA56", m.getBlock5().getTagValue("MAC")); + assertEquals("46E46A6460F2", m.getBlock5().getTagValue("CHK")); + } + + @Test + public void testPatchWalterBirch() throws IOException { + final String fin = "{1:F01VONTCHZZAXXX7586415286}{2:I202CHASUS33XXXXN}{3:{108:129324618/1XXXXX}}{4:" + + FINWriterVisitor.SWIFT_EOL + ":20:129324618/1XXXXX" + + FINWriterVisitor.SWIFT_EOL + ":21:NONREF" + + FINWriterVisitor.SWIFT_EOL + ":32A:110705USD20079,39" + + FINWriterVisitor.SWIFT_EOL + ":57A:CITIUS33XXX" + + FINWriterVisitor.SWIFT_EOL + ":58A:NBSZCHZZXXX" + + FINWriterVisitor.SWIFT_EOL + ":72:/BNF/30.05.11 10000" + + FINWriterVisitor.SWIFT_EOL + "" + + FINWriterVisitor.SWIFT_EOL + "-}{5:{CHK:88C7BBB37D50}}"; + final SwiftParser p = new SwiftParser(new StringReader(fin)); + final SwiftMessage msg = p.message(); + assertNotNull(msg.getBlock1()); + assertNotNull(msg.getBlock4()); + assertEquals( + 6, + msg.getBlock4().size(), + "Expected 6 tags but found " + msg.getBlock4().size() + ", " + + msg.getBlock4().tagNamesList()); + } + + @Test + public void testAck1() throws Exception { + final String msg = + "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + + ":20:1234567890\n" + + ":23B:CRED\n" + + ":23E:SDVA\n" + + ":26T:001\n" + + ":32A:151104XOF27000000,\n" + + ":50K:/0020121503484101\n" + + "SOXNYFAYTONU VORYEAUGEIS\n" + + ":53A:/D/D00030901\n" + + "ECOCMLBA\n" + + ":57A:/C/A00031061\n" + + "OMFNCIAB\n" + + ":59:/010010100100014010010160\n" + + "FOO VOYAGES\n" + + ":70:TRANSFERT\n" + + ":71A:SHA\n" + + ":72:/CODTYPTR/001\n" + + "//REGLEMENT\n" + + "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; + SwiftMessage sm = new SwiftParser(msg).message(); + assertNotNull(sm); + assertTrue(sm.isAck()); + } + + @Test + public void testAck2() throws Exception { + final String msg = + "{1:F21OMFNCIABAXXX6368087504}{4:{177:1511041718}{451:0}}{1:F01OMFNCIABAXXX6368087504}{2:O1031746151104CCEICMCXAXXX64953042471511041646N}{4:\n" + + ":20:1234567890\n" + + ":23B:CRED\n" + + ":32A:151104XOF14773500,\n" + + ":50K:/00057 03363591001 84\n" + + "FOO SARL \n" + + "AKWA, FACE ANCIEN DIRECTION NOBRA\n" + + "BP 1432 DOURAZLA\n" + + "237 CAMEROUN\n" + + ":57A:CBAOSNDA\n" + + ":59:/SN 012 01201 036169011401 63\n" + + "TSAEMOXU FOO INTERUNATIONALE SARL\n" + + "DIAMNIADO, DAKAR\n" + + "SENEGAL\n" + + ":70:/INV/TFI-ZS-15002\n" + + ":71A:SHA\n" + + "-}{5:{MAC:00000000}{CHK:50085EDF60EC}}{S:{SPD:}{SAC:}{COP:P}}"; + SwiftMessage sm = new SwiftParser(msg).message(); + assertNotNull(sm); + assertTrue(sm.isAck()); + } + + /** + * Extra data simple + */ + @Test + public void testExtraDataSimple() throws IOException { + final String fin = "{1:F01MOSWRUMMAXXX0000000000}{2:I103COBADEFFXXXXN}{3:{108:02161OKP00130914}}{4:\n" + + ":20:12345677890\n" + + ":23B:CRED\n" + + ":32A:160217EUR500,\n" + + ":50K:/42301978502050100067\n" + + "SHEPTUKHA VIKTORIA PAS45 15 362057\n" + + "CCC MOSCOW MOSCOW UL. AVIACIONNAYA\n" + + "DON. 99 KV. 123\n" + + ":52D:BANK OF MOSCOW\n" + + ":57A:CAIXESBBXXX\n" + + ":59:/ES3021000122390200002631\n" + + "FOO TRADE SL SPAIN CASTELLO D E\n" + + "FOO PLACA JOC DE LA PILOTA , NU\n" + + "M 1\n" + + ":70:PAYMENT FOR NALOG ZA APARTAMENT\n" + + ":71A:OUR\n" + + ":72:/ACC/UR LIZO BBBB ))))))))::::::\n" + + "-}foo"; + SwiftParser p = new SwiftParser(fin); + SwiftMessage m = p.message(); + assertNotEquals(0, (int) m.getUnparsedTextsSize()); + } + + /** + * Expected extra "}}}}" reported as error + */ + @Test + public void testExtraData() throws IOException { + final String fin = + "{1:F01MOSWRUMMAXXX0000000000}{2:I103COBADEFFXXXXN}{3:{108:02161OKP00130914}}{4:\n" + ":20:1234567890\n" + + ":23B:CRED\n" + + ":32A:160217EUR500,\n" + + ":50K:/42301978502050100067\n" + + "FOO VIKTORIA PAS45 15 362057\n" + + "CCC MOSCOW MOSCOW UL. FOO\n" + + "DON. 13 KV. 131\n" + + ":52D:BANK OF MOSCOW\n" + + ":57A:CAIXESBBXXX\n" + + ":59:/ES3021000122390200002631\n" + + "FOO TRADE SL SPAIN CASTELLO D E\n" + + "FOO PLACA JOC DE LA PILOTA , NU\n" + + "M 1\n" + + ":70:PAYMENT FOR NALOG ZA APARTAMENT\n" + + ":71A:OUR\n" + + ":72:/ACC/UR LIZO BBBB ))))))))::::::\n" + + "-}}}}}"; + SwiftParser p = new SwiftParser(fin); + SwiftMessage m = p.message(); + assertNotEquals(0, (int) m.getUnparsedTextsSize()); + } + + /* + * https://sourceforge.net/p/wife/bugs/80/ + */ + @Test + public void testParse() throws IOException { + final String fin = "{1:F01TESTAR00AXXX7607663781}{2:O1010824170510TESTAR00AXXX94149133901705101425N}{4:\n" + + ":20:DG942_171206-004\n" + + ":28D:00001/00001\n" + + ":50H:/344110001637\n" + + "TESTAR00AXXX\n" + + "Utrecht\n" + + "Netherlands\n" + + ":30:170502\n" + + ":21:010735904\n" + + ":32B:CNY14,00\n" + + ":57A:CIBKCNBJ473\n" + + ":59:/344110000361\n" + + "CASH CUSTOMER I\n" + + "TESTAR00AXXX\n" + + "Utrecht\n" + + "Netherlands\n" + + ":70:/RFB/C767405OCP021001\n" + + ":71A:SHA\n" + + "-}{5:{CHK:B3BF0D846AFD}}"; + SwiftMessage msg = new SwiftParser(fin).message(); + assertNotNull(msg); + assertNotNull(msg.getBlock1()); + assertNotNull(msg.getBlock2()); + assertNotNull(msg.getBlock4()); + assertNotNull(msg.getBlock5()); + assertEquals("TESTAR00AXXX", msg.getBlock1().getLogicalTerminal()); + assertEquals("101", msg.getBlock2().getMessageType()); + assertEquals("DG942_171206-004", msg.getBlock4().getFieldByName("20").getValue()); + } + + @Test + public void testEmptyLines() throws IOException { + String fin = "{1:F01TESTARZZAXXX0000000000}{2:I199TESTARZZXXXXN}{4:\n" + ":20:1111\n" + + "\n" + + ":21:2222\n" + + "\r\n" + + ":59:3333\r\n4444\r\n" + + ":79:5555\r6666\n" + + ":72:7777\n\r\n\n\r\n\n" + + "-}"; + SwiftMessage sm = SwiftMessage.parse(fin); + assertEquals("1111\n", sm.getBlock4().getTagByName("20").getValue()); + assertEquals("2222\n", sm.getBlock4().getTagByName("21").getValue()); + assertEquals("3333\r\n4444", sm.getBlock4().getTagByName("59").getValue()); + assertEquals("5555\r6666", sm.getBlock4().getTagByName("79").getValue()); + assertEquals("7777\n\r\n\n\r\n", sm.getBlock4().getTagByName("72").getValue()); + } + + @Test + void + reproduce_parse_stringWithNonsenseHeadersButUsefulContentBlock_returnsNullForHeadersAndValidValuesFieldsInContent() { + MtSwiftMessage msg = MtSwiftMessage.parse( + "Big blue sea{4:\n" + ":20:123456789\n" + ":77E:\n" + ":15A:\n" + ":27:3/5\n" + "-}dark green forrest"); + // We simply claim that this is an MT798, and it works! + MT798 mt798 = new MT798(msg); + assertEquals("798", mt798.getMessageType()); + // Submessage type is null, as expected + assertNull(mt798.getField12()); + // The content of block 4 is available + SwiftTagListBlock contentMessage = mt798.getSwiftMessage().getBlock4().getSubBlockAfterFirst("77E", false); + + Field27 field27 = (Field27) contentMessage.getFieldByName("27"); + assertEquals(3, field27.getNumberAsLong()); + assertEquals(5, field27.getTotalAsLong()); + assertNull(contentMessage.getFieldByName("52A")); + } + + @Test + void testParseInvalidPayload() throws IOException { + SwiftMessage msg = SwiftMessage.parse("foo bar"); + assertNull(msg.getBlock1()); + assertNull(msg.getBlock2()); + assertNull(msg.getBlock3()); + assertNull(msg.getBlock4()); + assertNull(msg.getBlock5()); + assertNull(msg.getUserBlocks()); + + // Although we may wrap it as an MT + MT103 mt103 = new MT103(msg); + + // thew MT content is null + assertNull(mt103.getField20()); + assertNull(mt103.getField32A()); + } + + @Test + void testParseEmptyContent() throws IOException { + SwiftMessage msg = SwiftMessage.parse(""); + assertNull(msg.getBlock1()); + assertNull(msg.getBlock2()); + assertNull(msg.getBlock3()); + assertNull(msg.getBlock4()); + assertNull(msg.getBlock5()); + assertNull(msg.getUserBlocks()); + + // Although we may wrap it as an MT + MT103 mt103 = new MT103(msg); + + // thew MT content is null + assertNull(mt103.getField20()); + assertNull(mt103.getField32A()); + } + + @Test + void testParseInvalidHeader() throws IOException { + SwiftMessage msg = SwiftMessage.parse( + "Big blue sea{4:\n" + ":20:123456789\n" + ":77E:\n" + ":15A:\n" + ":27:3/5\n" + "-}dark green forrest"); + + // Still cast to a specific type + MT798 mt798 = new MT798(msg); + + assertEquals("798", mt798.getMessageType()); + + // missing field is null, as expected + assertNull(mt798.getField12()); + + // The content of block 4 is still available + assertEquals("123456789", mt798.getField20().getValue()); + + SwiftTagListBlock contentMessage = mt798.getSwiftMessage().getBlock4().getSubBlockAfterFirst("77E", false); + + Field27 field27 = (Field27) contentMessage.getFieldByName("27"); + assertEquals(3, field27.getNumberAsLong()); + assertEquals(5, field27.getTotalAsLong()); + assertNull(contentMessage.getFieldByName("52A")); + } + + @Test + void test_parse_system_message_MT094_from_String_lenient_true() throws IOException { + String fin_MT094 = "{1:F01AAAACNBJBXXX1010000000}{2:O0941836210827NXNXXXXX0XXX00080000012345678911S}\n" + + "{4:{135:N}{136:X12345}{130:/01/BANK\n" + + "/01/XXXXXYYYYYX}{134:FOOABHBX\n" + + "ABCDFGGH N.A.\n" + + "ABCANA}{312:SUBJECT: xxxx XXXX AAA AASX YXYXY FOR SSS YXYXYXYX-XXX YXYX\n" + + "XXXXXX YYY YYYYYYY TO FFF WWWWW REF X00000000 ON 00\n" + + "XXX0000 YYY XXXXX YXYXYXY CODES YXYXYX FOR IPSUM LOERM\n" + + "S YSYSY XXXX XXXX,THE XXXXX OF THE XXXXXX IPSUM AAA\n" + + "XXXX XXX XXX MXXXAY XXXX IN XXX AND XXXX.}}{\n" + + // unexpected LF + "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894}}"; + SwiftParser parser = new SwiftParser(fin_MT094); + SwiftParserConfiguration configuration = new SwiftParserConfiguration(); + configuration.setLenient(true); + parser.setConfiguration(configuration); + parser.message(); + + String errorMessage = + "The block \n" + "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894} could not be identified"; + assertEquals(parser.getErrors().size(), 1); + assertEquals(parser.getErrors().get(0), errorMessage); + } + + @Test + void test_parse_system_message_MT094_from_String_lenient_false() { + String fin_MT094 = "{1:F01AAAACNBJBXXX1010000000}{2:O0941836210827NXNXXXXX0XXX00080000012345678911S}\n" + + "{4:{135:N}{136:X12345}{130:/01/BANK\n" + + "/01/XXXXXYYYYYX}{134:FOOABHBX\n" + + "ABCDFGGH N.A.\n" + + "ABCANA}{312:SUBJECT: xxxx XXXX AAA AASX YXYXY FOR SSS YXYXYXYX-XXX YXYX\n" + + "XXXXXX YYY YYYYYYY TO FFF WWWWW REF X00000000 ON 00\n" + + "XXX0000 YYY XXXXX YXYXYXY CODES YXYXYX FOR IPSUM LOERM\n" + + "S YSYSY XXXX XXXX,THE XXXXX OF THE XXXXXX IPSUM AAA\n" + + "XXXX XXX XXX MXXXAY XXXX IN XXX AND XXXX.}}{\n" + + // unexpected LF + "5:{CHK:123456789123}{SYS:1234567891XXXXXX1YYXXX1234567894}}"; + SwiftParser parser = new SwiftParser(fin_MT094); + SwiftParserConfiguration configuration = new SwiftParserConfiguration(); + configuration.setLenient(false); + parser.setConfiguration(configuration); + + Assertions.assertThrows(ProwideException.class, parser::message); + } +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SystemMessageTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SystemMessageTest.java index 2f235f511..22c80c991 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SystemMessageTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SystemMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,27 +32,28 @@ public class SystemMessageTest extends BaseMessageTestcase { */ @Test public void testPostedFengw2_01() { - String msg = "{1:F21FOOBARXXAXXX1234567890}{4:{177:0703281337}{451:1}{405:E66013}}{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + - ":16R:GENL\n" + - ":28E:1/ONLY\n" + - ":13A::STAT//086\n" + - ":20C::SEME//ABC20070327P1\n" + - ":23G:NEWM\n" + - ":98A::STAT//20070327\n" + - ":98C::PREP//20070328043657\n" + - ":22F::SFRE//DAIL\n" + - ":22F::CODE//COMP\n" + - ":22F::STTY//CUST\n" + - ":22F::STBA//TRAD\n" + - ":97A::SAFE//ABC\n" + - ":17B::ACTI//Y\n" + - ":17B::CONS//Y\n" + - ":16S:GENL\n" + - ":16R:ADDINFO\n" + - ":19A::HOLP//USD0,\n" + - ":19A::HOLS//USD0,\n" + - ":16S:ADDINFO\n" + - "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; + String msg = + "{1:F21FOOBARXXAXXX1234567890}{4:{177:0703281337}{451:1}{405:E66013}}{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + + ":16R:GENL\n" + + ":28E:1/ONLY\n" + + ":13A::STAT//086\n" + + ":20C::SEME//ABC20070327P1\n" + + ":23G:NEWM\n" + + ":98A::STAT//20070327\n" + + ":98C::PREP//20070328043657\n" + + ":22F::SFRE//DAIL\n" + + ":22F::CODE//COMP\n" + + ":22F::STTY//CUST\n" + + ":22F::STBA//TRAD\n" + + ":97A::SAFE//ABC\n" + + ":17B::ACTI//Y\n" + + ":17B::CONS//Y\n" + + ":16S:GENL\n" + + ":16R:ADDINFO\n" + + ":19A::HOLP//USD0,\n" + + ":19A::HOLS//USD0,\n" + + ":16S:ADDINFO\n" + + "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; parseMessage(msg); assertNotNull(b1); @@ -70,14 +71,14 @@ public void testPostedFengw2_01() { assertEquals("1", b4.getTagValue("451")); assertEquals("E66013", b4.getTagValue("405")); - //the MT 535 attached to this ACK system message is put into the unparsed text by the parser + // the MT 535 attached to this ACK system message is put into the unparsed text by the parser assertNotNull(o.getUnparsedTexts()); assertEquals(1, o.getUnparsedTextsSize().intValue()); SwiftMessage mt535 = o.getUnparsedTexts().getTextAsMessage(0); assertEquals("535", mt535.getType()); - //the block5 is part of the inner mt 535 + // the block5 is part of the inner mt 535 assertNull(b5); } @@ -86,15 +87,16 @@ public void testPostedFengw2_01() { */ @Test public void testPostedFengw2_02() { - String msg = "{1:F21FOOBARXXAXXX1234567890}{4:{177:0704032320}{451:0}}{1:F01FOOBARXXAXXX3227607589}{2:I950FOOBARXXXXXXN}{4:\n" + - ":20:12345678070403\n" + - ":25:12345678\n" + - ":28C:93/1\n" + - ":60F:C070403USD0,\n" + - ":61:0704050402C115454,92NSALNONREF\n" + - "/US/037833100/SHS/1235,\n" + - ":62M:C070403USD115454,92\n" + - "-}{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; + String msg = + "{1:F21FOOBARXXAXXX1234567890}{4:{177:0704032320}{451:0}}{1:F01FOOBARXXAXXX3227607589}{2:I950FOOBARXXXXXXN}{4:\n" + + ":20:12345678070403\n" + + ":25:12345678\n" + + ":28C:93/1\n" + + ":60F:C070403USD0,\n" + + ":61:0704050402C115454,92NSALNONREF\n" + + "/US/037833100/SHS/1235,\n" + + ":62M:C070403USD115454,92\n" + + "-}{5:{CHK:12C48A7C53B2}}{S:{REF:I20070404.763727356.out/1/1}}"; parseMessage(msg); assertNotNull(b1); @@ -111,14 +113,14 @@ public void testPostedFengw2_02() { assertEquals("0704032320", b4.getTagValue("177")); assertEquals("0", b4.getTagValue("451")); - //the MT 950 attached to this ACK system message is put into the unparsed text by the parser + // the MT 950 attached to this ACK system message is put into the unparsed text by the parser assertNotNull(o.getUnparsedTexts()); assertEquals(1, o.getUnparsedTextsSize().intValue()); SwiftMessage mt950 = o.getUnparsedTexts().getTextAsMessage(0); assertEquals("950", mt950.getType()); - //the block5 is part of the inner mt 535 + // the block5 is part of the inner mt 535 assertNull(b5); } @@ -127,53 +129,54 @@ public void testPostedFengw2_02() { */ @Test public void testPostedDonreda_01() { - String msg = "{1:F21MTGSUS6SAXXX3206837054}{4:{177:0703161035}{451:0}}{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//D455103\n" + - ":20C::SEME//029206016\n" + - ":23G:NEWM\n" + - ":22F::CAEV//DVCA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20070316143348\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN CH0011075394\n" + - "/XX/5983816\n" + - "ZURICH FIN SVS GRP\n" + - "CHF0.10\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//760043140\n" + - ":94F::SAFE//CUST/UBSWCHZH80A\n" + - ":93B::ELIG//UNIT/7000,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::WITF//35,\n" + - ":92A::GRSS//0,000001000\n" + - ":16S:CADETL\n" + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":11A::OPTN//CHF\n" + - ":17B::DFLT//Y\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::GRSS//0,000001000\n" + - ":16R:CASHMOVE\n" + - ":22H::CRDB//CRED\n" + - ":19B::ENTL//CHF0,01\n" + - ":19B::GRSS//CHF0,01\n" + - ":19B::NETT//CHF0,01\n" + - ":98A::PAYD//20111111\n" + - ":98A::VALU//20111111\n" + - ":16S:CASHMOVE\n" + - ":16S:CAOPTN\n" + - "-}"; + String msg = + "{1:F21MTGSUS6SAXXX3206837054}{4:{177:0703161035}{451:0}}{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + + ":16R:GENL\n" + + ":20C::CORP//D455103\n" + + ":20C::SEME//029206016\n" + + ":23G:NEWM\n" + + ":22F::CAEV//DVCA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20070316143348\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN CH0011075394\n" + + "/XX/5983816\n" + + "ZURICH FIN SVS GRP\n" + + "CHF0.10\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//760043140\n" + + ":94F::SAFE//CUST/UBSWCHZH80A\n" + + ":93B::ELIG//UNIT/7000,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::WITF//35,\n" + + ":92A::GRSS//0,000001000\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":11A::OPTN//CHF\n" + + ":17B::DFLT//Y\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::GRSS//0,000001000\n" + + ":16R:CASHMOVE\n" + + ":22H::CRDB//CRED\n" + + ":19B::ENTL//CHF0,01\n" + + ":19B::GRSS//CHF0,01\n" + + ":19B::NETT//CHF0,01\n" + + ":98A::PAYD//20111111\n" + + ":98A::VALU//20111111\n" + + ":16S:CASHMOVE\n" + + ":16S:CAOPTN\n" + + "-}"; parseMessage(msg); assertNotNull(b1); @@ -191,24 +194,23 @@ public void testPostedDonreda_01() { assertEquals("0703161035", b4.getTagValue("177")); assertEquals("0", b4.getTagValue("451")); - //the MT 564 attached to this ACK system message is put into the unparsed text by the parser + // the MT 564 attached to this ACK system message is put into the unparsed text by the parser assertNotNull(o.getUnparsedTexts()); assertEquals(1, o.getUnparsedTextsSize().intValue()); SwiftMessage mt564 = o.getUnparsedTexts().getTextAsMessage(0); assertEquals("564", mt564.getType()); - //the block5 is part of the inner mt 535 + // the block5 is part of the inner mt 535 assertNull(b5); } @Test public void test1() { - String msg = "{1:L02BANKBEBBAXXX0000001111}\n" + - "{4:\n" + - "{501:21101000000500002110100000050000ABCDABCD00000000000000000000000000000000}\n" + - "{110:001}\n" + - "{329:N}}"; + String msg = "{1:L02BANKBEBBAXXX0000001111}\n" + "{4:\n" + + "{501:21101000000500002110100000050000ABCDABCD00000000000000000000000000000000}\n" + + "{110:001}\n" + + "{329:N}}"; parseMessage(msg); assertNotNull(b4); assertEquals("21101000000500002110100000050000ABCDABCD00000000000000000000000000000000", b4.getTagValue("501")); @@ -218,10 +220,7 @@ public void test1() { @Test public void test2() { - String msg = "{1:A21FOOZBET2AXXX0018000015}\n" + - "{4:{177:9703051524}\n" + - "{451:1}\n" + - "{405:H80}}"; + String msg = "{1:A21FOOZBET2AXXX0018000015}\n" + "{4:{177:9703051524}\n" + "{451:1}\n" + "{405:H80}}"; parseMessage(msg); assertNotNull(b4); assertEquals("9703051524", b4.getTagValue("177")); @@ -238,5 +237,4 @@ public void test3() { assertEquals("1", b4.getTagValue("451")); assertEquals("Y01", b4.getTagValue("405")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/UnparsedTextParsingTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/UnparsedTextParsingTest.java index f13a2c699..424143d0c 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/UnparsedTextParsingTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/UnparsedTextParsingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import com.prowidesoftware.swift.io.ConversionService; import com.prowidesoftware.swift.model.SwiftMessage; +import java.io.IOException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import java.io.IOException; - /** * MT940 tests * @@ -33,25 +32,27 @@ public class UnparsedTextParsingTest extends BaseMessageTestcase { @Test public void test_1() { - String msg = "{1:F21XYZABCAAXXX1111112222}{4:{177:0011111111}{451:0}}{1:F21XYZABCAAXXXX1111112222}{2:O5691340110817LXLXXXXX4A1000002782131108171440N}{3:{108:MT569 011 OF 021}}{4:\n" - + ":35B:ISIN 123456ABCDEF\n" - + ":36B::SECV//UNIT/1,34\n" - + ":16S:SECDET\n" - + ":16S:VALDET\n" - + ":16S:TRANSDET\n" - + ":16S:SUMC\n" - + ":16S:SUME\n" - + ":16R:ADDINFO\n" - + ":19A::TCOP//USD123456789012,34\n" - + ":16S:ADDINFO\n" - + "-}{5:{CHK:15C62B525DAA}{TNG:}}{S:{SAC:}{COP:P}}"; + String msg = + "{1:F21XYZABCAAXXX1111112222}{4:{177:0011111111}{451:0}}{1:F21XYZABCAAXXXX1111112222}{2:O5691340110817LXLXXXXX4A1000002782131108171440N}{3:{108:MT569 011 OF 021}}{4:\n" + + ":35B:ISIN 123456ABCDEF\n" + + ":36B::SECV//UNIT/1,34\n" + + ":16S:SECDET\n" + + ":16S:VALDET\n" + + ":16S:TRANSDET\n" + + ":16S:SUMC\n" + + ":16S:SUME\n" + + ":16R:ADDINFO\n" + + ":19A::TCOP//USD123456789012,34\n" + + ":16S:ADDINFO\n" + + "-}{5:{CHK:15C62B525DAA}{TNG:}}{S:{SAC:}{COP:P}}"; try { SwiftMessage m = SwiftMessage.parse(msg); SwiftMessage m569 = SwiftMessage.parse(m.getUnparsedTexts().getAsFINString()); Assertions.assertEquals("569", m569.getType()); - Assertions.assertEquals("F21XYZABCAAXXXX1111112222", m569.getBlock1().getBlockValue()); + Assertions.assertEquals( + "F21XYZABCAAXXXX1111112222", m569.getBlock1().getBlockValue()); ConversionService service = new ConversionService(); service.getXml(m.getUnparsedTexts().getAsFINString()); @@ -59,8 +60,5 @@ public void test_1() { } catch (IOException ex) { fail(ex.getMessage()); } - } - } - diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/VisibleParser.java b/src/test/java/com/prowidesoftware/swift/io/parser/VisibleParser.java index d4b7e0795..c704b433b 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/VisibleParser.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/VisibleParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,8 @@ package com.prowidesoftware.swift.io.parser; import com.prowidesoftware.swift.model.Tag; - import java.io.IOException; - /** * Simple class that increases visibility of parser methods in order to unit tests them. * @@ -27,8 +25,7 @@ */ final class VisibleParser extends SwiftParser { - public VisibleParser() { - } + public VisibleParser() {} @Override protected char identifyBlock(String s) { @@ -41,12 +38,9 @@ public String findBlockStart() throws IOException { } public Tag consumeTag(String br) { - if (br.startsWith("{")) - br = br.substring(1); - if (br.endsWith("}")) - br = br.substring(0, br.length() - 1); - if (br.startsWith(":")) - br = br.substring(1); + if (br.startsWith("{")) br = br.substring(1); + if (br.endsWith("}")) br = br.substring(0, br.length() - 1); + if (br.startsWith(":")) br = br.substring(1); return super.createTag(br, null); } @@ -59,5 +53,4 @@ public String readUntilBlockEnds() throws IOException { public int findEndOfTagByLineFeed(String s, int start, boolean isTextBlock) { return super.findEndOfTagByLineFeed(s, start, isTextBlock); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/XMLParserTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/XMLParserTest.java index b010711c3..6455cad86 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/XMLParserTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/XMLParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,18 +21,16 @@ import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.mt.mt1xx.MT103; import com.prowidesoftware.swift.utils.SafeXmlUtils; -import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Test; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; - import javax.xml.parsers.DocumentBuilder; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; /** * Test cases for the Prowide Core proprietary XML format parser @@ -43,21 +41,20 @@ public class XMLParserTest { @Test public void testParse() { - String xml = "\n" + - "\n" + - " F\n" + - " 01\n" + - " BANKBEBBAXXX\n" + - " 2222\n" + - " 123456\n" + - "\n" + - "\n" + - " \n" + - " t1\n" + - " v1\n" + - " \n" + - "\n" + - ""; + String xml = "\n" + "\n" + + " F\n" + + " 01\n" + + " BANKBEBBAXXX\n" + + " 2222\n" + + " 123456\n" + + "\n" + + "\n" + + " \n" + + " t1\n" + + " v1\n" + + " \n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNotNull(m); @@ -65,22 +62,21 @@ public void testParse() { @Test public void testParse2() { - String xml = "\n" + - "\n" + - " F\n" + - " 01\n" + - " BANKBEBBAXXX\n" + - " 2222\n" + - " 123456\n" + - "\n" + - "\n" + - " 100\n" + - " BANKDEFFXXXX\n" + - " U\n" + - " 3\n" + - " 003\n" + - "\n" + - ""; + String xml = "\n" + "\n" + + " F\n" + + " 01\n" + + " BANKBEBBAXXX\n" + + " 2222\n" + + " 123456\n" + + "\n" + + "\n" + + " 100\n" + + " BANKDEFFXXXX\n" + + " U\n" + + " 3\n" + + " 003\n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNotNull(m); @@ -88,26 +84,25 @@ public void testParse2() { @Test public void testParse3() { - String xml = "\n" + - "\n" + - " F\n" + - " 01\n" + - " BANKBEBBAXXX\n" + - " 2222\n" + - " 123456\n" + - "\n" + - "\n" + - " 100\n" + - " 1200\n" + - " 970103\n" + - " BANKBEBBAXXX\n" + - " 2222\n" + - " 123456\n" + - " 970103\n" + - " 1201\n" + - " N\n" + - "\n" + - ""; + String xml = "\n" + "\n" + + " F\n" + + " 01\n" + + " BANKBEBBAXXX\n" + + " 2222\n" + + " 123456\n" + + "\n" + + "\n" + + " 100\n" + + " 1200\n" + + " 970103\n" + + " BANKBEBBAXXX\n" + + " 2222\n" + + " 123456\n" + + " 970103\n" + + " 1201\n" + + " N\n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNotNull(m); @@ -124,7 +119,7 @@ public void testNode() throws SAXException, IOException { InputStream is = new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)); final Document doc = db.parse(is); Node n = doc.getFirstChild(); - //this proves that DOM parser removes original carriage return characters from XML + // this proves that DOM parser removes original carriage return characters from XML assertEquals("line1\nline2", n.getFirstChild().getNodeValue()); } @@ -137,213 +132,212 @@ public void testCRLF_replace() { @Test public void testNull() { - String xml = "\n" + - "\n" + - "\n" + - "\n" + - " F\n" + - "\n" + - " 01\n" + - "\n" + - " CECAESMMA017\n" + - "\n" + - " 0000\n" + - "\n" + - " 000000\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " 320\n" + - "\n" + - " CAAMES2AXXXX\n" + - "\n" + - " N\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" + - " 15A\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 20\n" + - "\n" + - " 00005586-090224\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 22A\n" + - "\n" + - " NEWT\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 22B\n" + - "\n" + - " CONF\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 22C\n" + - "\n" + - " CAAM2A0001CECAMM\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 82A\n" + - "\n" + - " CECAESMM017\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 87A\n" + - "\n" + - " CAAMES2AXXX\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 15B\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 17R\n" + - "\n" + - " L\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 30T\n" + - "\n" + - " 20090224\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 30V\n" + - "\n" + - " 20090224\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 30P\n" + - "\n" + - " 20090225\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 32B\n" + - "\n" + - " EUR111,00\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 30X\n" + - "\n" + - " 20090225\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 34E\n" + - "\n" + - " NEUR0,00\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 37G\n" + - "\n" + - " 1,\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 14D\n" + - "\n" + - " ACT/360\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 15C\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 53A\n" + - "\n" + - " CECAESMM017\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 58A\n" + - "\n" + - " CAAMES2AXXX\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 15D\n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " \n" + - "\n" + - " 57A\n" + - "\n" + - " CECAESMM017\n" + - "\n" + - " \n" + - "\n" + - "\n" + - "\n" + - ""; + String xml = "\n" + "\n" + + "\n" + + "\n" + + " F\n" + + "\n" + + " 01\n" + + "\n" + + " CECAESMMA017\n" + + "\n" + + " 0000\n" + + "\n" + + " 000000\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + " 320\n" + + "\n" + + " CAAMES2AXXXX\n" + + "\n" + + " N\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + " \n" + + "\n" + + " 15A\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 20\n" + + "\n" + + " 00005586-090224\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 22A\n" + + "\n" + + " NEWT\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 22B\n" + + "\n" + + " CONF\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 22C\n" + + "\n" + + " CAAM2A0001CECAMM\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 82A\n" + + "\n" + + " CECAESMM017\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 87A\n" + + "\n" + + " CAAMES2AXXX\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 15B\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 17R\n" + + "\n" + + " L\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 30T\n" + + "\n" + + " 20090224\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 30V\n" + + "\n" + + " 20090224\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 30P\n" + + "\n" + + " 20090225\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 32B\n" + + "\n" + + " EUR111,00\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 30X\n" + + "\n" + + " 20090225\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 34E\n" + + "\n" + + " NEUR0,00\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 37G\n" + + "\n" + + " 1,\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 14D\n" + + "\n" + + " ACT/360\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 15C\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 53A\n" + + "\n" + + " CECAESMM017\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 58A\n" + + "\n" + + " CAAMES2AXXX\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 15D\n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " \n" + + "\n" + + " 57A\n" + + "\n" + + " CECAESMM017\n" + + "\n" + + " \n" + + "\n" + + "\n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNotNull(m); @@ -351,55 +345,54 @@ public void testNull() { @Test public void testFieldFormat() { - String xml = "\n" + - "\n" + - " F\n" + - " 01\n" + - " TESTUS20AXXX\n" + - " 0816\n" + - " 000001\n" + - "\n" + - "\n" + - " 103\n" + - " FOONUS33XXXX\n" + - " N\n" + - "\n" + - "\n" + - "\n" + - " 20\n" + - " prueba\n" + - "\n" + - "\n" + - " 23B\n" + - " CRED\n" + - "\n" + - "\n" + - " 32A\n" + - " 160621\n" + - " USD\n" + - " 123123,22\n" + - "\n" + - "\n" + - " 50A\n" + - " 234523452345345234\n" + - " CITIZAJXTRD\n" + - "\n" + - "\n" + - " 52A\n" + - " 23423421343\n" + - " ITAUKYKTXXX\n" + - "\n" + - "\n" + - " 59A\n" + - " 24523523452345\n" + - " HSBCVNVXXXX\n" + - "\n" + - "\n" + - " 71A\n" + - " SHA\n" + - "\n" + - "\n" + - ""; + String xml = "\n" + "\n" + + " F\n" + + " 01\n" + + " TESTUS20AXXX\n" + + " 0816\n" + + " 000001\n" + + "\n" + + "\n" + + " 103\n" + + " FOONUS33XXXX\n" + + " N\n" + + "\n" + + "\n" + + "\n" + + " 20\n" + + " prueba\n" + + "\n" + + "\n" + + " 23B\n" + + " CRED\n" + + "\n" + + "\n" + + " 32A\n" + + " 160621\n" + + " USD\n" + + " 123123,22\n" + + "\n" + + "\n" + + " 50A\n" + + " 234523452345345234\n" + + " CITIZAJXTRD\n" + + "\n" + + "\n" + + " 52A\n" + + " 23423421343\n" + + " ITAUKYKTXXX\n" + + "\n" + + "\n" + + " 59A\n" + + " 24523523452345\n" + + " HSBCVNVXXXX\n" + + "\n" + + "\n" + + " 71A\n" + + " SHA\n" + + "\n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNotNull(m); @@ -437,22 +430,19 @@ public void testFieldFormat() { */ @Test public void testXxeDisabled() { - String xml = "]>" + - "\n" + - "\n" + - " &xxe;\n" + - "\n" + - "\n" + - " \n" + - " t1\n" + - " v1\n" + - " \n" + - "\n" + - ""; + String xml = "]>" + "\n" + + "\n" + + " &xxe;\n" + + "\n" + + "\n" + + " \n" + + " t1\n" + + " v1\n" + + " \n" + + "\n" + + ""; XMLParser p = new XMLParser(); SwiftMessage m = p.parse(xml); assertNull(m); } - } - diff --git a/src/test/java/com/prowidesoftware/swift/io/writer/FINWriterVisitorTest.java b/src/test/java/com/prowidesoftware/swift/io/writer/FINWriterVisitorTest.java index 93771fe3e..ddf41e4ca 100644 --- a/src/test/java/com/prowidesoftware/swift/io/writer/FINWriterVisitorTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/writer/FINWriterVisitorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.io.writer; - import static org.junit.jupiter.api.Assertions.assertEquals; import com.prowidesoftware.swift.Constants; @@ -23,11 +22,10 @@ import com.prowidesoftware.swift.model.SwiftBlock2Input; import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.io.StringWriter; import java.io.Writer; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Swift writer tests @@ -142,7 +140,9 @@ public void testWriteBlock4_3() { msg.getBlock4().append(new Tag("2:val2")); msg.visit(this.visitor); - assertEquals("{1:F01VNDZBET2AXXX0027000580}{2:I028BBBBUSC0XXXXN}{4:{1:val1}{2:val2}}", getResult("testWriteBlock4_3")); + assertEquals( + "{1:F01VNDZBET2AXXX0027000580}{2:I028BBBBUSC0XXXXN}{4:{1:val1}{2:val2}}", + getResult("testWriteBlock4_3")); } @Test @@ -159,5 +159,4 @@ public void testBug1601122_1() { msg.visit(this.visitor); assertEquals("{5:{MAC:valmac}{CHK:valchk}}", getResult("testBug1601122_1")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/io/writer/MultilineUtilTest.java b/src/test/java/com/prowidesoftware/swift/io/writer/MultilineUtilTest.java index c267ec804..3366a3598 100644 --- a/src/test/java/com/prowidesoftware/swift/io/writer/MultilineUtilTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/writer/MultilineUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/io/writer/SwiftWriterTest.java b/src/test/java/com/prowidesoftware/swift/io/writer/SwiftWriterTest.java index 6a6dd43c3..dc24cda8a 100644 --- a/src/test/java/com/prowidesoftware/swift/io/writer/SwiftWriterTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/writer/SwiftWriterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,11 @@ import com.prowidesoftware.swift.model.SwiftBlock4; import com.prowidesoftware.swift.model.SwiftMessage; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Test; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; +import org.junit.jupiter.api.Test; /** * Swift writer tests @@ -63,37 +62,38 @@ public void testSimple() { StringWriter buf = new StringWriter(); SwiftWriter.writeMessage(m, buf); - assertEquals("{1:" + Constants.B1_DATA + "}{2:" + Constants.B2_INPUT + "}{3:{helloworld}}{4:\r\n" + - ":k:val\r\n" + - "-}{5:{foo:dacatadat}}", buf.toString()); + assertEquals( + "{1:" + Constants.B1_DATA + "}{2:" + Constants.B2_INPUT + "}{3:{helloworld}}{4:\r\n" + ":k:val\r\n" + + "-}{5:{foo:dacatadat}}", + buf.toString()); } @Test public void testWriteParsedMessage() throws IOException { - String m1 = "{1:F01GENODEFFAXXX4321100001}{2:O1030711060804MARKDEFFAXXX12342000010608040711N}{4:\n" + - ":20:TEST-IBAN001\n" + - ":13C:/SNDTIME/0701+0200\n" + - ":13C:/RNCTIME/0701+0200\n" + - ":23B:CRED\n" + - ":32A:060804EUR18001,01\n" + - ":33B:EUR18001,01\n" + - ":50K:KUNDE WO FOO FOO\n" + - "SYMMACH. FOO OREOKASTRO-DIAVATA\n" + - "GR-57008 FOO\n" + - "GREECE\n" + - ":52A://TAGRPRNKGRAAXXX052/S/20115\n" + - "PRNKGRAAXXX\n" + - ":57A:GENODE51LOS\n" + - ":59:/DE66593922000000045500\n" + - "FOO DER VOLKS-RAIFFEISENBANK\n" + - "RAIFFEISENPLATZ\n" + - "D-66787 WADGASSEN-HOSTENBACH\n" + - "GERMANY\n" + - ":70:TEST IBAN 01P DE\n" + - "IBAN FOO\n" + - ":71A:SHA\n" + - "-}{5:{MAC:11111111}{CHK:222222222222}}\n" + - ""; + String m1 = "{1:F01GENODEFFAXXX4321100001}{2:O1030711060804MARKDEFFAXXX12342000010608040711N}{4:\n" + + ":20:TEST-IBAN001\n" + + ":13C:/SNDTIME/0701+0200\n" + + ":13C:/RNCTIME/0701+0200\n" + + ":23B:CRED\n" + + ":32A:060804EUR18001,01\n" + + ":33B:EUR18001,01\n" + + ":50K:KUNDE WO FOO FOO\n" + + "SYMMACH. FOO OREOKASTRO-DIAVATA\n" + + "GR-57008 FOO\n" + + "GREECE\n" + + ":52A://TAGRPRNKGRAAXXX052/S/20115\n" + + "PRNKGRAAXXX\n" + + ":57A:GENODE51LOS\n" + + ":59:/DE66593922000000045500\n" + + "FOO DER VOLKS-RAIFFEISENBANK\n" + + "RAIFFEISENPLATZ\n" + + "D-66787 WADGASSEN-HOSTENBACH\n" + + "GERMANY\n" + + ":70:TEST IBAN 01P DE\n" + + "IBAN FOO\n" + + ":71A:SHA\n" + + "-}{5:{MAC:11111111}{CHK:222222222222}}\n" + + ""; String result = parseAndWrite(m1); BufferedReader expected = new BufferedReader(new StringReader(m1)); BufferedReader obtained = new BufferedReader(new StringReader(result)); @@ -134,9 +134,6 @@ public void testTrimValues() { StringWriter buf = new StringWriter(); SwiftWriter.writeMessage(m, buf, true, true); - assertEquals("{3:{108:MUR}}{4:\r\n" + - ":20:REF\r\n" + - "-}", buf.toString()); + assertEquals("{3:{108:MUR}}{4:\r\n" + ":20:REF\r\n" + "-}", buf.toString()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitorTest.java b/src/test/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitorTest.java index d9177fe90..5649882ac 100644 --- a/src/test/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitorTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/writer/XMLWriterVisitorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +15,17 @@ */ package com.prowidesoftware.swift.io.writer; - import static org.junit.jupiter.api.Assertions.assertFalse; import com.prowidesoftware.swift.Constants; import com.prowidesoftware.swift.model.*; +import java.io.StringWriter; +import java.io.Writer; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.xmlunit.builder.DiffBuilder; import org.xmlunit.diff.Diff; -import java.io.StringWriter; -import java.io.Writer; - /** * XML writer tests * @@ -40,7 +38,8 @@ public class XMLWriterVisitorTest { private SwiftMessage msg; private void assertXmlEqual(String control, String test) { - Diff diff = DiffBuilder.compare(control).withTest(test).ignoreWhitespace().build(); + Diff diff = + DiffBuilder.compare(control).withTest(test).ignoreWhitespace().build(); assertFalse(diff.hasDifferences()); } @@ -49,7 +48,7 @@ public void setUp() { this.io = new StringWriter(); this.visitor = new XMLWriterVisitor(this.io); this.msg = new SwiftMessage(); - this.msg.clear(); // some tests require that there are no extra blocks + this.msg.clear(); // some tests require that there are no extra blocks } @SuppressWarnings("unused") @@ -92,15 +91,14 @@ public void testEmptyBlocks() { @Test public void testWithTags() { - String xml = "" + - Constants.B1_DATA_XML + - "\n" + - "\n\t" + - "\n\t\tt1" + - "\n\t\tv1" + - "\n\t" + - "\n" + - "\n"; + String xml = "" + Constants.B1_DATA_XML + + "\n" + + "\n\t" + + "\n\t\tt1" + + "\n\t\tv1" + + "\n\t" + + "\n" + + "\n"; msg.clear(); SwiftBlock1 b1 = new SwiftBlock1(); b1.setValue(Constants.B1_DATA); @@ -121,10 +119,7 @@ public void testBug1539324_1() { b2.setValue(Constants.B2_INPUT); msg.setBlock2(b2); - String xml = "\n" + - Constants.B1_DATA_XML + - Constants.B2_INPUT_XML + - ""; + String xml = "\n" + Constants.B1_DATA_XML + Constants.B2_INPUT_XML + ""; assertXmlEqual(xml, getResult("testBug1539324_1")); } @@ -143,18 +138,17 @@ public void testBug1539324_2() { msg.setBlock4(new SwiftBlock4()); msg.setBlock5(new SwiftBlock5()); - String xml = "\n" + - Constants.B1_DATA_XML + - "\n" + - "" + - "\n\t" + - "\n\t\tn" + - "\n\t\tv" + - "\n\t" + - "\n" + - "\n\n" + - "\n\n" + - "\n"; + String xml = "\n" + Constants.B1_DATA_XML + + "\n" + + "" + + "\n\t" + + "\n\t\tn" + + "\n\t\tv" + + "\n\t" + + "\n" + + "\n\n" + + "\n\n" + + "\n"; assertXmlEqual(xml, getResult("testBug1539324_2")); } @@ -166,18 +160,17 @@ public void testBug1540294_1() { b4.append(new Tag("t2", "v2")); msg.setBlock4(b4); - String xml = "\n" + - "" + - "\n\t" + - "\n\t\tt1" + - "\n\t\tv1" + - "\n\t" + - "\n\t" + - "\n\t\tt2" + - "\n\t\tv2" + - "\n\t" + - "\n" + - ""; + String xml = "\n" + "" + + "\n\t" + + "\n\t\tt1" + + "\n\t\tv1" + + "\n\t" + + "\n\t" + + "\n\t\tt2" + + "\n\t\tv2" + + "\n\t" + + "\n" + + ""; assertXmlEqual(xml, getResult("testBug1540294_1")); } @@ -192,10 +185,7 @@ public void testBlock2Output_1() { b2.setValue(Constants.B2_OUTPUT); msg.setBlock2(b2); - String xml = "\n" + - Constants.B1_DATA_XML + - Constants.B2_OUTPUT_XML + - ""; + String xml = "\n" + Constants.B1_DATA_XML + Constants.B2_OUTPUT_XML + ""; assertXmlEqual(xml, getResult("testBlock2Output_1")); } @@ -207,9 +197,7 @@ public void testBlock2Output() { b2.setValue(Constants.B2_OUTPUT); msg.setBlock2(b2); - String xml = "\n" + - Constants.B2_OUTPUT_XML + - ""; + String xml = "\n" + Constants.B2_OUTPUT_XML + ""; String got = getResult("testBlock2Output"); assertXmlEqual(xml, got); } @@ -221,14 +209,13 @@ public void testTagSerialization() { b4.append(new Tag("26C", "/LONDON/UNFOOGOLD")); msg.setBlock4(b4); - String xml = "\n" + - "" + - "\n\t" + - "\n\t\t26C" + - "\n\t\t/LONDON/UNFOOGOLD" + - "\n\t" + - "\n" + - ""; + String xml = "\n" + "" + + "\n\t" + + "\n\t\t26C" + + "\n\t\t/LONDON/UNFOOGOLD" + + "\n\t" + + "\n" + + ""; assertXmlEqual(xml, getResult("testTagSerialization")); } @@ -238,31 +225,29 @@ public void testFieldSerialization() { msg.setBlock4(new SwiftBlock4()); msg.getBlock4().append(new Tag("26C", "/LONDON/UNFOOGOLD")); - //workaround - //mt.getSwiftMessage().getBlock4().append(new Tag("26C", "/LONDON/UNFOOGOLD")); - - String xml = "\n" + - "" + - "\n\t" + - "\n\t\t26C" + - "\n\t\t/LONDON/UNFOOGOLD" + - "\n\t" + - "\n" + - ""; + // workaround + // mt.getSwiftMessage().getBlock4().append(new Tag("26C", "/LONDON/UNFOOGOLD")); + + String xml = "\n" + "" + + "\n\t" + + "\n\t\t26C" + + "\n\t\t/LONDON/UNFOOGOLD" + + "\n\t" + + "\n" + + ""; assertXmlEqual(xml, getResult("testFieldSerialization")); } @Test public void testWithTags_asField() { - String xml = "" + - Constants.B1_DATA_XML + - "\n" + - "\n\t" + - "\n\t\t16R" + - "\n\t\tTEST" + - "\n\t" + - "\n" + - "\n"; + String xml = "" + Constants.B1_DATA_XML + + "\n" + + "\n\t" + + "\n\t\t16R" + + "\n\t\tTEST" + + "\n\t" + + "\n" + + "\n"; msg.clear(); SwiftBlock1 b1 = new SwiftBlock1(); b1.setValue(Constants.B1_DATA); @@ -273,5 +258,4 @@ public void testWithTags_asField() { this.visitor = new XMLWriterVisitor(this.io, true); assertXmlEqual(xml, getResult("testWithTags")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/AbstractSwiftMessageTest.java b/src/test/java/com/prowidesoftware/swift/model/AbstractSwiftMessageTest.java index d9483d70b..999e5cdc4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/AbstractSwiftMessageTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/AbstractSwiftMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,5 +62,4 @@ public void category() { mt.setIdentifier("fin.103"); assertEquals("1", mt.getCategory()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/BICTest.java b/src/test/java/com/prowidesoftware/swift/model/BICTest.java index 5e70c9b84..f962f6bc2 100644 --- a/src/test/java/com/prowidesoftware/swift/model/BICTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/BICTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ public void testParse() { assertEquals("IIII", b.getInstitution()); assertEquals("CC", b.getCountry()); assertEquals("LL", b.getLocation()); - assertEquals("BBBBB", b.getBranch()); //one B is dropped as LT identifier + assertEquals("BBBBB", b.getBranch()); // one B is dropped as LT identifier } @Test @@ -144,7 +144,7 @@ public void testBIC8() { @Test public void testBIC11() { - assertEquals("FOOOOOHUXXX", new BIC("FOOOOOHUAXXX").getBic11()); //LT is picked up as part of the branch + assertEquals("FOOOOOHUXXX", new BIC("FOOOOOHUAXXX").getBic11()); // LT is picked up as part of the branch assertEquals("FOOOOOHUXXX", new BIC("FOOOOOHUXXX").getBic11()); assertEquals("FOOOOOHUXXX", new BIC("FOOOOOHU").getBic11()); assertNull(new BIC("FOO").getBic8()); @@ -166,5 +166,4 @@ public void testAsTestBic() { assertEquals("BACOARB0XXX", new BIC("BACOARB1XXX").asTestBic().getBic11()); assertEquals("BACOARB00BE", new BIC("BACOARB10BE").asTestBic().getBic11()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/ConversionServiceTest.java b/src/test/java/com/prowidesoftware/swift/model/ConversionServiceTest.java index 324bebc6f..93e88d593 100644 --- a/src/test/java/com/prowidesoftware/swift/model/ConversionServiceTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/ConversionServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.xmlunit.builder.DiffBuilder; import org.xmlunit.diff.Diff; - /** * Conversion services test. * @@ -42,7 +41,8 @@ public class ConversionServiceTest { private final String someText = "hello world"; private void assertXmlEqual(String control, String test) { - Diff diff = DiffBuilder.compare(control).withTest(test).ignoreWhitespace().build(); + Diff diff = + DiffBuilder.compare(control).withTest(test).ignoreWhitespace().build(); assertFalse(diff.hasDifferences()); } @@ -67,7 +67,9 @@ public void testGetFINFromObj() { msg.getBlock3().append(new Tag("113:NOMT")); msg.getBlock3().append(new Tag("108", "P22VUXC43C6J3NLD")); String fin = srv.getFIN(msg); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}", + fin); } /** @@ -81,10 +83,11 @@ public void testGetFINFromObj2() { msg.addBlock(new SwiftBlock3()); msg.getBlock3().append(new Tag("108", "P22VUXC43C6J3NLD")); String fin = srv.getFIN(msg); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}", + fin); } - /** * Test method for {@link ConversionService#getFIN(SwiftMessage)}. */ @@ -100,7 +103,10 @@ public void testGetFINFromObj3_unparsedText() { msg.setUnparsedTexts(this.unparsedTexts); String fin = srv.getFIN(msg); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}" + this.someMsgText, fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}" + + this.someMsgText, + fin); } /** @@ -118,7 +124,10 @@ public void testGetFINFromObj4_unparsedText() { msg.getBlock3().setUnparsedTexts(this.unparsedTexts); String fin = srv.getFIN(msg); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}" + this.someMsgText + "}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}" + + this.someMsgText + "}", + fin); } /** @@ -136,7 +145,10 @@ public void testGetFINFromObj5_unparsedText() { msg.getBlock3().getTagByName("113").setUnparsedTexts(this.unparsedTexts); String fin = srv.getFIN(msg); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT" + this.someMsgText + "}{108:P22VUXC43C6J3NLD}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT" + + this.someMsgText + "}{108:P22VUXC43C6J3NLD}}", + fin); } /** @@ -153,7 +165,9 @@ public void testGetFINThroughXML() { String xml = SwiftWriter.getInternalXml(msg); assertNotNull(xml); String fin = srv.getFIN(xml); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}", + fin); } /** @@ -171,7 +185,9 @@ public void testGetFINThroughXML_2() { String xml = SwiftWriter.getInternalXml(msg); assertNotNull(xml); String fin = srv.getFIN(xml); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{113:NOMT}{108:P22VUXC43C6J3NLD}}", + fin); } /** @@ -189,7 +205,9 @@ public void testGetFINThroughXML_3() { String xml = SwiftWriter.getInternalXml(msg); assertNotNull(xml); String fin = srv.getFIN(xml); - assertEquals("{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{Z:{1:val1}{2:val2}}", fin); + assertEquals( + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{Z:{1:val1}{2:val2}}", + fin); } /** @@ -263,7 +281,8 @@ public void testGetObjFromXML_block3() { */ @Test public void testGetObjFromXML_block5() { - String xml = "MAC52F48656CHK24C40F1FF931"; + String xml = + "MAC52F48656CHK24C40F1FF931"; SwiftMessage msg = srv.getMessageFromXML(xml); assertNotNull(msg); assertNull(msg.getBlock1()); @@ -281,7 +300,8 @@ public void testGetObjFromXML_block5() { */ @Test public void testGetObjFromXML_blockUser() { - String xml = "1val12val2"; + String xml = + "1val12val2"; SwiftMessage msg = srv.getMessageFromXML(xml); assertNotNull(msg); assertNull(msg.getBlock1()); @@ -313,7 +333,8 @@ public void testGetObjThroughXML() { assertNotNull(m.getBlock3()); assertEquals("F01FOOBARYYAXXX8669486759", m.getBlock1().getBlockValue()); - assertEquals("O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); + assertEquals( + "O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTag(0).getValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTagValue("108")); } @@ -337,7 +358,8 @@ public void testGetObjThroughXML_2() { assertNotNull(m.getUserBlock("Z")); assertEquals("F01FOOBARYYAXXX8669486759", m.getBlock1().getBlockValue()); - assertEquals("O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); + assertEquals( + "O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); assertEquals("val1", m.getUserBlock("Z").getTag(0).getValue()); assertEquals("val1", m.getUserBlock("Z").getTagValue("1")); } @@ -362,7 +384,8 @@ public void testGetObjThroughXML3_MsgUnparsedText() { assertNotNull(m.getBlock2()); assertNotNull(m.getBlock3()); assertEquals("F01FOOBARYYAXXX8669486759", m.getBlock1().getBlockValue()); - assertEquals("O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); + assertEquals( + "O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTag(0).getValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTagValue("108")); assertEquals(2, m.getUnparsedTextsSize().intValue()); @@ -394,7 +417,8 @@ public void testGetObjThroughXML4_BlockUnparsedText() { assertNotNull(m.getBlock3()); assertEquals("F01FOOBARYYAXXX8669486759", m.getBlock1().getBlockValue()); - assertEquals("O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); + assertEquals( + "O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTag(0).getValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTagValue("108")); @@ -432,13 +456,18 @@ public void testGetObjThroughXML5_TagUnparsedText() { assertNotNull(m.getBlock3()); assertEquals("F01FOOBARYYAXXX8669486759", m.getBlock1().getBlockValue()); - assertEquals("O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); + assertEquals( + "O1030831051017CRESLULLCXXX10194697810510170831N", m.getBlock2().getBlockValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTag(0).getValue()); assertEquals("P22VUXC43C6J3NLD", m.getBlock3().getTagValue("108")); assertEquals(2, m.getBlock3().getTagByName("108").getUnparsedTextsSize().intValue()); - assertEquals(this.someMsgText, m.getBlock3().getTagByName("108").getUnparsedTexts().getText(0)); - assertEquals(this.someText, m.getBlock3().getTagByName("108").getUnparsedTexts().getText(1)); + assertEquals( + this.someMsgText, + m.getBlock3().getTagByName("108").getUnparsedTexts().getText(0)); + assertEquals( + this.someText, + m.getBlock3().getTagByName("108").getUnparsedTexts().getText(1)); } /** @@ -446,21 +475,22 @@ public void testGetObjThroughXML5_TagUnparsedText() { */ @Test public void testGetObjFromFIN_block4() { - String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + - ":20:AMLX985338-D4E5E\n" + - ":23B:CRED\n" + - ":32A:051018EUR66969,52\n" + - ":33B:EUR66969,52\n" + - ":50K:FOO SA\n" + - ":53A:DEUTDEFF\n" + - ":54A://RT\n" + - "FOOBARYY\n" + - ":59:/-\n" + - "Tressis SA\n" + - ":70:/CS BD ST EUR B\n" + - "REDEMPTION AMLX985338\n" + - ":71A:OUR\n" + - "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; + String fin = + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + + ":20:AMLX985338-D4E5E\n" + + ":23B:CRED\n" + + ":32A:051018EUR66969,52\n" + + ":33B:EUR66969,52\n" + + ":50K:FOO SA\n" + + ":53A:DEUTDEFF\n" + + ":54A://RT\n" + + "FOOBARYY\n" + + ":59:/-\n" + + "Tressis SA\n" + + ":70:/CS BD ST EUR B\n" + + "REDEMPTION AMLX985338\n" + + ":71A:OUR\n" + + "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; String xml = srv.getXml(fin); SwiftMessage m = srv.getMessageFromXML(xml); assertNotNull(m); @@ -483,21 +513,20 @@ public void testGetObjFromFIN_block4() { public void testBug1539324() { String fin = "{1:F01FOOBARYYAXXX8669486759}{3:{108:P22VUXC43C6J3NLD}}"; String xml = srv.getXml(fin); - String expected = "\n" + - "\n" + - "\n\tF" + - "\n\t01" + - "\n\tFOOBARYYAXXX" + - "\n\t8669" + - "\n\t486759" + - "\n" + - "\n" + - "\n\t" + - "\n\t\t108" + - "\n\t\tP22VUXC43C6J3NLD" + - "\n\t" + - "\n" + - "\n"; + String expected = "\n" + "\n" + + "\n\tF" + + "\n\t01" + + "\n\tFOOBARYYAXXX" + + "\n\t8669" + + "\n\t486759" + + "\n" + + "\n" + + "\n\t" + + "\n\t\t108" + + "\n\t\tP22VUXC43C6J3NLD" + + "\n\t" + + "\n" + + "\n"; assertXmlEqual(expected, xml); } @@ -520,22 +549,22 @@ public void testBug1539324_2() { @Test public void testGetObjFromFIN() { ConversionService srv; - String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + - ":20:AMLX985338-D4E5E\n" + - ":23B:CRED\n" + - ":32A:051018EUR66969,52\n" + - ":33B:EUR66969,52\n" + - ":50K:Tressis SA\n" + - ":53A:DEUTDEFF\n" + - ":54A://RT\n" + - "FOOBARYY\n" + - ":59:/-\n" + - "Tressis SA\n" + - ":70:/CS BD ST EUR B\n" + - "REDEMPTION AMLX985338\n" + - ":71A:OUR\n" + - "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; - + String fin = + "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{3:{108:P22VUXC43C6J3NLD}}{4:\n" + + ":20:AMLX985338-D4E5E\n" + + ":23B:CRED\n" + + ":32A:051018EUR66969,52\n" + + ":33B:EUR66969,52\n" + + ":50K:Tressis SA\n" + + ":53A:DEUTDEFF\n" + + ":54A://RT\n" + + "FOOBARYY\n" + + ":59:/-\n" + + "Tressis SA\n" + + ":70:/CS BD ST EUR B\n" + + "REDEMPTION AMLX985338\n" + + ":71A:OUR\n" + + "-}{5:{MAC:52F48656}{CHK:24C40F1FF931}}"; srv = new ConversionService(); msg = new SwiftMessage(); @@ -590,11 +619,11 @@ public void testGetObjFromIncompleteXML() { SwiftMessage m = srv.getMessageFromXML(xml); assertNotNull(m); assertNotNull(m.getBlock1()); - //assertNull(m.getBlock1().getApplicationId()); + // assertNull(m.getBlock1().getApplicationId()); assertEquals("01", m.getBlock1().getServiceId()); assertNull(m.getBlock1().getLogicalTerminal()); - //assertNull(m.getBlock1().getSessionNumber()); - //assertNull(m.getBlock1().getSequenceNumber()); + // assertNull(m.getBlock1().getSessionNumber()); + // assertNull(m.getBlock1().getSequenceNumber()); assertNull(m.getBlock2()); assertNull(m.getBlock3()); assertNull(m.getBlock4()); @@ -636,23 +665,25 @@ public void testCRLF_2() { */ @Test public void testCRLF_3() { - String xml = "58line1\r\nline2\r\nline3"; + String xml = + "58line1\r\nline2\r\nline3"; SwiftMessage msg = srv.getMessageFromXML(xml); - assertEquals("line1\r\nline2\r\nline3", msg.getBlock4().getTagByName("58").getValue()); + assertEquals( + "line1\r\nline2\r\nline3", msg.getBlock4().getTagByName("58").getValue()); } @Test public void testBackAndForthXMLConversion1() { - final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + FINWriterVisitor.SWIFT_EOL + - ":57A:/123456789" + FINWriterVisitor.SWIFT_EOL + - "FOOBARYY" + FINWriterVisitor.SWIFT_EOL + - "-}"; - //no fields + final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + + FINWriterVisitor.SWIFT_EOL + ":57A:/123456789" + + FINWriterVisitor.SWIFT_EOL + "FOOBARYY" + + FINWriterVisitor.SWIFT_EOL + "-}"; + // no fields String xml = srv.getXml(fin); String fin2 = srv.getFIN(xml); assertEquals(fin, fin2); - //with fields + // with fields ConversionService srv2 = new ConversionService(); xml = srv2.getXml(fin, true); fin2 = srv2.getFIN(xml); @@ -661,16 +692,16 @@ public void testBackAndForthXMLConversion1() { @Test public void testBackAndForthXMLConversion2() { - final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + FINWriterVisitor.SWIFT_EOL + - ":57A:/D/123456789" + FINWriterVisitor.SWIFT_EOL + - "FOOBARYY" + FINWriterVisitor.SWIFT_EOL + - "-}"; - //no fields + final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + + FINWriterVisitor.SWIFT_EOL + ":57A:/D/123456789" + + FINWriterVisitor.SWIFT_EOL + "FOOBARYY" + + FINWriterVisitor.SWIFT_EOL + "-}"; + // no fields String xml = srv.getXml(fin); String fin2 = srv.getFIN(xml); assertEquals(fin, fin2); - //with fields + // with fields ConversionService srv2 = new ConversionService(); xml = srv2.getXml(fin, true); fin2 = srv2.getFIN(xml); @@ -682,23 +713,22 @@ public void testBackAndForthXMLConversion2() { */ @Test public void testBackAndForthXMLConversion3() { - final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + FINWriterVisitor.SWIFT_EOL + - ":57A:/123456789" + FINWriterVisitor.SWIFT_EOL + - " FOOBARYY" + FINWriterVisitor.SWIFT_EOL + - ":61:190907D5675,S103AZMES11071950766" + FINWriterVisitor.SWIFT_EOL + - " FOOEDEMMAXXXKREDBEBBXXXXN071404 " + FINWriterVisitor.SWIFT_EOL + - "-}"; + final String fin = "{1:F01FOOBARYYAXXX8669486759}{2:O1030831051017CRESLULLCXXX10194697810510170831N}{4:" + + FINWriterVisitor.SWIFT_EOL + ":57A:/123456789" + + FINWriterVisitor.SWIFT_EOL + " FOOBARYY" + + FINWriterVisitor.SWIFT_EOL + ":61:190907D5675,S103AZMES11071950766" + + FINWriterVisitor.SWIFT_EOL + " FOOEDEMMAXXXKREDBEBBXXXXN071404 " + + FINWriterVisitor.SWIFT_EOL + "-}"; ConversionService srv2 = new ConversionService(); - //no fields + // no fields String xml = srv.getXml(fin); String fin2 = srv.getFIN(xml); assertEquals(fin, fin2); - //with fields + // with fields xml = srv2.getXml(fin, true); fin2 = srv2.getFIN(xml); assertEquals(fin, fin2); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/IBANTest.java b/src/test/java/com/prowidesoftware/swift/model/IBANTest.java index bb161720b..51259e62c 100644 --- a/src/test/java/com/prowidesoftware/swift/model/IBANTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/IBANTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.model; - import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; @@ -180,7 +179,7 @@ public void testErrorBbanLength() { IBAN iban = new IBAN("AT32010000000173363"); IbanValidationResult result = iban.validate(); assertTrue(result == IbanValidationResult.BBAN_INVALID_LENGTH); - //System.out.println(result.message()); + // System.out.println(result.message()); } @Test @@ -188,11 +187,11 @@ public void testErrorCountry() { IBAN iban = new IBAN("aa17002001280000001200527600"); IbanValidationResult result = iban.validate(); assertTrue(result == IbanValidationResult.INVALID_COUNTRY_CODE_CHARSET); - //System.out.println(result.message()); + // System.out.println(result.message()); iban = new IBAN("ZZ17002001280000001200527600"); result = iban.validate(); assertTrue(result == IbanValidationResult.INVALID_COUNTRY_CODE); - //System.out.println(result.message()); + // System.out.println(result.message()); } @Test @@ -214,7 +213,7 @@ public void testValidateBbanInvalidDigitsOrLetters() { IBAN iban = new IBAN("GI75NWBK00000000709t453"); IbanValidationResult result = iban.validate(); assertTrue(result == IbanValidationResult.BBAN_INVALID_DIGITS_OR_LETTERS); - //System.out.println(result.message()); + // System.out.println(result.message()); } @Test @@ -222,7 +221,7 @@ public void testValidateBbanInvalidUpperCaseLetters() { IBAN iban = new IBAN("GI75nWBK000000007099453"); IbanValidationResult result = iban.validate(); assertTrue(result == IbanValidationResult.BBAN_INVALID_UPPER_CASE_LETTERS); - //System.out.println(result.message()); + // System.out.println(result.message()); } @Test @@ -267,8 +266,7 @@ public void testSomeValidCodes() { private void assertIbanOk(String string) { IBAN iban = new IBAN(string); IbanValidationResult result = iban.validate(); - //System.out.println(result.message()); + // System.out.println(result.message()); assertEquals(result, IbanValidationResult.OK); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/LogicalTerminalAddressTest.java b/src/test/java/com/prowidesoftware/swift/model/LogicalTerminalAddressTest.java index 8a6517f36..c1f15fafa 100644 --- a/src/test/java/com/prowidesoftware/swift/model/LogicalTerminalAddressTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/LogicalTerminalAddressTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -140,5 +140,4 @@ public void testGetBranchBIC12() { assertEquals("BCD", lt.getBranch()); assertEquals("FOOOOOHUBCD", lt.getBic11()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/MIRTest.java b/src/test/java/com/prowidesoftware/swift/model/MIRTest.java index 6d0851a01..f707e5286 100644 --- a/src/test/java/com/prowidesoftware/swift/model/MIRTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/MIRTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.prowidesoftware.swift.model; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -60,5 +59,4 @@ public void testSplitComponents() { assertEquals("2222", mir.getSessionNumber()); assertEquals("123456", mir.getSequenceNumber()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/MoneyTest.java b/src/test/java/com/prowidesoftware/swift/model/MoneyTest.java index 7bd0b52c2..7708fa3e1 100644 --- a/src/test/java/com/prowidesoftware/swift/model/MoneyTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/MoneyTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertNull; import com.prowidesoftware.swift.model.field.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; /** * Test cases for currency amount containers @@ -61,7 +60,8 @@ public void testMoneyFromField() { @Test public void testMoneySum() { - Money m = Money.ofSum(new Field32A("121212USD1000,1"), new Field33B("USD2000,1"), new Field62F("121212USD3000,1")); + Money m = Money.ofSum( + new Field32A("121212USD1000,1"), new Field33B("USD2000,1"), new Field62F("121212USD3000,1")); assertEquals("USD", m.getCurrency()); assertEquals(new BigDecimal("6000.3"), m.getAmount()); @@ -69,5 +69,4 @@ public void testMoneySum() { assertEquals("USD", m.getCurrency()); assertEquals(new BigDecimal("7000.1"), m.getAmount()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/MtIdTest.java b/src/test/java/com/prowidesoftware/swift/model/MtIdTest.java index 0837ef96b..5f5959d5a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/MtIdTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/MtIdTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,5 +70,4 @@ public void testNamespaceURI() { assertEquals("urn:swift:xsd:fin.NAK." + current, new MtId("NAK").namespaceURI()); assertEquals("urn:swift:xsd:fin.BypassFoobar." + current, new MtId("BypassFoobar").namespaceURI()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageJsonTest.java b/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageJsonTest.java index 885ff591f..602b493b9 100644 --- a/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageJsonTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,10 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import org.junit.jupiter.api.Test; /** * Tests for JSON API in MtSwiftMessage @@ -33,21 +32,20 @@ public class MtSwiftMessageJsonTest { @Test public void testMtSwiftMessageToJson() { - String fin = "{1:F01AAAAUSC0ADDD0344000050}{2:I103BBBBUSC0XFFFN}{4:\n" + - ":20:TBEXO200909031\n" + - ":23B:CRED\n" + - ":32A:090903USD23453,\n" + - ":50K:/01111001759234567890\n" + - "JOE DOE\n" + - "R00000V0574734\n" + - ":53B:/00010013800002001234\n" + - "MI BANCO\n" + - ":59:/00013500510020179998\n" + - "FOO CORP\n" + - "R00000V000034534\n" + - ":71A:OUR\n" + - ":72:/TIPO/422\n" + - "-}{5:{PDE:FOO}}"; + String fin = "{1:F01AAAAUSC0ADDD0344000050}{2:I103BBBBUSC0XFFFN}{4:\n" + ":20:TBEXO200909031\n" + + ":23B:CRED\n" + + ":32A:090903USD23453,\n" + + ":50K:/01111001759234567890\n" + + "JOE DOE\n" + + "R00000V0574734\n" + + ":53B:/00010013800002001234\n" + + "MI BANCO\n" + + ":59:/00013500510020179998\n" + + "FOO CORP\n" + + "R00000V000034534\n" + + ":71A:OUR\n" + + ":72:/TIPO/422\n" + + "-}{5:{PDE:FOO}}"; MtSwiftMessage m = new MtSwiftMessage(fin); @@ -62,7 +60,7 @@ public void testMtSwiftMessageToJson() { m.setNotes(notes); assertNotNull(m); String s = m.toJson(); - //System.out.println(s); + // System.out.println(s); JsonObject o = JsonParser.parseString(s).getAsJsonObject(); @@ -74,76 +72,88 @@ public void testMtSwiftMessageToJson() { assertNull(o.get("mur")); assertEquals("IBBBBUSC0FFF103TBEXO200909031", o.get("uuid").getAsString()); assertTrue(o.get("statusTrail").getAsJsonArray().size() == 1); - assertEquals("comments", o.get("statusTrail").getAsJsonArray().get(0).getAsJsonObject().get("comments").getAsString()); + assertEquals( + "comments", + o.get("statusTrail") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("comments") + .getAsString()); assertTrue(o.get("notes").getAsJsonArray().size() == 1); - assertEquals("creationUser", o.get("notes").getAsJsonArray().get(0).getAsJsonObject().get("creationUser").getAsString()); + assertEquals( + "creationUser", + o.get("notes") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("creationUser") + .getAsString()); } @Test public void testMtSwiftMessageFromJson() { - String json = "{\n" + - " \"uuid\": \"IBBBBUSC0FFF103TBEXO200909031\",\n" + - " \"message\": \"{1:F01AAAAUSC0ADDD0344000050}{2:I103BBBBUSC0XFFFN}{4:\\n:20:TBEXO200909031\\n:23B:CRED\\n:32A:090903USD23453,\\n:50K:/01111001759234567890\\nROMAN GUILLEN DOBOZI \\nR00000V0574734\\n:53B:/00010013800002001234\\nMI BANCO\\n:59:/00013500510020179998\\nFOO CORP\\nR00000V000034534\\n:71A:OUR\\n:72:/TIPO/422\\n-}\",\n" + - " \"identifier\": \"fin.103\",\n" + - " \"sender\": \"AAAAUSC0DDD\",\n" + - " \"receiver\": \"BBBBUSC0FFF\",\n" + - " \"direction\": \"outgoing\",\n" + - " \"checksum\": \"c82941778f70a0426ffc04321fa145ad\",\n" + - " \"checksumBody\": \"7d5e9d83c18a16664df1dfd9b1ebe8a6\",\n" + - " \"lastModified\": {\n" + - " \"year\": 2018,\n" + - " \"month\": 4,\n" + - " \"dayOfMonth\": 22,\n" + - " \"hourOfDay\": 0,\n" + - " \"minute\": 48,\n" + - " \"second\": 4\n" + - " },\n" + - " \"creationDate\": {\n" + - " \"year\": 2015,\n" + - " \"month\": 7,\n" + - " \"dayOfMonth\": 27,\n" + - " \"hourOfDay\": 0,\n" + - " \"minute\": 48,\n" + - " \"second\": 4\n" + - " },\n" + - " \"statusTrail\": [\n" + - " {\n" + - " \"name\": \"name\",\n" + - " \"comments\": \"comments\",\n" + - " \"creationDate\": {\n" + - " \"year\": 2018,\n" + - " \"month\": 4,\n" + - " \"dayOfMonth\": 22,\n" + - " \"hourOfDay\": 0,\n" + - " \"minute\": 48,\n" + - " \"second\": 4\n" + - " },\n" + - " \"creationUser\": \"creationUser\",\n" + - " \"data\": \"data\"\n" + - " }\n" + - " ],\n" + - " \"notes\": [\n" + - " {\n" + - " \"creationDate\": {\n" + - " \"year\": 2018,\n" + - " \"month\": 4,\n" + - " \"dayOfMonth\": 22,\n" + - " \"hourOfDay\": 0,\n" + - " \"minute\": 48,\n" + - " \"second\": 4\n" + - " },\n" + - " \"creationUser\": \"creationUser\",\n" + - " \"text\": \"text\"\n" + - " }\n" + - " ],\n" + - " \"properties\": {},\n" + - " \"fileFormat\": \"FIN\",\n" + - " \"reference\": \"TBEXO200909031\",\n" + - " \"currency\": \"USD\",\n" + - " \"amount\": 23453,\n" + - " \"revisions\": []\n" + - "}"; - + String json = "{\n" + " \"uuid\": \"IBBBBUSC0FFF103TBEXO200909031\",\n" + + " \"message\": \"{1:F01AAAAUSC0ADDD0344000050}{2:I103BBBBUSC0XFFFN}{4:\\n:20:TBEXO200909031\\n:23B:CRED\\n:32A:090903USD23453,\\n:50K:/01111001759234567890\\nROMAN GUILLEN DOBOZI \\nR00000V0574734\\n:53B:/00010013800002001234\\nMI BANCO\\n:59:/00013500510020179998\\nFOO CORP\\nR00000V000034534\\n:71A:OUR\\n:72:/TIPO/422\\n-}\",\n" + + " \"identifier\": \"fin.103\",\n" + + " \"sender\": \"AAAAUSC0DDD\",\n" + + " \"receiver\": \"BBBBUSC0FFF\",\n" + + " \"direction\": \"outgoing\",\n" + + " \"checksum\": \"c82941778f70a0426ffc04321fa145ad\",\n" + + " \"checksumBody\": \"7d5e9d83c18a16664df1dfd9b1ebe8a6\",\n" + + " \"lastModified\": {\n" + + " \"year\": 2018,\n" + + " \"month\": 4,\n" + + " \"dayOfMonth\": 22,\n" + + " \"hourOfDay\": 0,\n" + + " \"minute\": 48,\n" + + " \"second\": 4\n" + + " },\n" + + " \"creationDate\": {\n" + + " \"year\": 2015,\n" + + " \"month\": 7,\n" + + " \"dayOfMonth\": 27,\n" + + " \"hourOfDay\": 0,\n" + + " \"minute\": 48,\n" + + " \"second\": 4\n" + + " },\n" + + " \"statusTrail\": [\n" + + " {\n" + + " \"name\": \"name\",\n" + + " \"comments\": \"comments\",\n" + + " \"creationDate\": {\n" + + " \"year\": 2018,\n" + + " \"month\": 4,\n" + + " \"dayOfMonth\": 22,\n" + + " \"hourOfDay\": 0,\n" + + " \"minute\": 48,\n" + + " \"second\": 4\n" + + " },\n" + + " \"creationUser\": \"creationUser\",\n" + + " \"data\": \"data\"\n" + + " }\n" + + " ],\n" + + " \"notes\": [\n" + + " {\n" + + " \"creationDate\": {\n" + + " \"year\": 2018,\n" + + " \"month\": 4,\n" + + " \"dayOfMonth\": 22,\n" + + " \"hourOfDay\": 0,\n" + + " \"minute\": 48,\n" + + " \"second\": 4\n" + + " },\n" + + " \"creationUser\": \"creationUser\",\n" + + " \"text\": \"text\"\n" + + " }\n" + + " ],\n" + + " \"properties\": {},\n" + + " \"fileFormat\": \"FIN\",\n" + + " \"reference\": \"TBEXO200909031\",\n" + + " \"currency\": \"USD\",\n" + + " \"amount\": 23453,\n" + + " \"revisions\": []\n" + + "}"; MtSwiftMessage swiftMessage = MtSwiftMessage.fromJson(json); @@ -170,5 +180,4 @@ public void testMtSwiftMessageFromJson() { assertEquals("0344", sm.getBlock1().getSessionNumber()); assertNull(sm.getBlock5()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageTest.java b/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageTest.java index 30dfee620..52e405886 100644 --- a/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/MtSwiftMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,20 +21,18 @@ import com.prowidesoftware.swift.model.mt.DefaultMtMetadataStrategy; import com.prowidesoftware.swift.model.mt.mt1xx.MT103; import com.prowidesoftware.swift.model.mt.mt7xx.MT798; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.Calendar; import java.util.Optional; +import org.junit.jupiter.api.Test; public class MtSwiftMessageTest { @Test public void testParseMt() { - String fin = "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + - ":20:TEST\n" + - ":79:AAAAA\n" + - "-}"; + String fin = "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + ":20:TEST\n" + + ":79:AAAAA\n" + + "-}"; MtSwiftMessage mt = MtSwiftMessage.parse(fin); assertEquals("AGBLLT2XXXX", mt.getSender()); assertEquals("TESTARZZXXX", mt.getReceiver()); @@ -44,10 +42,11 @@ public void testParseMt() { @Test public void testParseAck() { - String fin = "{1:F21AGBLLT2XAXXX0000000000}{4:{177:1903250612}{451:0}{108:MYMUR123458}}{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{4:\n" + - ":20:TEST\n" + - ":79:AAAAA\n" + - "-}"; + String fin = + "{1:F21AGBLLT2XAXXX0000000000}{4:{177:1903250612}{451:0}{108:MYMUR123458}}{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{4:\n" + + ":20:TEST\n" + + ":79:AAAAA\n" + + "-}"; MtSwiftMessage mt = MtSwiftMessage.parse(fin); assertEquals("MYMUR123458", mt.getMur()); assertEquals("TEST", mt.getReference()); @@ -55,10 +54,9 @@ public void testParseAck() { @Test public void testUpdateMetadata() { - String fin = "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + - ":20:TEST\n" + - ":79:AAAAA\n" + - "-}"; + String fin = "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + ":20:TEST\n" + + ":79:AAAAA\n" + + "-}"; MtSwiftMessage mt = MtSwiftMessage.parse(fin); @@ -79,9 +77,8 @@ public void testUpdateMetadata() { @Test public void testUpdateMetadata2() { - String fin = "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + - ":79:AAAAA\n" + - "-}"; + String fin = + "{1:F01AGBLLT2XAXXX1012000002}{2:I399TESTARZZXXXXN}{3:{108:MYMUR123458}}{4:\n" + ":79:AAAAA\n" + "-}"; MtSwiftMessage mt = MtSwiftMessage.parse(fin); // default metadata @@ -154,13 +151,12 @@ void testParseEmptyPayload() { @Test void testParseInvalidHeader() { - MtSwiftMessage msg = MtSwiftMessage.parse("Big blue sea{4:\n" + - ":20:123456789\n" + - ":77E:\n" + - ":27A:2/3\n" + - ":15A:\n" + - ":27:3/5\n" + - "-}dark green forrest"); + MtSwiftMessage msg = MtSwiftMessage.parse("Big blue sea{4:\n" + ":20:123456789\n" + + ":77E:\n" + + ":27A:2/3\n" + + ":15A:\n" + + ":27:3/5\n" + + "-}dark green forrest"); // Still cast to a specific type MT798 mt798 = new MT798(msg); @@ -196,5 +192,4 @@ public Optional tradeDate(AbstractMessage message) { return Optional.empty(); } } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock1Test.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock1Test.java index 3895eb887..1673b5fdc 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock1Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock1Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public void testSetValue_2() { @Test public void testSetValue_3() { try { - //set an invalid length value + // set an invalid length value b.setValue("1:F01BANKBEBBAXXX12345678"); } catch (IllegalArgumentException e) { return; @@ -68,7 +68,7 @@ public void testSetValue_3() { @Test public void testSetValue_4() { try { - //set an invalid starting substring + // set an invalid starting substring b.setValue("a:F01BANKBEBBAXXX1234567890"); } catch (IllegalArgumentException e) { return; @@ -147,7 +147,7 @@ public void testConstructorLenient_lessThanExpected() { assertEquals("01", bb.getServiceId()); assertEquals("BANKBEBBAXXX", bb.getLogicalTerminal()); assertEquals("1234", bb.getSessionNumber()); - assertEquals("56789", bb.getSequenceNumber()); //less than expected + assertEquals("56789", bb.getSequenceNumber()); // less than expected } @Test @@ -157,7 +157,7 @@ public void testConstructorLenient_moreThanExpected() { assertEquals("01", bb.getServiceId()); assertEquals("BANKBEBBAXXX", bb.getLogicalTerminal()); assertEquals("1234", bb.getSessionNumber()); - assertEquals("567890123", bb.getSequenceNumber()); //more than expected + assertEquals("567890123", bb.getSequenceNumber()); // more than expected } @Test @@ -185,7 +185,7 @@ public void testConstructorLenient_incompleteLogicalTerminal() { SwiftBlock1 bb = new SwiftBlock1("1:F01BANKBEBBA", true); assertEquals("F", bb.getApplicationId()); assertEquals("01", bb.getServiceId()); - assertEquals("BANKBEBBA", bb.getLogicalTerminal()); //missign branch code + assertEquals("BANKBEBBA", bb.getLogicalTerminal()); // missign branch code assertNull(bb.getSessionNumber()); assertNull(bb.getSequenceNumber()); } @@ -246,5 +246,4 @@ public void testCopyConstructor() { SwiftBlock1 b = new SwiftBlock1(a); assertEquals(a.getValue(), b.getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2InputTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2InputTest.java index 37611f7fb..9d1650aa4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2InputTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2InputTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,7 +125,7 @@ public void testInput_4() { @Test public void testInput_5() { try { - //set an invalid length value + // set an invalid length value in.setValue("I103BANKDEFFXXXXU300"); } catch (IllegalArgumentException e) { return; @@ -143,7 +143,7 @@ public void testInput_6() { @Test public void testInput_7() { try { - //set an invalid starting substring + // set an invalid starting substring in.setValue("1:I103BANKDEFFXXXXU3003"); } catch (IllegalArgumentException e) { return; @@ -187,7 +187,7 @@ public void testInput_LenientLessThanExpected() { assertEquals("BANKDEFFXXXX", nin.getReceiverAddress()); assertEquals("U", nin.getMessagePriority()); assertEquals("3", nin.getDeliveryMonitoring()); - assertEquals("00", nin.getObsolescencePeriod()); //less than expected + assertEquals("00", nin.getObsolescencePeriod()); // less than expected } @Test @@ -198,7 +198,7 @@ public void testInput_LenientMoreThanExpected() { assertEquals("BANKDEFFXXXX", nin.getReceiverAddress()); assertEquals("U", nin.getMessagePriority()); assertEquals("3", nin.getDeliveryMonitoring()); - assertEquals("00399", nin.getObsolescencePeriod()); //more than expected + assertEquals("00399", nin.getObsolescencePeriod()); // more than expected } @Test @@ -306,5 +306,4 @@ public void testCopyConstructor() { SwiftBlock2Input b = new SwiftBlock2Input(a); assertEquals(a.getValue(), b.getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2OutputTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2OutputTest.java index 8b40366fe..a687573ea 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2OutputTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock2OutputTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,7 +91,7 @@ public void testOutput_4() { @Test public void testOutput_5() { try { - //set an invalid length value + // set an invalid length value out.setValue("O1001200010103BANKBEBBAXXX222212345601010"); } catch (IllegalArgumentException e) { return; @@ -109,7 +109,7 @@ public void testOutput_6() { @Test public void testOutput_7() { try { - //set an invalid starting substring + // set an invalid starting substring out.setValue("1:O1001200010103BANKBEBBAXXX22221234560101031201N"); } catch (IllegalArgumentException e) { return; @@ -136,7 +136,7 @@ public void testOutputMIR() { @Test public void testOutputMIR_2() { try { - //set an invalid length string + // set an invalid length string out.setMIR("YYMMDDBANKBEBBAXXX2222123"); } catch (IllegalArgumentException e) { return; @@ -340,5 +340,4 @@ public void testCopyConstructor() { SwiftBlock2Output b = new SwiftBlock2Output(a); assertEquals(a.getValue(), b.getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock3Test.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock3Test.java index c10eb6ce8..6a0f77457 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock3Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock3Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,9 @@ public void testGenerateMUR() throws InterruptedException { assertEquals(current, b.getTagByName("108").getValue()); Thread.sleep(500); b.generateMUR(true); - assertFalse(StringUtils.equals(current, b.getTagByName("108").getValue()), "expected a different MUR after generateMUR(true)"); + assertFalse( + StringUtils.equals(current, b.getTagByName("108").getValue()), + "expected a different MUR after generateMUR(true)"); } @Test @@ -70,5 +72,4 @@ public void testBuilder() { assertEquals(4, b.getTags().size()); assertEquals("finalValue106", b.getTagValue(Field106.NAME)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock4Test.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock4Test.java index 85beb8556..1ea879a2d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock4Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock4Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ */ public class SwiftBlock4Test { - final private SwiftMessageComparator comp = new SwiftMessageComparator(); + private final SwiftMessageComparator comp = new SwiftMessageComparator(); /** * Null and Empty blocks @@ -185,5 +185,4 @@ public void testRemoveRepeatedBoundaries16RS() { assertEquals(b.getTag(12), clean.getTag(9)); assertEquals(b.getTag(13), clean.getTag(10)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock5Test.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock5Test.java index 500f4c32d..65686398d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlock5Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlock5Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.List; - +import org.junit.jupiter.api.Test; public class SwiftBlock5Test { @@ -81,5 +79,4 @@ public void testSetPDE() { assertTrue(b5.getTag(SwiftBlock5Field.PDE).isPresent()); assertEquals("", b5.getTag(SwiftBlock5Field.PDE).get().getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlockNumberingTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlockNumberingTest.java index 9774ac9a5..9ae7f0093 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlockNumberingTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlockNumberingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftBlockUserTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftBlockUserTest.java index 97dc91500..284aaf636 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftBlockUserTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftBlockUserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftCharsetUtilsTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftCharsetUtilsTest.java index 968696174..f0676518a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftCharsetUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftCharsetUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ import org.junit.jupiter.api.Test; - public class SwiftCharsetUtilsTest { - private static transient final java.util.logging.Logger log = java.util.logging.Logger.getLogger(SwiftCharsetUtilsTest.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(SwiftCharsetUtilsTest.class.getName()); @Test public void test_n() { @@ -187,7 +187,9 @@ public void test_x() { assertFalse(SwiftCharsetUtils.is_x('>')); assertFalse(SwiftCharsetUtils.is_x(';')); - assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_x("asdkjahsdHJKAHS876823 /asd78(sdf)+ adssssd' sds89?sd-43/sdf")); + assertEquals( + SwiftCharsetUtils.OK, + SwiftCharsetUtils.is_x("asdkjahsdHJKAHS876823 /asd78(sdf)+ adssssd' sds89?sd-43/sdf")); assertEquals(0, SwiftCharsetUtils.is_x("$asdfasd")); assertEquals(1, SwiftCharsetUtils.is_x("Y&UJUIk")); assertEquals(6, SwiftCharsetUtils.is_x("J3fYDF=")); @@ -261,8 +263,9 @@ public void test_y() { assertFalse(SwiftCharsetUtils.is_y(']')); assertFalse(SwiftCharsetUtils.is_y('@')); - - assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_y("KJAHSDJSHJKAHS876823 /DD78()+ DDFD&%*\"' 89?DD-43/D;!:=D")); + assertEquals( + SwiftCharsetUtils.OK, + SwiftCharsetUtils.is_y("KJAHSDJSHJKAHS876823 /DD78()+ DDFD&%*\"' 89?DD-43/D;!:=D")); assertEquals(0, SwiftCharsetUtils.is_y("$asdfasd")); assertEquals(1, SwiftCharsetUtils.is_y("YkUJUIk")); assertEquals(6, SwiftCharsetUtils.is_y("J3(YDF_")); @@ -272,7 +275,9 @@ public void test_y() { public void test_z() { log.info("z " + SwiftCharsetUtils.getAsString(SwiftCharsetUtils.get_z())); - assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_z("KJAHSDJSsdfs@#HJKAHS876823 /DD78()+ DDFD&%*\"' 89?DD-43/D;!:=D")); + assertEquals( + SwiftCharsetUtils.OK, + SwiftCharsetUtils.is_z("KJAHSDJSsdfs@#HJKAHS876823 /DD78()+ DDFD&%*\"' 89?DD-43/D;!:=D")); assertEquals(0, SwiftCharsetUtils.is_z("$asdfasd")); assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_z("Y_UJUIk")); assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_z("J3(dDF_")); @@ -282,7 +287,8 @@ public void test_z() { public void test_c() { log.info("c " + SwiftCharsetUtils.getAsString(SwiftCharsetUtils.get_c())); - assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_c("KASJDFSD8223JS2220983JFKSI12SFD5344678590LSKSFDMNCVXOW")); + assertEquals( + SwiftCharsetUtils.OK, SwiftCharsetUtils.is_c("KASJDFSD8223JS2220983JFKSI12SFD5344678590LSKSFDMNCVXOW")); assertEquals(0, SwiftCharsetUtils.is_c("$asdfasd")); assertEquals(1, SwiftCharsetUtils.is_c("Y(UJUIk")); assertEquals(6, SwiftCharsetUtils.is_c("J3SSDF%")); @@ -292,7 +298,9 @@ public void test_c() { public void test_B() { log.info("B " + SwiftCharsetUtils.getAsString(SwiftCharsetUtils.get_B())); - assertEquals(SwiftCharsetUtils.OK, SwiftCharsetUtils.is_B("KASJDFasdsSD8223JS22209ytJFKSI1dd2SFD5d344678590LSKSFDMNCVXOW")); + assertEquals( + SwiftCharsetUtils.OK, + SwiftCharsetUtils.is_B("KASJDFasdsSD8223JS22209ytJFKSI1dd2SFD5d344678590LSKSFDMNCVXOW")); assertEquals(0, SwiftCharsetUtils.is_B("$asdfasd")); assertEquals(1, SwiftCharsetUtils.is_B("s(UJUIk")); assertEquals(6, SwiftCharsetUtils.is_B("J3ssDF%")); diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageFragmentTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageFragmentTest.java index 5da1bb100..4fa0748cf 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageFragmentTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageFragmentTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageJsonTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageJsonTest.java index a5b6d5979..92f63b921 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageJsonTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,8 @@ public void testBlock1ToJson() { @Test public void testBlock1FromJson() { - String json = "{\"applicationId\":\"F\",\"serviceId\":\"01\",\"logicalTerminal\":\"FOOSEDR0AXXX\",\"sessionNumber\":\"0000\",\"sequenceNumber\":\"000000\"}"; + String json = + "{\"applicationId\":\"F\",\"serviceId\":\"01\",\"logicalTerminal\":\"FOOSEDR0AXXX\",\"sessionNumber\":\"0000\",\"sequenceNumber\":\"000000\"}"; SwiftBlock1 b1 = SwiftBlock1.fromJson(json); assertEquals("F", b1.getApplicationId()); assertEquals("01", b1.getServiceId()); @@ -91,7 +92,8 @@ public void testBlock2OutputToJson() { @Test public void testBlock2InputFromJson() { - String s = "{\"direction\":\"I\",\"messageType\":\"103\",\"receiverAddress\":\"BBBBUSC0XXXX\",\"messagePriority\":\"N\",\"deliveryMonitoring\":\"2\",\"obsolescencePeriod\":\"003\"}"; + String s = + "{\"direction\":\"I\",\"messageType\":\"103\",\"receiverAddress\":\"BBBBUSC0XXXX\",\"messagePriority\":\"N\",\"deliveryMonitoring\":\"2\",\"obsolescencePeriod\":\"003\"}"; SwiftBlock2Input block2Input = SwiftBlock2Input.fromJson(s); assertTrue(block2Input.isInput()); assertEquals("103", block2Input.getMessageType()); @@ -103,7 +105,8 @@ public void testBlock2InputFromJson() { @Test public void testBlock2OutputFromJson() { - String s = "{\"direction\":\"O\",\"messageType\":\"100\",\"senderInputTime\":\"1200\",\"MIRDate\":\"010103\",\"MIRLogicalTerminal\":\"BANKBEBBAXXX\",\"MIRSessionNumber\":\"2222\",\"MIRSequenceNumber\":\"123456\",\"receiverOutputDate\":\"010103\",\"receiverOutputTime\":\"1201\",\"messagePriority\":\"N\"}"; + String s = + "{\"direction\":\"O\",\"messageType\":\"100\",\"senderInputTime\":\"1200\",\"MIRDate\":\"010103\",\"MIRLogicalTerminal\":\"BANKBEBBAXXX\",\"MIRSessionNumber\":\"2222\",\"MIRSequenceNumber\":\"123456\",\"receiverOutputDate\":\"010103\",\"receiverOutputTime\":\"1201\",\"messagePriority\":\"N\"}"; SwiftBlock2Output block2Output = SwiftBlock2Output.fromJson(s); assertTrue(block2Output.isOutput()); @@ -126,7 +129,7 @@ public void testBlock3ToJson() { assertNotNull(o); assertTrue(o.get("tags").getAsJsonArray().size() == 2); - //TODO agregar mas asserts, ver testBlock1ToJson + // TODO agregar mas asserts, ver testBlock1ToJson } @Test @@ -149,10 +152,38 @@ public void testBlock4ToJson() { assertNotNull(o); assertTrue(o.get("tags").getAsJsonArray().size() == 2); - assertEquals("20", o.get("tags").getAsJsonArray().get(0).getAsJsonObject().get("name").getAsString()); - assertEquals("23B", o.get("tags").getAsJsonArray().get(1).getAsJsonObject().get("name").getAsString()); - assertEquals("REFERENCE", o.get("tags").getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); - assertEquals("CRED", o.get("tags").getAsJsonArray().get(1).getAsJsonObject().get("value").getAsString()); + assertEquals( + "20", + o.get("tags") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("name") + .getAsString()); + assertEquals( + "23B", + o.get("tags") + .getAsJsonArray() + .get(1) + .getAsJsonObject() + .get("name") + .getAsString()); + assertEquals( + "REFERENCE", + o.get("tags") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("value") + .getAsString()); + assertEquals( + "CRED", + o.get("tags") + .getAsJsonArray() + .get(1) + .getAsJsonObject() + .get("value") + .getAsString()); } @Test @@ -176,15 +207,36 @@ public void testBlock5ToJson() { assertNotNull(o); assertTrue(o.get("tags").getAsJsonArray().size() == 2); - assertEquals("PDE", o.get("tags").getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); - assertEquals("CHK", o.get("tags").getAsJsonArray().get(1).getAsJsonObject().get("name").getAsString()); - assertEquals("aaaa1111bbbb2222", o.get("tags").getAsJsonArray().get(1).getAsJsonObject().get("value").getAsString()); - + assertEquals( + "PDE", + o.get("tags") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("value") + .getAsString()); + assertEquals( + "CHK", + o.get("tags") + .getAsJsonArray() + .get(1) + .getAsJsonObject() + .get("name") + .getAsString()); + assertEquals( + "aaaa1111bbbb2222", + o.get("tags") + .getAsJsonArray() + .get(1) + .getAsJsonObject() + .get("value") + .getAsString()); } @Test public void testBlock5FromJson() { - String json = "{\"tags\":[{\"name\":\"PDE\",\"value\":\"\"},{\"name\":\"CHK\",\"value\":\"aaaa1111bbbb2222\"}]}"; + String json = + "{\"tags\":[{\"name\":\"PDE\",\"value\":\"\"},{\"name\":\"CHK\",\"value\":\"aaaa1111bbbb2222\"}]}"; SwiftBlock5 b5 = SwiftBlock5.fromJson(json); assertTrue(b5.getTags().size() == 2); @@ -204,14 +256,29 @@ public void testSwiftBlockUserToJson() { assertNotNull(o); assertTrue(o.get("tags").getAsJsonArray().size() == 2); - assertEquals("PDE", o.get("tags").getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); - assertEquals("CHK", o.get("tags").getAsJsonArray().get(1).getAsJsonObject().get("name").getAsString()); + assertEquals( + "PDE", + o.get("tags") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("value") + .getAsString()); + assertEquals( + "CHK", + o.get("tags") + .getAsJsonArray() + .get(1) + .getAsJsonObject() + .get("name") + .getAsString()); assertEquals("P", o.get("blockName").getAsString()); } @Test public void testSwiftBlockUserFromJson() { - String json = "{\"blockName\":\"A\",\"tags\":[{\"name\":\"PDE\",\"value\":\"\"},{\"name\":\"CHK\",\"value\":\"aaaa1111bbbb2222\"}]}"; + String json = + "{\"blockName\":\"A\",\"tags\":[{\"name\":\"PDE\",\"value\":\"\"},{\"name\":\"CHK\",\"value\":\"aaaa1111bbbb2222\"}]}"; SwiftBlockUser b = SwiftBlockUser.fromJson(json); assertTrue(b.getTags().size() == 2); @@ -222,16 +289,18 @@ public void testSwiftBlockUserFromJson() { @Test public void testSwiftMessageToJson() { - SwiftMessage m = MT103.parse("{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + - ":20:REFERENCE\n" + - ":23B:CRED\n" + - ":32A:130204USD1234567,89\n" + - ":50K:/12345678901234567890\n" + - "FOOBANKXXXXX\n" + - ":59:/12345678901234567890\n" + - "JOE DOE\n" + - ":71A:OUR\n" + - "-}").getSwiftMessage(); + SwiftMessage m = MT103.parse( + "{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + + ":20:REFERENCE\n" + + ":23B:CRED\n" + + ":32A:130204USD1234567,89\n" + + ":50K:/12345678901234567890\n" + + "FOOBANKXXXXX\n" + + ":59:/12345678901234567890\n" + + "JOE DOE\n" + + ":71A:OUR\n" + + "-}") + .getSwiftMessage(); final String json = m.toJson(); JsonObject o = JsonParser.parseString(json).getAsJsonObject(); @@ -255,65 +324,64 @@ public void testSwiftMessageToJson() { @Test public void testSwiftMessageFromJsonWithBlock3() { - String json = "{\n" + - " \"timestamp\": \"2018-04-19T02:31:26Z\",\n" + - " \"version\": 2,\n" + - " \"data\": {\n" + - " \"block1\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + - " \"sessionNumber\": \"0000\",\n" + - " \"sequenceNumber\": \"000000\"\n" + - " },\n" + - " \"block2\": {\n" + - " \"receiverAddress\": \"FOORECV0XXXX\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"103\",\n" + - " \"direction\": \"I\"\n" + - " },\n" + - " \"block3\": {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"113\",\n" + - " \"value\": \"SEPA\"\n" + - " },\n" + - " {\n" + - " \"name\": \"108\",\n" + - " \"value\": \"ILOVESEPA\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"block4\": {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"value\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23B\",\n" + - " \"value\": \"CRED\"\n" + - " },\n" + - " {\n" + - " \"name\": \"32A\",\n" + - " \"value\": \"130204USD1234567,89\"\n" + - " },\n" + - " {\n" + - " \"name\": \"50K\",\n" + - " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + - " },\n" + - " {\n" + - " \"name\": \"59\",\n" + - " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"71A\",\n" + - " \"value\": \"OUR\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " }\n" + - "}"; + String json = "{\n" + " \"timestamp\": \"2018-04-19T02:31:26Z\",\n" + + " \"version\": 2,\n" + + " \"data\": {\n" + + " \"block1\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + + " \"sessionNumber\": \"0000\",\n" + + " \"sequenceNumber\": \"000000\"\n" + + " },\n" + + " \"block2\": {\n" + + " \"receiverAddress\": \"FOORECV0XXXX\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"103\",\n" + + " \"direction\": \"I\"\n" + + " },\n" + + " \"block3\": {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"113\",\n" + + " \"value\": \"SEPA\"\n" + + " },\n" + + " {\n" + + " \"name\": \"108\",\n" + + " \"value\": \"ILOVESEPA\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"block4\": {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"value\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23B\",\n" + + " \"value\": \"CRED\"\n" + + " },\n" + + " {\n" + + " \"name\": \"32A\",\n" + + " \"value\": \"130204USD1234567,89\"\n" + + " },\n" + + " {\n" + + " \"name\": \"50K\",\n" + + " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + + " },\n" + + " {\n" + + " \"name\": \"59\",\n" + + " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"71A\",\n" + + " \"value\": \"OUR\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + "}"; SwiftMessage m = SwiftMessage.fromJson(json); assertNotNull(m.getBlock1()); @@ -328,54 +396,53 @@ public void testSwiftMessageFromJsonWithBlock3() { @Test public void testSwiftMessageFromJson() { - String json = "{\n" + - " \"timestamp\": \"2018-04-16T03:57:16Z\",\n" + - " \"version\": 2,\n" + - " \"data\": {\n" + - " \"block1\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + - " \"sessionNumber\": \"0000\",\n" + - " \"sequenceNumber\": \"000000\"\n" + - " },\n" + - " \"block2\": {\n" + - " \"input\": true,\n" + - " \"direction\": I,\n" + - " \"receiverAddress\": \"FOORECV0XXXX\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"103\"\n" + - " },\n" + - " \"block4\": {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"value\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23B\",\n" + - " \"value\": \"CRED\"\n" + - " },\n" + - " {\n" + - " \"name\": \"32A\",\n" + - " \"value\": \"130204USD1234567,89\"\n" + - " },\n" + - " {\n" + - " \"name\": \"50K\",\n" + - " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + - " },\n" + - " {\n" + - " \"name\": \"59\",\n" + - " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"71A\",\n" + - " \"value\": \"OUR\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " }\n" + - "}"; + String json = "{\n" + " \"timestamp\": \"2018-04-16T03:57:16Z\",\n" + + " \"version\": 2,\n" + + " \"data\": {\n" + + " \"block1\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + + " \"sessionNumber\": \"0000\",\n" + + " \"sequenceNumber\": \"000000\"\n" + + " },\n" + + " \"block2\": {\n" + + " \"input\": true,\n" + + " \"direction\": I,\n" + + " \"receiverAddress\": \"FOORECV0XXXX\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"103\"\n" + + " },\n" + + " \"block4\": {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"value\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23B\",\n" + + " \"value\": \"CRED\"\n" + + " },\n" + + " {\n" + + " \"name\": \"32A\",\n" + + " \"value\": \"130204USD1234567,89\"\n" + + " },\n" + + " {\n" + + " \"name\": \"50K\",\n" + + " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + + " },\n" + + " {\n" + + " \"name\": \"59\",\n" + + " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"71A\",\n" + + " \"value\": \"OUR\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + "}"; SwiftMessage m = SwiftMessage.fromJson(json); assertNotNull(m.getBlock1()); @@ -388,92 +455,91 @@ public void testSwiftMessageFromJson() { @Test public void testSwiftMessageFromJsonUserBlocks() { - String json = "{\n" + - " \"timestamp\": \"2018-04-25T02:22:10Z\",\n" + - " \"version\": 2,\n" + - " \"data\": {\n" + - " \"block1\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + - " \"sessionNumber\": \"0000\",\n" + - " \"sequenceNumber\": \"000000\"\n" + - " },\n" + - " \"block2\": {\n" + - " \"receiverAddress\": \"FOORECV0XXXX\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"103\",\n" + - " \"direction\": \"I\"\n" + - " },\n" + - " \"block3\": {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"113\",\n" + - " \"value\": \"SEPA\"\n" + - " },\n" + - " {\n" + - " \"name\": \"108\",\n" + - " \"value\": \"ILOVESEPA\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"block4\": {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"value\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23B\",\n" + - " \"value\": \"CRED\"\n" + - " },\n" + - " {\n" + - " \"name\": \"32A\",\n" + - " \"value\": \"130204USD1234567,89\"\n" + - " },\n" + - " {\n" + - " \"name\": \"50K\",\n" + - " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + - " },\n" + - " {\n" + - " \"name\": \"59\",\n" + - " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"71A\",\n" + - " \"value\": \"OUR\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"userBlocks\": [\n" + - " {\n" + - " \"blockName\":\"P\",\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"value\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23B\",\n" + - " \"value\": \"CRED\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " {\n" + - " \"tags\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"value\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23B\",\n" + - " \"value\": \"CRED\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; + String json = "{\n" + " \"timestamp\": \"2018-04-25T02:22:10Z\",\n" + + " \"version\": 2,\n" + + " \"data\": {\n" + + " \"block1\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + + " \"sessionNumber\": \"0000\",\n" + + " \"sequenceNumber\": \"000000\"\n" + + " },\n" + + " \"block2\": {\n" + + " \"receiverAddress\": \"FOORECV0XXXX\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"103\",\n" + + " \"direction\": \"I\"\n" + + " },\n" + + " \"block3\": {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"113\",\n" + + " \"value\": \"SEPA\"\n" + + " },\n" + + " {\n" + + " \"name\": \"108\",\n" + + " \"value\": \"ILOVESEPA\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"block4\": {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"value\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23B\",\n" + + " \"value\": \"CRED\"\n" + + " },\n" + + " {\n" + + " \"name\": \"32A\",\n" + + " \"value\": \"130204USD1234567,89\"\n" + + " },\n" + + " {\n" + + " \"name\": \"50K\",\n" + + " \"value\": \"/12345678901234567890\\nFOOBANKXXXXX\"\n" + + " },\n" + + " {\n" + + " \"name\": \"59\",\n" + + " \"value\": \"/12345678901234567890\\nJOE DOE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"71A\",\n" + + " \"value\": \"OUR\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"userBlocks\": [\n" + + " {\n" + + " \"blockName\":\"P\",\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"value\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23B\",\n" + + " \"value\": \"CRED\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"tags\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"value\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23B\",\n" + + " \"value\": \"CRED\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; SwiftMessage m = SwiftMessage.fromJson(json); assertNotNull(m.getBlock1()); @@ -489,16 +555,18 @@ public void testSwiftMessageFromJsonUserBlocks() { @Test public void testSwiftMessageToJsonAndFromJson() { - SwiftMessage m = MT103.parse("{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + - ":20:REFERENCE\n" + - ":23B:CRED\n" + - ":32A:130204USD1234567,89\n" + - ":50K:/12345678901234567890\n" + - "FOOBANKXXXXX\n" + - ":59:/12345678901234567890\n" + - "JOE DOE\n" + - ":71A:OUR\n" + - "-}{5:{CHK:C77F8E009597}}").getSwiftMessage(); + SwiftMessage m = MT103.parse( + "{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + + ":20:REFERENCE\n" + + ":23B:CRED\n" + + ":32A:130204USD1234567,89\n" + + ":50K:/12345678901234567890\n" + + "FOOBANKXXXXX\n" + + ":59:/12345678901234567890\n" + + "JOE DOE\n" + + ":71A:OUR\n" + + "-}{5:{CHK:C77F8E009597}}") + .getSwiftMessage(); String toJsonSwiftMessage = m.toJson(); @@ -508,5 +576,4 @@ public void testSwiftMessageToJsonAndFromJson() { assertTrue(comp.compare(m, fromJsonSwiftMessage) == 0); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageTest.java index 23799539c..5b8667b83 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,13 +31,12 @@ import com.prowidesoftware.swift.model.mt.mt2xx.*; import com.prowidesoftware.swift.model.mt.mt3xx.MT300; import com.prowidesoftware.swift.model.mt.mt5xx.MT540; -import org.junit.jupiter.api.Test; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.Calendar; import java.util.List; +import org.junit.jupiter.api.Test; /** * General swift message tests. @@ -115,7 +114,7 @@ public void testDefaultConstructor() { assertNotNull(m.getUserBlocks()); assertTrue(m.getUserBlocks() instanceof List); - //expected 2 because empty blocks are not counted and block 1 and 2 have default attribute values + // expected 2 because empty blocks are not counted and block 1 and 2 have default attribute values assertEquals(2, m.getBlockCount()); } @@ -165,9 +164,21 @@ public void testPostedTimclarke_01() { SwiftParser parser; SwiftMessage msg; - final String messageOutput = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; - - final String messageInput = "{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + ":16R:GENL\n" + ":28E:1/ONLY\n" + ":13A::STAT//086\n" + ":20C::SEME//ABC20070327P1\n" + ":23G:NEWM\n" + ":98A::STAT//20070327\n" + ":98C::PREP//20070328043657\n" + ":22F::SFRE//DAIL\n" + ":22F::CODE//COMP\n" + ":22F::STTY//CUST\n" + ":22F::STBA//TRAD\n" + ":97A::SAFE//ABC\n" + ":17B::ACTI//Y\n" + ":17B::CONS//Y\n" + ":16S:GENL\n" + ":16R:ADDINFO\n" + ":19A::HOLP//USD0,\n" + ":19A::HOLS//USD0,\n" + ":16S:ADDINFO\n" + "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; + final String messageOutput = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + + final String messageInput = "{1:F01FOOBARXXAXXX3219604112}{2:I535FOOBARXXXXXXN}{4:\n" + ":16R:GENL\n" + + ":28E:1/ONLY\n" + ":13A::STAT//086\n" + ":20C::SEME//ABC20070327P1\n" + ":23G:NEWM\n" + + ":98A::STAT//20070327\n" + ":98C::PREP//20070328043657\n" + ":22F::SFRE//DAIL\n" + + ":22F::CODE//COMP\n" + ":22F::STTY//CUST\n" + ":22F::STBA//TRAD\n" + ":97A::SAFE//ABC\n" + + ":17B::ACTI//Y\n" + ":17B::CONS//Y\n" + ":16S:GENL\n" + ":16R:ADDINFO\n" + ":19A::HOLP//USD0,\n" + + ":19A::HOLS//USD0,\n" + ":16S:ADDINFO\n" + + "-}{5:{MAC:8A1FADA1}{CHK:B018C2CA74CD}}{S:{REF:I20070328.386482886.out/1/1}}"; try { parser = new SwiftParser(messageOutput); @@ -182,8 +193,8 @@ public void testPostedTimclarke_01() { msg = parser.message(); assertTrue(msg.getBlock2() instanceof SwiftBlock2Input); - //msSender = msg.getBlock2().getSender(); - //msPriority = msg.getBlock2().getMessagePriority(); + // msSender = msg.getBlock2().getSender(); + // msPriority = msg.getBlock2().getMessagePriority(); } catch (Exception e) { e.printStackTrace(); } @@ -195,8 +206,20 @@ public void testPostedTimclarke_01() { @Test public void testCOVMessage() { SwiftParser parser; - final String msg1s = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:COV}}{4:\n" + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; - final String msg2s = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}}{4:\n" + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + final String msg1s = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:COV}}{4:\n" + + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + final String msg2s = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}}{4:\n" + + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; try { parser = new SwiftParser(msg1s); SwiftMessage msg1 = parser.message(); @@ -216,8 +239,20 @@ public void testCOVMessage() { @Test public void testSTPMessage() { SwiftParser parser; - final String msg1s = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; - final String msg2s = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}}{4:\n" + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + final String msg1s = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + final String msg2s = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}}{4:\n" + + ":20:D051026EUR100057\n" + ":13C:/RNCTIME/0802+0000\n" + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + ":33B:EUR6740,91\n" + ":50A:SSSSESMMXXX\n" + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + ":59:/ES0123456789012345671234\n" + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + "/123123123: FOOVIMAR 2000 FOOBAR\n" + ":71A:SHA\n" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; try { parser = new SwiftParser(msg1s); SwiftMessage msg1 = parser.message(); @@ -245,7 +280,6 @@ public void testToMt() { AbstractMT o = m.toMT(); assertTrue(o instanceof MT102, "MT not an instance of 102"); - } @Test @@ -274,10 +308,11 @@ public void PDE() { @Test public void isAck() throws IOException { - String msg = "{1:F21LITEBEBBAXXX0066000079}{4:{177:1104180901}{451:0}}{1:F01LITEBEBBAXXX0066000079}{2:I999LITEBEBBXXXXN}{4:\n" + - ":20:TESTREF1\n" + - ":79:This is text line 1\n" + - "-}{5:{CHK:7602B010CF31}{TNG:}}"; + String msg = + "{1:F21LITEBEBBAXXX0066000079}{4:{177:1104180901}{451:0}}{1:F01LITEBEBBAXXX0066000079}{2:I999LITEBEBBXXXXN}{4:\n" + + ":20:TESTREF1\n" + + ":79:This is text line 1\n" + + "-}{5:{CHK:7602B010CF31}{TNG:}}"; SwiftMessage m = SwiftMessage.parse(msg); assertTrue(m.isAck()); assertFalse(m.isNack()); @@ -285,9 +320,7 @@ public void isAck() throws IOException { @Test public void getMtId() throws IOException { - String msg = "{1:F01BICAUS11AXXX0000000000}{2:I202N}{4:\n" + - ":20:asdfasdf\n" + - "-}"; + String msg = "{1:F01BICAUS11AXXX0000000000}{2:I202N}{4:\n" + ":20:asdfasdf\n" + "-}"; SwiftParser p = new SwiftParser(msg); SwiftMessage m = p.message(); assertNotNull(m.getMtId()); @@ -296,7 +329,8 @@ public void getMtId() throws IOException { @Test public void isServiceMessage21() throws IOException { - SwiftMessage m = SwiftMessage.parse("{1:F01BNPAFRPPZXXX0000000006}{2:O0111702040914DYLRXXXXCXXX00000000001702040914S}{4:{175:0914}{106:170204BNPAFRPPZXXX0000000007}{108:MyRef9}{175:0914}{107:170204MGTCBEBBXXXX0000000007}}{5:{CHK:ABCDEF123456}{SYS:}}"); + SwiftMessage m = SwiftMessage.parse( + "{1:F01BNPAFRPPZXXX0000000006}{2:O0111702040914DYLRXXXXCXXX00000000001702040914S}{4:{175:0914}{106:170204BNPAFRPPZXXX0000000007}{108:MyRef9}{175:0914}{107:170204MGTCBEBBXXXX0000000007}}{5:{CHK:ABCDEF123456}{SYS:}}"); assertFalse(m.isServiceMessage()); assertFalse(m.isAck()); assertFalse(m.isNack()); @@ -308,7 +342,8 @@ public void isServiceMessage21() throws IOException { @Test public void isServiceMessage() throws IOException { - SwiftMessage m = SwiftMessage.parse("{1:F21BNPAFRPPZXXX0000000007}{4:{177:1702040914}{451:0}}{1:F01BNPAFRPPZXXX0000000007}{2:I103MGTCBEBBXXXXN}{3:{108:MyRef9}}{4:\n-}{5:{MAC:ABCD1234}{CHK:ABCDEF123456}}"); + SwiftMessage m = SwiftMessage.parse( + "{1:F21BNPAFRPPZXXX0000000007}{4:{177:1702040914}{451:0}}{1:F01BNPAFRPPZXXX0000000007}{2:I103MGTCBEBBXXXXN}{3:{108:MyRef9}}{4:\n-}{5:{MAC:ABCD1234}{CHK:ABCDEF123456}}"); assertTrue(m.isServiceMessage()); assertTrue(m.isAck()); assertFalse(m.isNack()); @@ -323,7 +358,8 @@ public void testGetSenderReceiver() throws IOException { /* * incomming */ - SwiftMessage m = SwiftMessage.parse("{1:F01FOOBARXXAXXX0387241036}{2:O9502352060913FOOBUS22XXXX18884819330609140052N}{4:\n:20:123456\n-}"); + SwiftMessage m = SwiftMessage.parse( + "{1:F01FOOBARXXAXXX0387241036}{2:O9502352060913FOOBUS22XXXX18884819330609140052N}{4:\n:20:123456\n-}"); assertEquals("FOOBUS22XXXX", m.getSender()); assertEquals("FOOBARXXAXXX", m.getReceiver()); /* @@ -342,7 +378,8 @@ public void testGetSenderReceiver() throws IOException { @Test public void testGetCategory() throws IOException { - SwiftMessage m = SwiftMessage.parse("{1:F01FOOBARXXAXXX0387241036}{2:O9502352060913YYYYUSYYYYYY18884819330609140052N}{4:\n:20:123456\n-}"); + SwiftMessage m = SwiftMessage.parse( + "{1:F01FOOBARXXAXXX0387241036}{2:O9502352060913YYYYUSYYYYYY18884819330609140052N}{4:\n:20:123456\n-}"); assertEquals(MtCategory._9, m.getCategory()); assertTrue(m.isCategory(MtCategory._9)); assertTrue(m.isCategory(MtCategory._0, MtCategory._1, MtCategory._3, MtCategory._9)); @@ -356,7 +393,8 @@ public void testCorrespondent() throws IOException { SwiftMessage m = SwiftMessage.parse("{1:F01FOOBARAAAXXX3219604112}{2:I535BBBBBBBXXXXXN}{4:\n:16R:GENL\n-}"); assertEquals(new BIC("BBBBBBBXXXXX"), m.getCorrespondentBIC()); - m = SwiftMessage.parse("{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); + m = SwiftMessage.parse( + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); assertEquals(new BIC("AAPBESMMAXXX"), m.getCorrespondentBIC()); } @@ -365,10 +403,12 @@ public void testUUMID() throws IOException { SwiftMessage m = SwiftMessage.parse("{1:F01FOOBARAAAXXX3219604112}{2:I535BBBBBBBXXXXXN}{4:\n:16R:GENL\n-}"); assertEquals("IBBBBBBBXXXX535", m.getUUID()); - m = SwiftMessage.parse("{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); + m = SwiftMessage.parse( + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); assertEquals("OAAPBESMMXXX103", m.getUUID()); - m = SwiftMessage.parse("{1:F01FOOBARXXAXXX8683497519}{2:O5411535051028ESPBESMMAXXX54237522470510281535N}{3:{113:ROMF}{108:0510280182794665}}{4:\n:16R:GENL\n:20C::SEME//K8N46BUK6XXXXXXXXXXXX\n-}"); + m = SwiftMessage.parse( + "{1:F01FOOBARXXAXXX8683497519}{2:O5411535051028ESPBESMMAXXX54237522470510281535N}{3:{113:ROMF}{108:0510280182794665}}{4:\n:16R:GENL\n:20C::SEME//K8N46BUK6XXXXXXXXXXXX\n-}"); assertEquals("OESPBESMMXXX541K8N46BUK6XXXXXXXXXXXX", m.getUUID()); } @@ -382,7 +422,8 @@ public void testUID() throws IOException { SwiftMessage m = SwiftMessage.parse("{1:F01FOOBARAAAXXX3219604112}{2:I535BBBBBBBXXXXXN}{4:\n:16R:GENL\n-}"); assertEquals("IBBBBBBBXXXX5351508270000001234", m.getUID(cal, 1234L)); - m = SwiftMessage.parse("{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); + m = SwiftMessage.parse( + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{4:\n:16R:GENL\n-}"); assertEquals("OAAPBESMMXXX1031508270000001234", m.getUID(cal, 1234L)); } @@ -459,5 +500,4 @@ public void testIsGpi() { assertFalse(new MT300().getSwiftMessage().isGpi()); assertFalse(new MT198().getSwiftMessage().isGpi()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageUtilsTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageUtilsTest.java index 74f4a560b..3df077064 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftMessageUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftMessageUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,6 @@ import com.prowidesoftware.swift.model.mt.mt5xx.MT540; import com.prowidesoftware.swift.model.mt.mt6xx.MT670; import com.prowidesoftware.swift.utils.Lib; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.math.BigDecimal; import java.text.ParseException; @@ -33,14 +31,14 @@ import java.util.Calendar; import java.util.List; import java.util.Map; +import org.junit.jupiter.api.Test; public class SwiftMessageUtilsTest { @Test public void testSplitByField15() { final SwiftMessage sm = new SwiftMessage(true); - sm.getBlock4().append(Field15B.emptyTag()) - .append(Field32A.emptyTag()); + sm.getBlock4().append(Field15B.emptyTag()).append(Field32A.emptyTag()); final Map map = SwiftMessageUtils.splitByField15(sm); assertNotNull(map); assertTrue(map.containsKey("B")); @@ -55,10 +53,8 @@ public void testSplitByField15LetterOption() { sm.getBlock4() .append(Field15A.emptyTag()) .append(Field33A.emptyTag()) - .append(Field15B.emptyTag()) .append(Field32A.emptyTag()) - .append(Field15B.emptyTag()) .append(Field32B.emptyTag()) .append(Field32B.emptyTag()); @@ -82,12 +78,9 @@ public void testSplitByField15LetterOptionIntercalado() { sm.getBlock4() .append(Field15A.emptyTag()) .append(Field33A.emptyTag()) - .append(Field15B.emptyTag()) - .append(Field15C.emptyTag()) .append(Field32A.emptyTag()) - .append(Field15B.emptyTag()) .append(Field32B.emptyTag()) .append(Field32B.emptyTag()); @@ -111,12 +104,9 @@ public void testSplitByField15LetterOptionPrimero() { sm.getBlock4() .append(Field15A.emptyTag()) .append(Field33A.emptyTag()) - .append(Field15B.emptyTag()) - .append(Field15C.emptyTag()) .append(Field32A.emptyTag()) - .append(Field15B.emptyTag()) .append(Field32B.emptyTag()) .append(Field32B.emptyTag()); @@ -128,7 +118,6 @@ public void testSplitByField15LetterOptionPrimero() { final SwiftTagListBlock list0 = Bs.get(0); assertNotNull(list0); assertEquals(2, list0.size()); - } @Test @@ -137,16 +126,12 @@ public void testSplitByField15LetterOptionUltimo() { sm.getBlock4() .append(Field15A.emptyTag()) .append(Field33A.emptyTag()) - .append(Field15B.emptyTag()) - .append(Field15C.emptyTag()) .append(Field32A.emptyTag()) - .append(Field15B.emptyTag()) .append(Field32B.emptyTag()) .append(Field32B.emptyTag()) - .append(Field15D.emptyTag()) .append(Field34B.emptyTag()) .append(Field34B.emptyTag()) @@ -160,13 +145,12 @@ public void testSplitByField15LetterOptionUltimo() { final SwiftTagListBlock list0 = Bs.get(0); assertNotNull(list0); assertEquals(5, list0.size()); - } @Test public void testCreateSubsequenceWithParentsB_502() { - SwiftTagListBlock o = SwiftMessageUtils.createSubsequenceWithParents(MT502.class, "B", - Field13A.emptyTag(), Field13B.emptyTag(), Field13C.emptyTag()); + SwiftTagListBlock o = SwiftMessageUtils.createSubsequenceWithParents( + MT502.class, "B", Field13A.emptyTag(), Field13B.emptyTag(), Field13C.emptyTag()); assertEquals(5, o.size()); } @@ -211,11 +195,7 @@ public void testCreateSubsequenceWithParentsB1b1() { public void testRemoveInnerSequences() { MT535 m = new MT535() .append(MT535.SequenceA.newInstance( - MT535.SequenceA1.newInstance( - Field13C.tag("foo1") - ).append(Field13C.tag("foo2")) - ) - ); + MT535.SequenceA1.newInstance(Field13C.tag("foo1")).append(Field13C.tag("foo2")))); SwiftTagListBlock sublist = SwiftMessageUtils.removeInnerSequences(m.getSequenceA()); assertEquals(3, sublist.size()); @@ -224,22 +204,22 @@ public void testRemoveInnerSequences() { @Test public void testCurrencyAmountFromMessage() throws IOException { - final String fin = "{1:F01CCRTIT2TX36A0000000000}{2:I101PPABPLPKXXXXN}{3:{108:YSGU193268223XXX}}{4:\n" + - ":20:4C2W0S0V8AM6X7OH\n" + - ":28D:00001/00001\n" + - ":50H:/PL66160011270003012399999999\n" + - "FOO\n" + - ":30:131119\n" + - ":21:ZCAR1HI1HF3STLJO\n" + - ":32B:PLN2044,10\n" + - ":59:/PL74175000090000000001905201\n" + - "POLONIA FOO HOTEL\n" + - "AL FOOLIMSKIE 45\n" + - "00-692\n" + - "PL WARSAWA\n" + - ":70:1/34530/13\n" + - ":71A:SHA\n" + - "-}"; + final String fin = "{1:F01CCRTIT2TX36A0000000000}{2:I101PPABPLPKXXXXN}{3:{108:YSGU193268223XXX}}{4:\n" + + ":20:4C2W0S0V8AM6X7OH\n" + + ":28D:00001/00001\n" + + ":50H:/PL66160011270003012399999999\n" + + "FOO\n" + + ":30:131119\n" + + ":21:ZCAR1HI1HF3STLJO\n" + + ":32B:PLN2044,10\n" + + ":59:/PL74175000090000000001905201\n" + + "POLONIA FOO HOTEL\n" + + "AL FOOLIMSKIE 45\n" + + "00-692\n" + + "PL WARSAWA\n" + + ":70:1/34530/13\n" + + ":71A:SHA\n" + + "-}"; Money money = SwiftMessageUtils.money(SwiftMessage.parse(fin)); assertNotNull(money); assertEquals("PLN", money.getCurrency()); @@ -248,9 +228,10 @@ public void testCurrencyAmountFromMessage() throws IOException { @Test public void testCurrencyAmountFromSystemMessage() throws IOException { - final String fin = "{1:F21BNPAFRPPZXXX0000000002}{4:{177:1702090741}{451:0}}{1:F01BNPAFRPPZXXX0000000002}{2:I103BNPAFRPPXXXXN}{3:{108:REF1}}{4:\n" + - ":20:WITHMUR\n" + - "-}{5:{MAC:ABCD1234}{CHK:ABCDEF123456}}"; + final String fin = + "{1:F21BNPAFRPPZXXX0000000002}{4:{177:1702090741}{451:0}}{1:F01BNPAFRPPZXXX0000000002}{2:I103BNPAFRPPXXXXN}{3:{108:REF1}}{4:\n" + + ":20:WITHMUR\n" + + "-}{5:{MAC:ABCD1234}{CHK:ABCDEF123456}}"; Money money = SwiftMessageUtils.money(SwiftMessage.parse(fin)); assertNull(money); } @@ -258,39 +239,39 @@ public void testCurrencyAmountFromSystemMessage() throws IOException { @Test public void testValueDate() throws IOException, ParseException { - //MT305 + // MT305 SwiftMessage sm = SwiftMessage.parse(Lib.readResource("MT305.fin")); Calendar date = SwiftMessageUtils.valueDate(sm); SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd"); assertEquals(date.getTime(), sdf.parse("201230")); - //MT306 + // MT306 sm = SwiftMessage.parse(Lib.readResource("MT306.fin")); date = SwiftMessageUtils.valueDate(sm); sdf = new SimpleDateFormat("yyyyMMdd"); assertEquals(date.getTime(), sdf.parse("20080609")); - //MT340 + // MT340 sm = SwiftMessage.parse(Lib.readResource("MT340.fin")); date = SwiftMessageUtils.valueDate(sm); assertEquals(date.getTime(), sdf.parse("20000715")); - //MT341 + // MT341 sm = SwiftMessage.parse(Lib.readResource("MT341.fin")); date = SwiftMessageUtils.valueDate(sm); assertEquals(date.getTime(), sdf.parse("20000715")); - //MT360 + // MT360 sm = SwiftMessage.parse(Lib.readResource("MT360.fin")); date = SwiftMessageUtils.valueDate(sm); assertEquals(date.getTime(), sdf.parse("20070209")); - //MT361 + // MT361 sm = SwiftMessage.parse(Lib.readResource("MT361.fin")); date = SwiftMessageUtils.valueDate(sm); assertEquals(date.getTime(), sdf.parse("19941214")); - //MT362 + // MT362 sm = SwiftMessage.parse(Lib.readResource("MT362.fin")); date = SwiftMessageUtils.valueDate(sm); assertEquals(date.getTime(), sdf.parse("20090106")); @@ -321,5 +302,4 @@ public void testReference() { mt3.append(Field20C.tag(":SEME//REF3")); assertEquals("REF3", SwiftMessageUtils.reference(mt3.getSwiftMessage())); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftTagListBlockTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftTagListBlockTest.java index a8f20a150..6d8d8ea4a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftTagListBlockTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftTagListBlockTest.java @@ -1,1827 +1,1827 @@ -/* - * Copyright 2006-2021 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; - -import static org.junit.jupiter.api.Assertions.*; - -import com.prowidesoftware.swift.io.ConversionService; -import com.prowidesoftware.swift.model.field.*; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class SwiftTagListBlockTest { - - private SwiftTagListBlock b; - private Tag t; - - @BeforeEach - public void setUp() { - this.b = new SwiftBlock3(); - this.t = new Tag("n:v"); - } - - @Test - public void testContainsTag() { - b.append(t); - assertTrue(b.containsTag("n")); - } - - @Test - public void testCountStartsWith() { - b.append(new Tag("1", "FOO")); - b.append(new Tag("1", "BAR")); - b.append(new Tag("1", "FOO2")); - b.append(new Tag("1", "FOO")); - - b.append(new Tag("2", "FOO")); - b.append(new Tag("2", "BAR")); - b.append(new Tag("2", "FOO2")); - b.append(new Tag("2", "FOO")); - - b.append(new Tag("1", "FOO")); - b.append(new Tag("1", "BAR")); - b.append(new Tag("1", "FOO2")); - b.append(new Tag("1", "FOO")); - - assertEquals(6, b.countTagsStarsWith("1", "FOO")); - assertEquals(2, b.countTagsStarsWith("1", "FOO2")); - } - - @Test - public void testContainsAll() { - b.append(t); - b.append(new Tag("1", "val")); - assertTrue(b.containsAllOf(t.getName(), "1")); - assertFalse(b.containsAllOf(t.getName(), "2")); - } - - @Test - public void testGetTagValue() { - b.append(t); - assertEquals("v", b.getTagValue("n")); - } - - @Test - public void testGetTagByName() { - b.append(t); - Tag found = b.getTagByName("n"); - assertEquals(t, found); - } - - @Test - public void testIsEmpty() { - assertTrue(b.isEmpty()); - b.append(t); - assertFalse(b.isEmpty()); - } - - @Test - public void testSize() { - assertEquals(0, b.size()); - b.append(t); - assertEquals(1, b.size()); - } - - @Test - public void testGetTagCount() { - assertEquals(0, b.countAll()); - b.append(t); - assertEquals(1, b.countAll()); - } - - @Test - public void testGetTagCountString() { - b.append(t); - b.append(t); - b.append(t); - assertEquals(3, b.countByName("n")); - } - - @Test - public void testGetTagValues() { - Tag t = new Tag("1:val1"); - b.append(t); - - String[] vals = b.getTagValues("foo"); - assertNotNull(vals); - assertEquals(0, vals.length); - } - - @Test - public void testGetTagMap() { - Map m = b.getTagMap(); - assertTrue(m.isEmpty()); - - b.append(t); - m = b.getTagMap(); - - assertEquals(1, m.size()); - assertTrue(m.containsKey("n")); - assertTrue(m.containsValue("v")); - } - - @Test - public void testRemoveTag() { - b.removeTag(""); - assertTrue(b.isEmpty()); - b.append(t); - assertFalse(b.isEmpty()); - b.removeTag("n"); - assertTrue(b.isEmpty()); - } - - @Test - public void testTagIterator() { - b.getTags().clear(); - Iterator it = b.tagIterator(); - assertFalse(it.hasNext()); - - b.append(t); - assertEquals(t, b.tagIterator().next()); - } - - @Test - public void testIsTagBlock() { - assertTrue(b.isTagBlock()); - } - - @Test - public void testGetTagValuesEmpty2() { - String[] vals = b.getTagValues("foo"); - assertNotNull(vals); - assertEquals(0, vals.length); - } - - @Test - public void testGetTagValues1() { - Tag t = new Tag("1:val1"); - b.append(t); - - String[] vals = b.getTagValues("1"); - assertNotNull(vals); - assertEquals(1, vals.length); - assertEquals("val1", vals[0]); - } - - @Test - public void testGetTagValues2() { - b.append(new Tag("1:val1")); - b.append(new Tag("1:val2")); - - String[] vals = b.getTagValues("1"); - assertNotNull(vals); - assertEquals(2, vals.length); - assertEquals("val1", vals[0]); - assertEquals("val2", vals[1]); - } - - @Test - public void testRemoveAll1() { - b.append(new Tag("1:val1")); - b.append(new Tag("1:val2")); - - int vals = b.removeAll("1"); - assertEquals(2, vals); - } - - @Test - public void testRemoveAll2() { - b.append(new Tag("a:val1")); - b.append(new Tag("1:val1")); - b.append(new Tag("b:val1")); - b.append(new Tag("1:val1")); - b.append(new Tag("c:val2")); - - int vals = b.removeAll("1"); - assertEquals(2, vals); - } - - @Test - public void testgetTagsByName() { - b.append(new Tag("a:val1")); - b.append(new Tag("1:val1")); - b.append(new Tag("b:val1")); - b.append(new Tag("1:val2")); - b.append(new Tag("c:val3")); - - Tag[] tags = b.getTagsByName("1"); - assertEquals(2, tags.length); - assertEquals("val1", tags[0].getValue()); - assertEquals("val2", tags[1].getValue()); - } - - @Test - public void testgetTagsByValue() { - b.append(new Tag("a:val1")); - b.append(new Tag("1:val1")); - b.append(new Tag("1:val2")); - b.append(new Tag("c:val3")); - b.append(new Tag("b:val1")); - List tags = b.getTagsByValue("val1"); - - assertEquals(3, tags.size()); - assertEquals("a", tags.get(0).getName()); - assertEquals("1", tags.get(1).getName()); - assertEquals("b", tags.get(2).getName()); - } - - @Test - public void testgetTagsByContent() { - b.append(new Tag("a:val1aaa")); - b.append(new Tag("1:dddval1")); - b.append(new Tag("1:val2")); - b.append(new Tag("c:val3")); - b.append(new Tag("b:ffval1gg")); - List tags = b.getTagsByContent("val1"); - - assertEquals(3, tags.size()); - assertEquals("a", tags.get(0).getName()); - assertEquals("1", tags.get(1).getName()); - assertEquals("b", tags.get(2).getName()); - } - - /** - * Normal test with starting and ending tag - */ - @Test - public void testgetSubBlock01() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), new Tag("4:val4")); - - assertEquals(3, sb.size()); - assertEquals("2", sb.getTag(0).getName()); - assertEquals("3", sb.getTag(1).getName()); - assertEquals("4", sb.getTag(2).getName()); - assertEquals("val2", sb.getTag(0).getValue()); - assertEquals("val3", sb.getTag(1).getValue()); - assertEquals("val4", sb.getTag(2).getValue()); - } - - /** - * Normal test with no ending tag - */ - @Test - public void testgetSubBlock02() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), null); - - assertEquals(4, sb.size()); - assertEquals("2", sb.getTag(0).getName()); - assertEquals("3", sb.getTag(1).getName()); - assertEquals("4", sb.getTag(2).getName()); - assertEquals("5", sb.getTag(3).getName()); - assertEquals("val2", sb.getTag(0).getValue()); - assertEquals("val3", sb.getTag(1).getValue()); - assertEquals("val4", sb.getTag(2).getValue()); - assertEquals("val5", sb.getTag(3).getValue()); - } - - /** - * Normal test using block names - */ - @Test - public void testgetSubBlock03() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:foo")); - b.append(new Tag("3:val3")); - b.append(new Tag("16S:foo")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock("foo"); - - assertEquals(3, sb.size()); - assertEquals("16R", sb.getTag(0).getName()); - assertEquals("3", sb.getTag(1).getName()); - assertEquals("16S", sb.getTag(2).getName()); - assertEquals("foo", sb.getTag(0).getValue()); - assertEquals("val3", sb.getTag(1).getValue()); - assertEquals("foo", sb.getTag(2).getValue()); - } - - /** - * Test using block name, with nested sub blocks - */ - @Test - public void testgetSubBlock04() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:foo")); - b.append(new Tag("3:val3")); - b.append(new Tag("16R:aaa")); - b.append(new Tag("3:val3")); - b.append(new Tag("16S:aaa")); - b.append(new Tag("16S:foo")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock("foo"); - - assertEquals(6, sb.size()); - - assertEquals("16R", sb.getTag(0).getName()); - assertEquals("foo", sb.getTag(0).getValue()); - - assertEquals("3", sb.getTag(1).getName()); - assertEquals("val3", sb.getTag(1).getValue()); - - assertEquals("16R", sb.getTag(2).getName()); - assertEquals("aaa", sb.getTag(2).getValue()); - - assertEquals("3", sb.getTag(3).getName()); - assertEquals("val3", sb.getTag(3).getValue()); - - assertEquals("16S", sb.getTag(4).getName()); - assertEquals("aaa", sb.getTag(4).getValue()); - - assertEquals("16S", sb.getTag(5).getName()); - assertEquals("foo", sb.getTag(5).getValue()); - } - - /** - * Ending tag precedes starting tag - */ - @Test - public void testgetSubBlock05() { - b.append(new Tag("1:val1")); - b.append(new Tag("4:val4")); - b.append(new Tag("3:val3")); - b.append(new Tag("2:val2")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), new Tag("4:val4")); - - assertEquals(2, sb.size()); - assertEquals("2", sb.getTag(0).getName()); - assertEquals("val2", sb.getTag(0).getValue()); - assertEquals("5", sb.getTag(1).getName()); - assertEquals("val5", sb.getTag(1).getValue()); - } - - /** - * Normal test with starting and ending tag and multiple sub blocks - */ - @Test - public void testgetSubBlock06() { - b.append(new Tag("99:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:end")); - b.append(new Tag("88:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("4:val4")); - b.append(new Tag("3:end")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks(new Tag("1:start"), new Tag("3:end")); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("1", sb.getTag(0).getName()); - assertEquals("start", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("3", sb.getTag(2).getName()); - assertEquals("end", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(3, sb2.size()); - assertEquals("1", sb2.getTag(0).getName()); - assertEquals("start", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("3", sb2.getTag(2).getName()); - assertEquals("end", sb2.getTag(2).getValue()); - } - - @Test - public void testSplit() { - b.append(new Tag("99:foo")); - - b.append(new Tag("1:start")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:end")); - b.append(new Tag("88:foo")); - - b.append(new Tag("1:start")); - b.append(new Tag("4:val4")); - b.append(new Tag("3:end")); - b.append(new Tag("77:foo")); - b.append(new Tag("77:foo")); - - List sbs = b.splitByTagName("1"); - - assertEquals(3, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(1, sb.size()); - assertEquals("99", sb.getTag(0).getName()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(4, sb2.size()); - - SwiftTagListBlock sb3 = sbs.get(2); - assertEquals(5, sb3.size()); - } - - @Test - public void testSplitByNonexisting() { - b.append(new Tag("99:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:end")); - b.append(new Tag("88:foo")); - - List sbs = b.splitByTagName("XX"); - - assertEquals(1, sbs.size()); - assertEquals(5, sbs.get(0).size()); - } - - /** - * Normal test using block name and multiple sub blocks - */ - @Test - public void testgetSubBlock07() { - b.append(new Tag("99:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("2:val2")); - b.append(new Tag("16S:blockname")); - b.append(new Tag("88:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("4:val4")); - b.append(new Tag("16S:blockname")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks("blockname"); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("16R", sb.getTag(0).getName()); - assertEquals("blockname", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("16S", sb.getTag(2).getName()); - assertEquals("blockname", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(3, sb2.size()); - assertEquals("16R", sb2.getTag(0).getName()); - assertEquals("blockname", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("16S", sb2.getTag(2).getName()); - assertEquals("blockname", sb2.getTag(2).getValue()); - } - - /** - * Test using block name and multiple sub blocks, with nested sub blocks - */ - @Test - public void testgetSubBlock08() { - b.append(new Tag("99:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("2:val2")); - b.append(new Tag("16S:blockname")); - b.append(new Tag("88:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("4:val4")); - b.append(new Tag("16R:foo")); - b.append(new Tag("66:foo")); - b.append(new Tag("16S:foo")); - b.append(new Tag("16S:blockname")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks("blockname"); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("16R", sb.getTag(0).getName()); - assertEquals("blockname", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("16S", sb.getTag(2).getName()); - assertEquals("blockname", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(6, sb2.size()); - assertEquals("16R", sb2.getTag(0).getName()); - assertEquals("blockname", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("16R", sb2.getTag(2).getName()); - assertEquals("foo", sb2.getTag(2).getValue()); - assertEquals("66", sb2.getTag(3).getName()); - assertEquals("foo", sb2.getTag(3).getValue()); - assertEquals("16S", sb2.getTag(4).getName()); - assertEquals("foo", sb2.getTag(4).getValue()); - assertEquals("16S", sb2.getTag(5).getName()); - assertEquals("blockname", sb2.getTag(5).getValue()); - } - - /** - * Test using block name and multiple sub blocks, with nested sub blocks and missing ending tag - */ - @Test - public void testgetSubBlock09() { - b.append(new Tag("99:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("2:val2")); - b.append(new Tag("16S:blockname")); - b.append(new Tag("88:foo")); - b.append(new Tag("16R:blockname")); - b.append(new Tag("4:val4")); - b.append(new Tag("16R:foo")); - b.append(new Tag("66:foo")); - b.append(new Tag("16S:foo")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks("blockname"); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("16R", sb.getTag(0).getName()); - assertEquals("blockname", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("16S", sb.getTag(2).getName()); - assertEquals("blockname", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(6, sb2.size()); - assertEquals("16R", sb2.getTag(0).getName()); - assertEquals("blockname", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("16R", sb2.getTag(2).getName()); - assertEquals("foo", sb2.getTag(2).getValue()); - assertEquals("66", sb2.getTag(3).getName()); - assertEquals("foo", sb2.getTag(3).getValue()); - assertEquals("16S", sb2.getTag(4).getName()); - assertEquals("foo", sb2.getTag(4).getValue()); - assertEquals("77", sb2.getTag(5).getName()); - assertEquals("foo", sb2.getTag(5).getValue()); - } - - /** - * Normal test with starting and ending tag names and multiple sub blocks - */ - @Test - public void testgetSubBlock10() { - b.append(new Tag("99:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:end")); - b.append(new Tag("88:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("4:val4")); - b.append(new Tag("3:end")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks("1", "3"); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("1", sb.getTag(0).getName()); - assertEquals("start", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("3", sb.getTag(2).getName()); - assertEquals("end", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(3, sb2.size()); - assertEquals("1", sb2.getTag(0).getName()); - assertEquals("start", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("3", sb2.getTag(2).getName()); - assertEquals("end", sb2.getTag(2).getValue()); - } - - /** - * Normal test with starting and ending tag names and multiple sub blocks - * using tag number for end boundary (regardless of letter option) - */ - @Test - public void testgetSubBlock10b() { - b.append(new Tag("99:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("2:val2")); - b.append(new Tag("3A:end")); - b.append(new Tag("88:foo")); - b.append(new Tag("1:start")); - b.append(new Tag("4:val4")); - b.append(new Tag("3B:end")); - b.append(new Tag("77:foo")); - - List sbs = b.getSubBlocks("1", 3); - - assertEquals(2, sbs.size()); - - SwiftTagListBlock sb = sbs.get(0); - assertEquals(3, sb.size()); - assertEquals("1", sb.getTag(0).getName()); - assertEquals("start", sb.getTag(0).getValue()); - assertEquals("2", sb.getTag(1).getName()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("3A", sb.getTag(2).getName()); - assertEquals("end", sb.getTag(2).getValue()); - - SwiftTagListBlock sb2 = sbs.get(1); - assertEquals(3, sb2.size()); - assertEquals("1", sb2.getTag(0).getName()); - assertEquals("start", sb2.getTag(0).getValue()); - assertEquals("4", sb2.getTag(1).getName()); - assertEquals("val4", sb2.getTag(1).getValue()); - assertEquals("3B", sb2.getTag(2).getName()); - assertEquals("end", sb2.getTag(2).getValue()); - } - - /** - * Not found - */ - @Test - public void testgetSubBlock11() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - - SwiftTagListBlock sb = b.getSubBlock(new Tag("7:val7"), new Tag("8:val8")); - - assertEquals(0, sb.size()); - } - - /** - * Not found - */ - @Test - public void testContainTag() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - assertTrue(b.containsTag(new Tag("4:val4"))); - assertFalse(b.containsTag(new Tag("4:foo"))); - assertFalse(b.containsTag(new Tag("foo:val4"))); - } - - @Test - public void testContainsField() { - b.append(new Tag("21E:")); - b.append(new Tag("50B:")); - assertTrue(b.containsField("50B")); - assertTrue(b.containsField("50a")); - assertTrue(b.containsField("21E")); - assertTrue(b.containsField("21a")); - } - - @Test - public void testFieldsByNameEmptyResult() { - // empty result - b.append(new Tag("1", "foo")); - Field[] fieldsByName = b.getFieldsByName("2"); - assertEquals(0, fieldsByName.length); - - // empty result with empty set - Field[] o = new SwiftTagListBlock().getFieldsByName(""); - assertEquals(0, o.length); - - o = new SwiftTagListBlock().getFieldsByName("1"); - assertEquals(0, o.length); - } - - @Test - public void testFieldsByNameWildcards() { - b.append(new Tag("95C", "foo")); - Field[] fieldsByName = b.getFieldsByName("95a"); - assertEquals(1, fieldsByName.length); - - b.append(new Tag("93", "bar")); - fieldsByName = b.getFieldsByName("95a"); - assertEquals(1, fieldsByName.length); - - b.append(new Tag("95C", "foo2")); - fieldsByName = b.getFieldsByName("95a"); - assertEquals(2, fieldsByName.length); - } - - @Test - public void testFieldsByNameBeing() { - b.append(new Tag("95C", "foo")); - assertEquals(1, b.getFieldsByName("95a", "foo").size()); - - b.append(new Tag("93", "bar")); - assertEquals(1, b.getFieldsByName("95a", "foo").size()); - - b.append(new Tag("95C", "foo")); - b.append(new Tag("95C", "foo2")); - b.append(new Tag("95C", "foo2")); - b.append(new Tag("95C", "foo2")); - assertEquals(2, b.getFieldsByName("95a", "foo").size()); - assertEquals(3, b.getFieldsByName("95a", "foo2").size()); - } - - @Test - public void testTagsByNameBeing() { - b.append(new Tag("95C", "foo")); - assertEquals(1, b.getTagsByName("95a", "foo").size()); - - b.append(new Tag("93", "bar")); - assertEquals(1, b.getTagsByName("95a", "foo").size()); - - b.append(new Tag("95C", "foo")); - b.append(new Tag("95C", "foo2")); - b.append(new Tag("95C", "foo2")); - b.append(new Tag("95C", "foo2")); - assertEquals(2, b.getTagsByName("95a", "foo").size()); - assertEquals(3, b.getTagsByName("95a", "foo2").size()); - } - - @Test - public void testGetTagIndex() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - - assertEquals(0, (int) b.getTagIndex("1", null)); - assertEquals(2, (int) b.getTagIndex("3", new String[]{"A", "B", "K"})); - assertEquals(3, (int) b.getTagIndex("4", new String[]{"A", "B", "K", ""})); - } - - @Test - public void testGetSubBlockAfterFirst() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("2", true); - assertEquals(4, sb.size()); - assertEquals("val2", sb.getTag(0).getValue()); - assertEquals("val5", sb.getTag(3).getValue()); - } - - @Test - public void testGetSubBlockAfterFirst2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("3K", true); - assertEquals(3, sb.size()); - assertEquals("val3", sb.getTag(0).getValue()); - assertEquals("val5", sb.getTag(2).getValue()); - } - - @Test - public void testGetSubBlockAfterFirst3() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("3K", false); - assertEquals(5, sb.size()); - assertEquals("val4", sb.getTag(0).getValue()); - assertEquals("val8", sb.getTag(4).getValue()); - } - - @Test - public void testGetSubBlockAfterFirstLimit() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("8", false); - assertEquals(0, sb.size()); - } - - @Test - public void testGetSubBlockAfterFirstLimit2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("1", false); - assertEquals(7, sb.size()); - } - - @Test - public void testGetSubBlockAfterFirstNotFound() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst("99", false); - assertEquals(0, sb.size()); - } - - @Test - public void testGetSubBlockAfterFirstTag() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockAfterFirst(new Tag("3K:val3"), false); - assertEquals(5, sb.size()); - assertEquals("val4", sb.getTag(0).getValue()); - assertEquals("val8", sb.getTag(4).getValue()); - } - - @Test - public void testGetSubBlockBeforeFirst() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("2", false); - assertEquals(1, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - } - - @Test - public void testGetSubBlockBeforeLast() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("2:val2")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockBeforeLast("2", false); - assertEquals(3, sb.size()); - assertEquals("val3", sb.getTag(2).getValue()); - - sb = b.getSubBlockBeforeLast("2", true); - assertEquals(4, sb.size()); - assertEquals("val2", sb.getTag(3).getValue()); - } - - @Test - public void testIndexOfLast() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("2:val2")); - b.append(new Tag("5:val5")); - - assertEquals(3, b.indexOfLast("2")); - - assertEquals(0, b.indexOfLast("1")); - - assertEquals(4, b.indexOfLast("5")); - } - - @Test - public void testGetSubBlockAfterLast() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("2:val2")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockAfterLast("2", false); - assertEquals(1, sb.size()); - assertEquals("val5", sb.getTag(0).getValue()); - - sb = b.getSubBlockAfterLast("2", true); - assertEquals(2, sb.size()); - assertEquals("val5", sb.getTag(1).getValue()); - } - - @Test - public void testGetSubBlockBeforeFirst2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("2", true); - assertEquals(2, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - } - - @Test - public void testGetSubBlockBeforeFirst3() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("3K", true); - assertEquals(3, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("val3", sb.getTag(2).getValue()); - } - - @Test - public void testGetSubBlockBeforeFirstFirst2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("3K", false); - assertEquals(2, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - } - - @Test - public void testGetSubBlockBeforeFirstLimit() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("1", false); - assertEquals(0, sb.size()); - } - - @Test - public void testGetSubBlockBeforeFirstLimit2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("8", false); - assertEquals(7, sb.size()); - } - - @Test - public void testGetSubBlockBeforeFirstNotFound() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.getSubBlockBeforeFirst("99", false); - assertEquals(8, sb.size()); - } - - @Test - public void testRemove() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - String sb = b.removeTag("3K"); - assertEquals("val3", sb); - assertEquals(4, b.size()); - } - - /** - * Test for subblocks API with real case message - */ - @Test - public void testGetSubBlockMT564() { - final String msg = "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//D455103\n" + - ":20C::SEME//029206016\n" + - ":23G:NEWM\n" + - ":22F::CAEV//DVCA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20070316143348\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN CH0011075394\n" + - "/XX/5983816\n" + - "ZURICH FIN SVS GRP\n" + - "CHF0.10\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//760043140\n" + - ":94F::SAFE//CUST/UBSWCHZH80A\n" + - ":93B::ELIG//UNIT/7000,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - ":16R:CADETL\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::WITF//35,\n" + - ":92A::GRSS//0,000001000\n" + - ":16S:CADETL\n" + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":11A::OPTN//CHF\n" + - ":17B::DFLT//Y\n" + - ":98A::XDTE//20111111\n" + - ":98A::PAYD//20111111\n" + - ":98A::RDTE//20111111\n" + - ":92A::GRSS//0,000001000\n" + - ":16R:CASHMOVE\n" + - ":22H::CRDB//CRED\n" + - ":19B::ENTL//CHF0,01\n" + - ":19B::GRSS//CHF0,01\n" + - ":19B::NETT//CHF0,01\n" + - ":98A::PAYD//20111111\n" + - ":98A::VALU//20111111\n" + - ":16S:CASHMOVE\n" + - ":16S:CAOPTN\n" + - "-}"; - //parse text message into SWIFT message object - SwiftMessage o = new ConversionService().getMessageFromFIN(msg); - List sequencesB2 = o.getBlock4().getSubBlocks("ACCTINFO"); - List sequencesC = o.getBlock4().getSubBlocks("INTSEC"); - - for (SwiftTagListBlock seq : sequencesB2) { - Field[] fields = seq.getFieldsByName("93B"); - assertEquals(1, fields.length); - Field93B f = (Field93B) fields[0]; - assertEquals(":ELIG//UNIT/7000,", f.getValue()); - } - - assertTrue(sequencesC.isEmpty()); - } - - @Test - public void testFilterByName() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.filterByName(true, "1", "4", "7"); - assertEquals(3, sb.size()); - assertEquals("val7", sb.getTag(2).getValue()); - sb = b.filterByName(false, "1", "4", "7"); - assertEquals(5, sb.size()); - } - - @Test - public void testFilterByName2() { - SwiftTagListBlock sb = b.filterByName(true, "1", "4", "7"); - assertEquals(0, sb.size()); - - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - - sb = b.filterByName(false); - assertEquals(8, sb.size()); - } - - @Test - public void testFilterByNameOrdered() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("3K:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - SwiftTagListBlock sb = b.filterByNameOrdered("1", "2", "4"); - assertEquals(2, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - } - - @Test - public void testGetOptionalList() { - - b.append(new Tag("1:val1")); // entra, en primera fila de permitidos - b.append(new Tag("2:val2")); // entra en la tercera - b.append(new Tag("3:val3")); // no entra, de la tercera ya se consumui el priero, y de cada fila se acepta uno - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - b.append(new Tag("6:val6")); - b.append(new Tag("7:val7")); - b.append(new Tag("8:val8")); - - SwiftTagListBlock result = b.getOptionalList(new String[][]{{"1a", "1b", "1"}, {"2e", "2c"}, {"2", "3"}}); - - assertEquals(2, result.size()); - assertEquals("val1", result.getTag(0).getValue()); - assertEquals("val2", result.getTag(1).getValue()); - } - - @Test - public void testGetOptionalLists() { - appends(b, 1, 8); - appends(b, 1, 8); - - List result = b.getOptionalLists(new String[][]{{"1a", "1b", "1"}, {"2e", "2c"}, {"2", "3"}}); - - assertNotNull(result); - assertEquals(2, result.size()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail() { - appends(b, 1, 8); - - String[] start = {"1"}; - String[] end = {"5c", "5b", "5"}; - String[] tail = {}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - assertEquals(result.getTag(0).getValue(), "val1"); - assertEquals(result.getTag(1).getValue(), "val2"); - assertEquals(result.getTag(2).getValue(), "val3"); - assertEquals(result.getTag(3).getValue(), "val4"); - assertEquals(result.getTag(4).getValue(), "val5"); - assertEquals(5, result.size(), "" + result.tagNamesList()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail_02() { - appends(b, 1, 9); - - String[] start = {"1"}; - String[] end = {"3"}; - String[] tail = {"6", "7"}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - - assertNotNull(result); - assertEquals(result.getTag(0).getValue(), "val1"); - assertEquals(result.getTag(1).getValue(), "val2"); - assertEquals(result.getTag(2).getValue(), "val3"); - assertEquals(3, result.size(), "returned: " + result.tagNamesList()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail_03() { - appends(b, 1, 4); - - String[] start = {"1"}; - String[] end = {"2"}; - String[] tail = {"3", "4"}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - - assertNotNull(result); - assertEquals(result.getTag(0).getValue(), "val1"); - assertEquals(result.getTag(1).getValue(), "val2"); - assertEquals(result.getTag(2).getValue(), "val3"); - assertEquals(result.getTag(3).getValue(), "val4"); - assertEquals(4, result.size()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail_04() { - appends(b, 1, 8); - - String[] start = {"3"}; - String[] end = {"5c", "5b", "5"}; - String[] tail = {}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - assertEquals(result.getTag(0).getValue(), "val3"); - assertEquals(result.getTag(1).getValue(), "val4"); - assertEquals(result.getTag(2).getValue(), "val5"); - assertEquals(3, result.size(), "" + result.tagNamesList()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail_05() { - appends(b, 1, 8); - - String[] start = {"3"}; - String[] end = {"5c", "5b", "5"}; - String[] tail = {"6", "7"}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - assertEquals(result.getTag(0).getValue(), "val3"); - assertEquals(result.getTag(1).getValue(), "val4"); - assertEquals(result.getTag(2).getValue(), "val5"); - assertEquals(result.getTag(3).getValue(), "val6"); - assertEquals(result.getTag(4).getValue(), "val7"); - assertEquals(5, result.size(), "" + result.tagNamesList()); - } - - @Test - public void testGetSubBlockDelimitedWithOptionalTail_06() { - appends(b, 1, 9); - - String[] start = {"2"}; - String[] end = {"4"}; - String[] tail = {"6", "7"}; - SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); - - assertNotNull(result); - assertEquals(result.getTag(0).getValue(), "val2"); - assertEquals(result.getTag(1).getValue(), "val3"); - assertEquals(result.getTag(2).getValue(), "val4"); - assertEquals(3, result.size(), "returned: " + result.tagNamesList()); - } - - @Test - public void testGetSubBlocksDelimitedWithOptionalTail() { - appends(b, 1, 8); - appends(b, 1, 8); - - String[] start = {"1"}; - String[] end = {"5c", "5b", "5"}; - String[] tail = {}; - List result = b.getSubBlocksDelimitedWithOptionalTail(start, end, tail); - - assertEquals(2, result.size()); - assertEquals(5, result.get(0).size()); - assertEquals(5, result.get(1).size()); - - tail = new String[]{"6a", "6"}; - result = b.getSubBlocksDelimitedWithOptionalTail(start, end, tail); - assertEquals(2, result.size()); - assertEquals(6, result.get(0).size()); - assertEquals(6, result.get(1).size()); - } - - /* - * The getSubBlock includes the starting element in the result but excludes the ending one - */ - @Test - public void testGetSubBlock() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("2:val2")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.getSubBlock(1, 2); - assertEquals(1, sb.size()); - assertEquals("val2", sb.getTag(0).getValue()); - - sb = b.getSubBlock(1, 1 + 4); - assertEquals(4, sb.size()); - assertEquals("val3", sb.getTag(1).getValue()); - - sb = b.getSubBlock(null, 1); - assertEquals(1, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - - sb = b.getSubBlock(4, null); - assertEquals(1, sb.size()); - assertEquals("val5", sb.getTag(0).getValue()); - - sb = b.getSubBlock(0, 100); - assertEquals(5, sb.size()); - } - - /* - * The sublist method includes both the starting and ending elements in the result - */ - @Test - public void testSublist() { - appends(b, 1, 10); - - SwiftTagListBlock sl = b.sublist(0, 1); - assertEquals(2, sl.size()); - - sl = b.sublist(null, null); - assertEquals(b.size(), sl.size()); - } - - private void appends(SwiftTagListBlock block, int from, int to) { - for (int i = from; i <= to; i++) { - block.append(new Tag("" + i, "val" + i)); - } - } - - @Test - public void testRemoveSubBlock() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:val4")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(5, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("val3", sb.getTag(2).getValue()); - assertEquals("val4", sb.getTag(3).getValue()); - assertEquals("val5", sb.getTag(4).getValue()); - } - - @Test - public void testRemoveSubBlock_2() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3K:val3")); - b.append(new Tag("16S:TEST")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(5, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val2", sb.getTag(1).getValue()); - assertEquals("val3", sb.getTag(2).getValue()); - assertEquals("TEST", sb.getTag(3).getValue()); - assertEquals("val5", sb.getTag(4).getValue()); - } - - @Test - public void testRemoveSubBlock_3() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:HELLO")); - b.append(new Tag("3K:val3")); - b.append(new Tag("16S:TEST")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(5, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("HELLO", sb.getTag(1).getValue()); - assertEquals("val3", sb.getTag(2).getValue()); - assertEquals("TEST", sb.getTag(3).getValue()); - assertEquals("val5", sb.getTag(4).getValue()); - } - - @Test - public void testRemoveSubBlock_4() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:TEST")); - b.append(new Tag("3K:val3")); - b.append(new Tag("16S:TEST")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(2, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - assertEquals("val5", sb.getTag(1).getValue()); - } - - @Test - public void testRemoveSubBlock_5() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:TEST")); - b.append(new Tag("3K:val3")); - b.append(new Tag("16S:FOO")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(1, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - } - - @Test - public void testRemoveSubBlock_6() { - b.append(new Tag("1:val1")); - b.append(new Tag("16R:TEST")); - b.append(new Tag("3K:val3")); - b.append(new Tag("4:FOO")); - b.append(new Tag("5:val5")); - SwiftTagListBlock sb = b.removeSubBlock("TEST"); - assertEquals(1, sb.size()); - assertEquals("val1", sb.getTag(0).getValue()); - } - - /* - * https://github.com/prowide/prowide-core/issues/13 - */ - @Test - public void testRemoveSubBlock_7() { - b.append(Field20.tag("before")); - - // first sub-block - b.append(Field16R.tag("SUBBAL")); - b.append(Field20.tag("first block")); - b.append(Field16S.tag("SUBBAL")); - // second sub-block - b.append(Field16R.tag("SUBBAL")); - b.append(Field20.tag("second block")); - b.append(Field16S.tag("SUBBAL")); - - b.append(Field20.tag("after")); - - SwiftTagListBlock sb = b.removeSubBlock("SUBBAL"); - assertEquals("before", sb.getTag(0).getValue()); - assertEquals("SUBBAL", sb.getTag(1).getValue()); - assertEquals("second block", sb.getTag(2).getValue()); - assertEquals("SUBBAL", sb.getTag(3).getValue()); - assertEquals("after", sb.getTag(4).getValue()); - assertEquals(5, sb.size()); - } - - /* - * https://github.com/prowide/prowide-core/issues/13 - */ - @Test - public void testRemoveSubBlocks() { - b.append(Field20.tag("before")); - - // first sub-block - b.append(Field16R.tag("SUBBAL")); - b.append(Field20.tag("first block")); - b.append(Field16S.tag("SUBBAL")); - // second sub-block - b.append(Field16R.tag("SUBBAL")); - b.append(Field20.tag("second block")); - b.append(Field16S.tag("SUBBAL")); - - b.append(Field20.tag("after")); - - // remove all subblocks - SwiftTagListBlock sb = b.removeSubBlocks("SUBBAL"); - assertEquals("before", sb.getTag(0).getValue()); - assertEquals("after", sb.getTag(1).getValue()); - assertEquals(2, sb.size()); - } - - @Test - public void testEmptyArrayReturn() { - Field[] arr = new SwiftTagListBlock().getFieldsByName("nn"); - assertNotNull(arr); - assertEquals(0, arr.length); - } - - @Test - public void testGetFieldByName19A() { - b.append(Field19A.tag(":SETT")); - assertNotNull(b.getFieldByName(Field19A.NAME, "SETT")); - } - - /** - * @since 7.8.5 - */ - @Test - public void testGetSubBlockByTagNames() { - /* - * empty search and empty block - */ - SwiftTagListBlock result = b.getSubBlockByTagNames(0); - assertNotNull(result); - assertTrue(result.isEmpty()); - - appends(b, 1, 9); - - /* - * filled block, empty search - */ - result = b.getSubBlockByTagNames(0); - assertNotNull(result); - assertTrue(result.isEmpty()); - - /* - * single match on first tag - */ - result = b.getSubBlockByTagNames(0, "1"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals("1", result.getTag(0).getName()); - - /* - * single match on second tag - */ - result = b.getSubBlockByTagNames(0, "2"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals("2", result.getTag(0).getName()); - - /* - * the same with index above match - */ - result = b.getSubBlockByTagNames(8, "2"); - assertNotNull(result); - assertTrue(result.isEmpty()); - - /* - * same with index before match - */ - result = b.getSubBlockByTagNames(1, "2"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals("2", result.getTag(0).getName()); - - /* - * double match on consecutive tags - */ - result = b.getSubBlockByTagNames(0, "2", "3"); - assertNotNull(result); - assertEquals(2, result.size()); - assertEquals("2", result.getTag(0).getName()); - assertEquals("3", result.getTag(1).getName()); - - /* - * double match on non-consecutive tags - */ - result = b.getSubBlockByTagNames(0, "2", "5"); - assertNotNull(result); - assertEquals(2, result.size()); - assertEquals("2", result.getTag(0).getName()); - assertEquals("5", result.getTag(1).getName()); - - /* - * single match because unordered search tags - */ - result = b.getSubBlockByTagNames(0, "5", "2"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals("2", result.getTag(0).getName()); - } - - /** - * @since 7.8.5 - */ - @Test - public void testGetSubBlockByTagNames_repetition() { - b.append(new Tag("1", "1")); - b.append(new Tag("2", "2")); - b.append(new Tag("2", "2")); - b.append(new Tag("2", "2")); - b.append(new Tag("3", "3")); - b.append(new Tag("4", "4")); - - /* - * simple case with repetition on block - */ - SwiftTagListBlock result = b.getSubBlockByTagNames(0, "2"); - assertNotNull(result); - assertEquals(3, result.size()); - assertEquals("2", result.getTag(0).getName()); - assertEquals("2", result.getTag(1).getName()); - assertEquals("2", result.getTag(2).getName()); - - /* - * same as above with other unmatched tags - */ - result = b.getSubBlockByTagNames(0, "foo", "2", "99"); - assertNotNull(result); - assertEquals(3, result.size()); - assertEquals("2", result.getTag(0).getName()); - assertEquals("2", result.getTag(1).getName()); - assertEquals("2", result.getTag(2).getName()); - - /* - * repetition on search tags does not produce any difference - */ - result = b.getSubBlockByTagNames(0, "2", "2", "2"); - assertNotNull(result); - assertEquals(3, result.size()); - assertEquals("2", result.getTag(0).getName()); - assertEquals("2", result.getTag(1).getName()); - assertEquals("2", result.getTag(2).getName()); - } - - /** - * similar to {@link #testGetSubBlockByTagNames()} but getting - * multiple block instances - * - * @since 7.8.5 - */ - @Test - public void testGetSubBlocksByTagNames() { - /* - * empty search and empty block - */ - List result = b.getSubBlocksByTagNames(0); - assertNotNull(result); - assertTrue(result.isEmpty()); - - appends(b, 1, 9); - - /* - * filled block, empty search - */ - result = b.getSubBlocksByTagNames(0); - assertNotNull(result); - assertTrue(result.isEmpty()); - - /* - * single match on first tag - */ - result = b.getSubBlocksByTagNames(0, "1"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(1, result.get(0).size()); - assertEquals("1", result.get(0).getTag(0).getName()); - - /* - * single match on second tag - */ - result = b.getSubBlocksByTagNames(0, "2"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(1, result.get(0).size()); - assertEquals("2", result.get(0).getTag(0).getName()); - - /* - * the same with index above match - */ - result = b.getSubBlocksByTagNames(8, "2"); - assertNotNull(result); - assertTrue(result.isEmpty()); - - /* - * same with index before match - */ - result = b.getSubBlocksByTagNames(1, "2"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(1, result.get(0).size()); - assertEquals("2", result.get(0).getTag(0).getName()); - - /* - * double match on consecutive tags - */ - result = b.getSubBlocksByTagNames(0, "2", "3"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(2, result.get(0).size()); - assertEquals("2", result.get(0).getTag(0).getName()); - assertEquals("3", result.get(0).getTag(1).getName()); - - /* - * double match on non-consecutive tags - */ - result = b.getSubBlocksByTagNames(0, "2", "5"); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(2, result.get(0).size()); - assertEquals("2", result.get(0).getTag(0).getName()); - assertEquals("5", result.get(0).getTag(1).getName()); - - /* - * single match because unordered search tags - */ - result = b.getSubBlocksByTagNames(0, "5", "2"); - assertNotNull(result); - assertEquals(2, result.size()); - //first pass will find 2 - assertEquals(1, result.get(0).size()); - assertEquals("2", result.get(0).getTag(0).getName()); - //second pass will find 5 - assertEquals(1, result.get(1).size()); - assertEquals("5", result.get(1).getTag(0).getName()); - } - - @Test - public void testAdd_1() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - - b.addTag(2, new Tag("4:val4")); - - assertEquals(4, b.getTags().size()); - assertEquals("val1", b.getTag(0).getValue()); - assertEquals("val2", b.getTag(1).getValue()); - assertEquals("val4", b.getTag(2).getValue()); - assertEquals("val3", b.getTag(3).getValue()); - - assertEquals(2, (int) b.getTagIndex("4", null)); - assertEquals(3, (int) b.getTagIndex("3", null)); - } - - @Test - public void testAdd_2() { - b.addTag(0, new Tag("1:val1")); - b.addTag(1, new Tag("2:val2")); - b.addTag(2, new Tag("3:val3")); - - assertEquals(3, b.getTags().size()); - assertEquals("val1", b.getTag(0).getValue()); - assertEquals("val2", b.getTag(1).getValue()); - assertEquals("val3", b.getTag(2).getValue()); - } - - @Test - public void testAdd_3() { - Assertions.assertThrows(IndexOutOfBoundsException.class, () -> b.addTag(1, new Tag("1:val1"))); - } - - @Test - public void testSet() { - b.append(new Tag("1:val1")); - b.append(new Tag("2:val2")); - b.append(new Tag("3:val3")); - b.setTag(2, new Tag("15", "15")); - assertEquals(2, (int) b.getTagIndex("15", null)); - assertNull(b.getTagIndex("3", null)); - } - - @Test - public void testFieldByQualifiers() { - // conditional qualifier is component 3 - b.append(new Tag("22F", ":AAAA//BBBB")); - assertNotNull(b.getFieldByQualifiers("22F", "AAAA", "BBBB")); - - // DSS is ignored - b.append(new Tag("22F", ":AAAA/DSS/CCCC")); - assertNotNull(b.getFieldByQualifiers("22F", "AAAA", "CCCC")); - - // conditional qualifier is component 2 - b.append(new Tag("12C", ":AAAA//BBBB")); - assertNotNull(b.getFieldByQualifiers("12C", "AAAA", "BBBB")); - - // not generic field - b.append(new Tag("22K", "AAAA/BBBB")); - assertNull(b.getFieldByQualifiers("22K", "AAAA", "BBBB")); - } - - @Test - public void testSplitByTagName() { - b.append(new Tag("20:foo")); - b.append(new Tag("21:foo")); - assertTrue(b.splitByTagName(22, null).isEmpty()); - assertTrue(b.splitByTagName(22, "L").isEmpty()); - - b.append(new Tag("22L:foo")); - assertTrue(b.splitByTagName(22, "M").isEmpty()); - assertEquals(1, b.splitByTagName(22, null).size()); - assertEquals(1, b.splitByTagName(22, "L").size()); - - b.append(new Tag("32A:foo")); - b.append(new Tag("22L:foo")); - assertEquals(2, b.splitByTagName(22, null).size()); - assertEquals(2, b.splitByTagName(22, "L").size()); - - b.append(new Tag("22M:foo")); - b.append(new Tag("95P:foo")); - assertEquals(3, b.splitByTagName(22, null).size()); - assertEquals(2, b.splitByTagName(22, "L").size()); - - List list1 = b.splitByTagName(22, null); - assertEquals("22L", list1.get(0).getTag(0).getName()); - assertEquals("32A", list1.get(0).getTag(1).getName()); - assertEquals("22L", list1.get(1).getTag(0).getName()); - assertEquals("22M", list1.get(2).getTag(0).getName()); - assertEquals("95P", list1.get(2).getTag(1).getName()); - - List list2 = b.splitByTagName(22, "L"); - assertEquals("22L", list2.get(0).getTag(0).getName()); - assertEquals("32A", list2.get(0).getTag(1).getName()); - assertEquals("22L", list2.get(1).getTag(0).getName()); - assertEquals("22M", list2.get(1).getTag(1).getName()); - assertEquals("95P", list2.get(1).getTag(2).getName()); - } - -} \ No newline at end of file +/* + * Copyright 2006-2023 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; + +import static org.junit.jupiter.api.Assertions.*; + +import com.prowidesoftware.swift.io.ConversionService; +import com.prowidesoftware.swift.model.field.*; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class SwiftTagListBlockTest { + + private SwiftTagListBlock b; + private Tag t; + + @BeforeEach + public void setUp() { + this.b = new SwiftBlock3(); + this.t = new Tag("n:v"); + } + + @Test + public void testContainsTag() { + b.append(t); + assertTrue(b.containsTag("n")); + } + + @Test + public void testCountStartsWith() { + b.append(new Tag("1", "FOO")); + b.append(new Tag("1", "BAR")); + b.append(new Tag("1", "FOO2")); + b.append(new Tag("1", "FOO")); + + b.append(new Tag("2", "FOO")); + b.append(new Tag("2", "BAR")); + b.append(new Tag("2", "FOO2")); + b.append(new Tag("2", "FOO")); + + b.append(new Tag("1", "FOO")); + b.append(new Tag("1", "BAR")); + b.append(new Tag("1", "FOO2")); + b.append(new Tag("1", "FOO")); + + assertEquals(6, b.countTagsStarsWith("1", "FOO")); + assertEquals(2, b.countTagsStarsWith("1", "FOO2")); + } + + @Test + public void testContainsAll() { + b.append(t); + b.append(new Tag("1", "val")); + assertTrue(b.containsAllOf(t.getName(), "1")); + assertFalse(b.containsAllOf(t.getName(), "2")); + } + + @Test + public void testGetTagValue() { + b.append(t); + assertEquals("v", b.getTagValue("n")); + } + + @Test + public void testGetTagByName() { + b.append(t); + Tag found = b.getTagByName("n"); + assertEquals(t, found); + } + + @Test + public void testIsEmpty() { + assertTrue(b.isEmpty()); + b.append(t); + assertFalse(b.isEmpty()); + } + + @Test + public void testSize() { + assertEquals(0, b.size()); + b.append(t); + assertEquals(1, b.size()); + } + + @Test + public void testGetTagCount() { + assertEquals(0, b.countAll()); + b.append(t); + assertEquals(1, b.countAll()); + } + + @Test + public void testGetTagCountString() { + b.append(t); + b.append(t); + b.append(t); + assertEquals(3, b.countByName("n")); + } + + @Test + public void testGetTagValues() { + Tag t = new Tag("1:val1"); + b.append(t); + + String[] vals = b.getTagValues("foo"); + assertNotNull(vals); + assertEquals(0, vals.length); + } + + @Test + public void testGetTagMap() { + Map m = b.getTagMap(); + assertTrue(m.isEmpty()); + + b.append(t); + m = b.getTagMap(); + + assertEquals(1, m.size()); + assertTrue(m.containsKey("n")); + assertTrue(m.containsValue("v")); + } + + @Test + public void testRemoveTag() { + b.removeTag(""); + assertTrue(b.isEmpty()); + b.append(t); + assertFalse(b.isEmpty()); + b.removeTag("n"); + assertTrue(b.isEmpty()); + } + + @Test + public void testTagIterator() { + b.getTags().clear(); + Iterator it = b.tagIterator(); + assertFalse(it.hasNext()); + + b.append(t); + assertEquals(t, b.tagIterator().next()); + } + + @Test + public void testIsTagBlock() { + assertTrue(b.isTagBlock()); + } + + @Test + public void testGetTagValuesEmpty2() { + String[] vals = b.getTagValues("foo"); + assertNotNull(vals); + assertEquals(0, vals.length); + } + + @Test + public void testGetTagValues1() { + Tag t = new Tag("1:val1"); + b.append(t); + + String[] vals = b.getTagValues("1"); + assertNotNull(vals); + assertEquals(1, vals.length); + assertEquals("val1", vals[0]); + } + + @Test + public void testGetTagValues2() { + b.append(new Tag("1:val1")); + b.append(new Tag("1:val2")); + + String[] vals = b.getTagValues("1"); + assertNotNull(vals); + assertEquals(2, vals.length); + assertEquals("val1", vals[0]); + assertEquals("val2", vals[1]); + } + + @Test + public void testRemoveAll1() { + b.append(new Tag("1:val1")); + b.append(new Tag("1:val2")); + + int vals = b.removeAll("1"); + assertEquals(2, vals); + } + + @Test + public void testRemoveAll2() { + b.append(new Tag("a:val1")); + b.append(new Tag("1:val1")); + b.append(new Tag("b:val1")); + b.append(new Tag("1:val1")); + b.append(new Tag("c:val2")); + + int vals = b.removeAll("1"); + assertEquals(2, vals); + } + + @Test + public void testgetTagsByName() { + b.append(new Tag("a:val1")); + b.append(new Tag("1:val1")); + b.append(new Tag("b:val1")); + b.append(new Tag("1:val2")); + b.append(new Tag("c:val3")); + + Tag[] tags = b.getTagsByName("1"); + assertEquals(2, tags.length); + assertEquals("val1", tags[0].getValue()); + assertEquals("val2", tags[1].getValue()); + } + + @Test + public void testgetTagsByValue() { + b.append(new Tag("a:val1")); + b.append(new Tag("1:val1")); + b.append(new Tag("1:val2")); + b.append(new Tag("c:val3")); + b.append(new Tag("b:val1")); + List tags = b.getTagsByValue("val1"); + + assertEquals(3, tags.size()); + assertEquals("a", tags.get(0).getName()); + assertEquals("1", tags.get(1).getName()); + assertEquals("b", tags.get(2).getName()); + } + + @Test + public void testgetTagsByContent() { + b.append(new Tag("a:val1aaa")); + b.append(new Tag("1:dddval1")); + b.append(new Tag("1:val2")); + b.append(new Tag("c:val3")); + b.append(new Tag("b:ffval1gg")); + List tags = b.getTagsByContent("val1"); + + assertEquals(3, tags.size()); + assertEquals("a", tags.get(0).getName()); + assertEquals("1", tags.get(1).getName()); + assertEquals("b", tags.get(2).getName()); + } + + /** + * Normal test with starting and ending tag + */ + @Test + public void testgetSubBlock01() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), new Tag("4:val4")); + + assertEquals(3, sb.size()); + assertEquals("2", sb.getTag(0).getName()); + assertEquals("3", sb.getTag(1).getName()); + assertEquals("4", sb.getTag(2).getName()); + assertEquals("val2", sb.getTag(0).getValue()); + assertEquals("val3", sb.getTag(1).getValue()); + assertEquals("val4", sb.getTag(2).getValue()); + } + + /** + * Normal test with no ending tag + */ + @Test + public void testgetSubBlock02() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), null); + + assertEquals(4, sb.size()); + assertEquals("2", sb.getTag(0).getName()); + assertEquals("3", sb.getTag(1).getName()); + assertEquals("4", sb.getTag(2).getName()); + assertEquals("5", sb.getTag(3).getName()); + assertEquals("val2", sb.getTag(0).getValue()); + assertEquals("val3", sb.getTag(1).getValue()); + assertEquals("val4", sb.getTag(2).getValue()); + assertEquals("val5", sb.getTag(3).getValue()); + } + + /** + * Normal test using block names + */ + @Test + public void testgetSubBlock03() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:foo")); + b.append(new Tag("3:val3")); + b.append(new Tag("16S:foo")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock("foo"); + + assertEquals(3, sb.size()); + assertEquals("16R", sb.getTag(0).getName()); + assertEquals("3", sb.getTag(1).getName()); + assertEquals("16S", sb.getTag(2).getName()); + assertEquals("foo", sb.getTag(0).getValue()); + assertEquals("val3", sb.getTag(1).getValue()); + assertEquals("foo", sb.getTag(2).getValue()); + } + + /** + * Test using block name, with nested sub blocks + */ + @Test + public void testgetSubBlock04() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:foo")); + b.append(new Tag("3:val3")); + b.append(new Tag("16R:aaa")); + b.append(new Tag("3:val3")); + b.append(new Tag("16S:aaa")); + b.append(new Tag("16S:foo")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock("foo"); + + assertEquals(6, sb.size()); + + assertEquals("16R", sb.getTag(0).getName()); + assertEquals("foo", sb.getTag(0).getValue()); + + assertEquals("3", sb.getTag(1).getName()); + assertEquals("val3", sb.getTag(1).getValue()); + + assertEquals("16R", sb.getTag(2).getName()); + assertEquals("aaa", sb.getTag(2).getValue()); + + assertEquals("3", sb.getTag(3).getName()); + assertEquals("val3", sb.getTag(3).getValue()); + + assertEquals("16S", sb.getTag(4).getName()); + assertEquals("aaa", sb.getTag(4).getValue()); + + assertEquals("16S", sb.getTag(5).getName()); + assertEquals("foo", sb.getTag(5).getValue()); + } + + /** + * Ending tag precedes starting tag + */ + @Test + public void testgetSubBlock05() { + b.append(new Tag("1:val1")); + b.append(new Tag("4:val4")); + b.append(new Tag("3:val3")); + b.append(new Tag("2:val2")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock(new Tag("2:val2"), new Tag("4:val4")); + + assertEquals(2, sb.size()); + assertEquals("2", sb.getTag(0).getName()); + assertEquals("val2", sb.getTag(0).getValue()); + assertEquals("5", sb.getTag(1).getName()); + assertEquals("val5", sb.getTag(1).getValue()); + } + + /** + * Normal test with starting and ending tag and multiple sub blocks + */ + @Test + public void testgetSubBlock06() { + b.append(new Tag("99:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:end")); + b.append(new Tag("88:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("4:val4")); + b.append(new Tag("3:end")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks(new Tag("1:start"), new Tag("3:end")); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("1", sb.getTag(0).getName()); + assertEquals("start", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("3", sb.getTag(2).getName()); + assertEquals("end", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(3, sb2.size()); + assertEquals("1", sb2.getTag(0).getName()); + assertEquals("start", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("3", sb2.getTag(2).getName()); + assertEquals("end", sb2.getTag(2).getValue()); + } + + @Test + public void testSplit() { + b.append(new Tag("99:foo")); + + b.append(new Tag("1:start")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:end")); + b.append(new Tag("88:foo")); + + b.append(new Tag("1:start")); + b.append(new Tag("4:val4")); + b.append(new Tag("3:end")); + b.append(new Tag("77:foo")); + b.append(new Tag("77:foo")); + + List sbs = b.splitByTagName("1"); + + assertEquals(3, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(1, sb.size()); + assertEquals("99", sb.getTag(0).getName()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(4, sb2.size()); + + SwiftTagListBlock sb3 = sbs.get(2); + assertEquals(5, sb3.size()); + } + + @Test + public void testSplitByNonexisting() { + b.append(new Tag("99:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:end")); + b.append(new Tag("88:foo")); + + List sbs = b.splitByTagName("XX"); + + assertEquals(1, sbs.size()); + assertEquals(5, sbs.get(0).size()); + } + + /** + * Normal test using block name and multiple sub blocks + */ + @Test + public void testgetSubBlock07() { + b.append(new Tag("99:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("2:val2")); + b.append(new Tag("16S:blockname")); + b.append(new Tag("88:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("4:val4")); + b.append(new Tag("16S:blockname")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks("blockname"); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("16R", sb.getTag(0).getName()); + assertEquals("blockname", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("16S", sb.getTag(2).getName()); + assertEquals("blockname", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(3, sb2.size()); + assertEquals("16R", sb2.getTag(0).getName()); + assertEquals("blockname", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("16S", sb2.getTag(2).getName()); + assertEquals("blockname", sb2.getTag(2).getValue()); + } + + /** + * Test using block name and multiple sub blocks, with nested sub blocks + */ + @Test + public void testgetSubBlock08() { + b.append(new Tag("99:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("2:val2")); + b.append(new Tag("16S:blockname")); + b.append(new Tag("88:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("4:val4")); + b.append(new Tag("16R:foo")); + b.append(new Tag("66:foo")); + b.append(new Tag("16S:foo")); + b.append(new Tag("16S:blockname")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks("blockname"); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("16R", sb.getTag(0).getName()); + assertEquals("blockname", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("16S", sb.getTag(2).getName()); + assertEquals("blockname", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(6, sb2.size()); + assertEquals("16R", sb2.getTag(0).getName()); + assertEquals("blockname", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("16R", sb2.getTag(2).getName()); + assertEquals("foo", sb2.getTag(2).getValue()); + assertEquals("66", sb2.getTag(3).getName()); + assertEquals("foo", sb2.getTag(3).getValue()); + assertEquals("16S", sb2.getTag(4).getName()); + assertEquals("foo", sb2.getTag(4).getValue()); + assertEquals("16S", sb2.getTag(5).getName()); + assertEquals("blockname", sb2.getTag(5).getValue()); + } + + /** + * Test using block name and multiple sub blocks, with nested sub blocks and missing ending tag + */ + @Test + public void testgetSubBlock09() { + b.append(new Tag("99:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("2:val2")); + b.append(new Tag("16S:blockname")); + b.append(new Tag("88:foo")); + b.append(new Tag("16R:blockname")); + b.append(new Tag("4:val4")); + b.append(new Tag("16R:foo")); + b.append(new Tag("66:foo")); + b.append(new Tag("16S:foo")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks("blockname"); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("16R", sb.getTag(0).getName()); + assertEquals("blockname", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("16S", sb.getTag(2).getName()); + assertEquals("blockname", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(6, sb2.size()); + assertEquals("16R", sb2.getTag(0).getName()); + assertEquals("blockname", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("16R", sb2.getTag(2).getName()); + assertEquals("foo", sb2.getTag(2).getValue()); + assertEquals("66", sb2.getTag(3).getName()); + assertEquals("foo", sb2.getTag(3).getValue()); + assertEquals("16S", sb2.getTag(4).getName()); + assertEquals("foo", sb2.getTag(4).getValue()); + assertEquals("77", sb2.getTag(5).getName()); + assertEquals("foo", sb2.getTag(5).getValue()); + } + + /** + * Normal test with starting and ending tag names and multiple sub blocks + */ + @Test + public void testgetSubBlock10() { + b.append(new Tag("99:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:end")); + b.append(new Tag("88:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("4:val4")); + b.append(new Tag("3:end")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks("1", "3"); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("1", sb.getTag(0).getName()); + assertEquals("start", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("3", sb.getTag(2).getName()); + assertEquals("end", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(3, sb2.size()); + assertEquals("1", sb2.getTag(0).getName()); + assertEquals("start", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("3", sb2.getTag(2).getName()); + assertEquals("end", sb2.getTag(2).getValue()); + } + + /** + * Normal test with starting and ending tag names and multiple sub blocks + * using tag number for end boundary (regardless of letter option) + */ + @Test + public void testgetSubBlock10b() { + b.append(new Tag("99:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("2:val2")); + b.append(new Tag("3A:end")); + b.append(new Tag("88:foo")); + b.append(new Tag("1:start")); + b.append(new Tag("4:val4")); + b.append(new Tag("3B:end")); + b.append(new Tag("77:foo")); + + List sbs = b.getSubBlocks("1", 3); + + assertEquals(2, sbs.size()); + + SwiftTagListBlock sb = sbs.get(0); + assertEquals(3, sb.size()); + assertEquals("1", sb.getTag(0).getName()); + assertEquals("start", sb.getTag(0).getValue()); + assertEquals("2", sb.getTag(1).getName()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("3A", sb.getTag(2).getName()); + assertEquals("end", sb.getTag(2).getValue()); + + SwiftTagListBlock sb2 = sbs.get(1); + assertEquals(3, sb2.size()); + assertEquals("1", sb2.getTag(0).getName()); + assertEquals("start", sb2.getTag(0).getValue()); + assertEquals("4", sb2.getTag(1).getName()); + assertEquals("val4", sb2.getTag(1).getValue()); + assertEquals("3B", sb2.getTag(2).getName()); + assertEquals("end", sb2.getTag(2).getValue()); + } + + /** + * Not found + */ + @Test + public void testgetSubBlock11() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + + SwiftTagListBlock sb = b.getSubBlock(new Tag("7:val7"), new Tag("8:val8")); + + assertEquals(0, sb.size()); + } + + /** + * Not found + */ + @Test + public void testContainTag() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + assertTrue(b.containsTag(new Tag("4:val4"))); + assertFalse(b.containsTag(new Tag("4:foo"))); + assertFalse(b.containsTag(new Tag("foo:val4"))); + } + + @Test + public void testContainsField() { + b.append(new Tag("21E:")); + b.append(new Tag("50B:")); + assertTrue(b.containsField("50B")); + assertTrue(b.containsField("50a")); + assertTrue(b.containsField("21E")); + assertTrue(b.containsField("21a")); + } + + @Test + public void testFieldsByNameEmptyResult() { + // empty result + b.append(new Tag("1", "foo")); + Field[] fieldsByName = b.getFieldsByName("2"); + assertEquals(0, fieldsByName.length); + + // empty result with empty set + Field[] o = new SwiftTagListBlock().getFieldsByName(""); + assertEquals(0, o.length); + + o = new SwiftTagListBlock().getFieldsByName("1"); + assertEquals(0, o.length); + } + + @Test + public void testFieldsByNameWildcards() { + b.append(new Tag("95C", "foo")); + Field[] fieldsByName = b.getFieldsByName("95a"); + assertEquals(1, fieldsByName.length); + + b.append(new Tag("93", "bar")); + fieldsByName = b.getFieldsByName("95a"); + assertEquals(1, fieldsByName.length); + + b.append(new Tag("95C", "foo2")); + fieldsByName = b.getFieldsByName("95a"); + assertEquals(2, fieldsByName.length); + } + + @Test + public void testFieldsByNameBeing() { + b.append(new Tag("95C", "foo")); + assertEquals(1, b.getFieldsByName("95a", "foo").size()); + + b.append(new Tag("93", "bar")); + assertEquals(1, b.getFieldsByName("95a", "foo").size()); + + b.append(new Tag("95C", "foo")); + b.append(new Tag("95C", "foo2")); + b.append(new Tag("95C", "foo2")); + b.append(new Tag("95C", "foo2")); + assertEquals(2, b.getFieldsByName("95a", "foo").size()); + assertEquals(3, b.getFieldsByName("95a", "foo2").size()); + } + + @Test + public void testTagsByNameBeing() { + b.append(new Tag("95C", "foo")); + assertEquals(1, b.getTagsByName("95a", "foo").size()); + + b.append(new Tag("93", "bar")); + assertEquals(1, b.getTagsByName("95a", "foo").size()); + + b.append(new Tag("95C", "foo")); + b.append(new Tag("95C", "foo2")); + b.append(new Tag("95C", "foo2")); + b.append(new Tag("95C", "foo2")); + assertEquals(2, b.getTagsByName("95a", "foo").size()); + assertEquals(3, b.getTagsByName("95a", "foo2").size()); + } + + @Test + public void testGetTagIndex() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + + assertEquals(0, (int) b.getTagIndex("1", null)); + assertEquals(2, (int) b.getTagIndex("3", new String[] {"A", "B", "K"})); + assertEquals(3, (int) b.getTagIndex("4", new String[] {"A", "B", "K", ""})); + } + + @Test + public void testGetSubBlockAfterFirst() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("2", true); + assertEquals(4, sb.size()); + assertEquals("val2", sb.getTag(0).getValue()); + assertEquals("val5", sb.getTag(3).getValue()); + } + + @Test + public void testGetSubBlockAfterFirst2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("3K", true); + assertEquals(3, sb.size()); + assertEquals("val3", sb.getTag(0).getValue()); + assertEquals("val5", sb.getTag(2).getValue()); + } + + @Test + public void testGetSubBlockAfterFirst3() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("3K", false); + assertEquals(5, sb.size()); + assertEquals("val4", sb.getTag(0).getValue()); + assertEquals("val8", sb.getTag(4).getValue()); + } + + @Test + public void testGetSubBlockAfterFirstLimit() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("8", false); + assertEquals(0, sb.size()); + } + + @Test + public void testGetSubBlockAfterFirstLimit2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("1", false); + assertEquals(7, sb.size()); + } + + @Test + public void testGetSubBlockAfterFirstNotFound() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst("99", false); + assertEquals(0, sb.size()); + } + + @Test + public void testGetSubBlockAfterFirstTag() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockAfterFirst(new Tag("3K:val3"), false); + assertEquals(5, sb.size()); + assertEquals("val4", sb.getTag(0).getValue()); + assertEquals("val8", sb.getTag(4).getValue()); + } + + @Test + public void testGetSubBlockBeforeFirst() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("2", false); + assertEquals(1, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + } + + @Test + public void testGetSubBlockBeforeLast() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("2:val2")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockBeforeLast("2", false); + assertEquals(3, sb.size()); + assertEquals("val3", sb.getTag(2).getValue()); + + sb = b.getSubBlockBeforeLast("2", true); + assertEquals(4, sb.size()); + assertEquals("val2", sb.getTag(3).getValue()); + } + + @Test + public void testIndexOfLast() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("2:val2")); + b.append(new Tag("5:val5")); + + assertEquals(3, b.indexOfLast("2")); + + assertEquals(0, b.indexOfLast("1")); + + assertEquals(4, b.indexOfLast("5")); + } + + @Test + public void testGetSubBlockAfterLast() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("2:val2")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockAfterLast("2", false); + assertEquals(1, sb.size()); + assertEquals("val5", sb.getTag(0).getValue()); + + sb = b.getSubBlockAfterLast("2", true); + assertEquals(2, sb.size()); + assertEquals("val5", sb.getTag(1).getValue()); + } + + @Test + public void testGetSubBlockBeforeFirst2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("2", true); + assertEquals(2, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + } + + @Test + public void testGetSubBlockBeforeFirst3() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("3K", true); + assertEquals(3, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("val3", sb.getTag(2).getValue()); + } + + @Test + public void testGetSubBlockBeforeFirstFirst2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("3K", false); + assertEquals(2, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + } + + @Test + public void testGetSubBlockBeforeFirstLimit() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("1", false); + assertEquals(0, sb.size()); + } + + @Test + public void testGetSubBlockBeforeFirstLimit2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("8", false); + assertEquals(7, sb.size()); + } + + @Test + public void testGetSubBlockBeforeFirstNotFound() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.getSubBlockBeforeFirst("99", false); + assertEquals(8, sb.size()); + } + + @Test + public void testRemove() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + String sb = b.removeTag("3K"); + assertEquals("val3", sb); + assertEquals(4, b.size()); + } + + /** + * Test for subblocks API with real case message + */ + @Test + public void testGetSubBlockMT564() { + final String msg = + "{1:F01MTGSUS6SAXXX3206837054}{2:O5641435070316CHASGB2LDGST07128160300703160735N}{3:{108:000255CQ8272245}}{4:\n" + + ":16R:GENL\n" + + ":20C::CORP//D455103\n" + + ":20C::SEME//029206016\n" + + ":23G:NEWM\n" + + ":22F::CAEV//DVCA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20070316143348\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN CH0011075394\n" + + "/XX/5983816\n" + + "ZURICH FIN SVS GRP\n" + + "CHF0.10\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//760043140\n" + + ":94F::SAFE//CUST/UBSWCHZH80A\n" + + ":93B::ELIG//UNIT/7000,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::WITF//35,\n" + + ":92A::GRSS//0,000001000\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":11A::OPTN//CHF\n" + + ":17B::DFLT//Y\n" + + ":98A::XDTE//20111111\n" + + ":98A::PAYD//20111111\n" + + ":98A::RDTE//20111111\n" + + ":92A::GRSS//0,000001000\n" + + ":16R:CASHMOVE\n" + + ":22H::CRDB//CRED\n" + + ":19B::ENTL//CHF0,01\n" + + ":19B::GRSS//CHF0,01\n" + + ":19B::NETT//CHF0,01\n" + + ":98A::PAYD//20111111\n" + + ":98A::VALU//20111111\n" + + ":16S:CASHMOVE\n" + + ":16S:CAOPTN\n" + + "-}"; + // parse text message into SWIFT message object + SwiftMessage o = new ConversionService().getMessageFromFIN(msg); + List sequencesB2 = o.getBlock4().getSubBlocks("ACCTINFO"); + List sequencesC = o.getBlock4().getSubBlocks("INTSEC"); + + for (SwiftTagListBlock seq : sequencesB2) { + Field[] fields = seq.getFieldsByName("93B"); + assertEquals(1, fields.length); + Field93B f = (Field93B) fields[0]; + assertEquals(":ELIG//UNIT/7000,", f.getValue()); + } + + assertTrue(sequencesC.isEmpty()); + } + + @Test + public void testFilterByName() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.filterByName(true, "1", "4", "7"); + assertEquals(3, sb.size()); + assertEquals("val7", sb.getTag(2).getValue()); + sb = b.filterByName(false, "1", "4", "7"); + assertEquals(5, sb.size()); + } + + @Test + public void testFilterByName2() { + SwiftTagListBlock sb = b.filterByName(true, "1", "4", "7"); + assertEquals(0, sb.size()); + + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + + sb = b.filterByName(false); + assertEquals(8, sb.size()); + } + + @Test + public void testFilterByNameOrdered() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("3K:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + SwiftTagListBlock sb = b.filterByNameOrdered("1", "2", "4"); + assertEquals(2, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + } + + @Test + public void testGetOptionalList() { + + b.append(new Tag("1:val1")); // entra, en primera fila de permitidos + b.append(new Tag("2:val2")); // entra en la tercera + b.append(new Tag("3:val3")); // no entra, de la tercera ya se consumui el priero, y de cada fila se acepta uno + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + b.append(new Tag("6:val6")); + b.append(new Tag("7:val7")); + b.append(new Tag("8:val8")); + + SwiftTagListBlock result = b.getOptionalList(new String[][] {{"1a", "1b", "1"}, {"2e", "2c"}, {"2", "3"}}); + + assertEquals(2, result.size()); + assertEquals("val1", result.getTag(0).getValue()); + assertEquals("val2", result.getTag(1).getValue()); + } + + @Test + public void testGetOptionalLists() { + appends(b, 1, 8); + appends(b, 1, 8); + + List result = + b.getOptionalLists(new String[][] {{"1a", "1b", "1"}, {"2e", "2c"}, {"2", "3"}}); + + assertNotNull(result); + assertEquals(2, result.size()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail() { + appends(b, 1, 8); + + String[] start = {"1"}; + String[] end = {"5c", "5b", "5"}; + String[] tail = {}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + assertEquals(result.getTag(0).getValue(), "val1"); + assertEquals(result.getTag(1).getValue(), "val2"); + assertEquals(result.getTag(2).getValue(), "val3"); + assertEquals(result.getTag(3).getValue(), "val4"); + assertEquals(result.getTag(4).getValue(), "val5"); + assertEquals(5, result.size(), "" + result.tagNamesList()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail_02() { + appends(b, 1, 9); + + String[] start = {"1"}; + String[] end = {"3"}; + String[] tail = {"6", "7"}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + + assertNotNull(result); + assertEquals(result.getTag(0).getValue(), "val1"); + assertEquals(result.getTag(1).getValue(), "val2"); + assertEquals(result.getTag(2).getValue(), "val3"); + assertEquals(3, result.size(), "returned: " + result.tagNamesList()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail_03() { + appends(b, 1, 4); + + String[] start = {"1"}; + String[] end = {"2"}; + String[] tail = {"3", "4"}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + + assertNotNull(result); + assertEquals(result.getTag(0).getValue(), "val1"); + assertEquals(result.getTag(1).getValue(), "val2"); + assertEquals(result.getTag(2).getValue(), "val3"); + assertEquals(result.getTag(3).getValue(), "val4"); + assertEquals(4, result.size()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail_04() { + appends(b, 1, 8); + + String[] start = {"3"}; + String[] end = {"5c", "5b", "5"}; + String[] tail = {}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + assertEquals(result.getTag(0).getValue(), "val3"); + assertEquals(result.getTag(1).getValue(), "val4"); + assertEquals(result.getTag(2).getValue(), "val5"); + assertEquals(3, result.size(), "" + result.tagNamesList()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail_05() { + appends(b, 1, 8); + + String[] start = {"3"}; + String[] end = {"5c", "5b", "5"}; + String[] tail = {"6", "7"}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + assertEquals(result.getTag(0).getValue(), "val3"); + assertEquals(result.getTag(1).getValue(), "val4"); + assertEquals(result.getTag(2).getValue(), "val5"); + assertEquals(result.getTag(3).getValue(), "val6"); + assertEquals(result.getTag(4).getValue(), "val7"); + assertEquals(5, result.size(), "" + result.tagNamesList()); + } + + @Test + public void testGetSubBlockDelimitedWithOptionalTail_06() { + appends(b, 1, 9); + + String[] start = {"2"}; + String[] end = {"4"}; + String[] tail = {"6", "7"}; + SwiftTagListBlock result = b.getSubBlockDelimitedWithOptionalTail(start, end, tail); + + assertNotNull(result); + assertEquals(result.getTag(0).getValue(), "val2"); + assertEquals(result.getTag(1).getValue(), "val3"); + assertEquals(result.getTag(2).getValue(), "val4"); + assertEquals(3, result.size(), "returned: " + result.tagNamesList()); + } + + @Test + public void testGetSubBlocksDelimitedWithOptionalTail() { + appends(b, 1, 8); + appends(b, 1, 8); + + String[] start = {"1"}; + String[] end = {"5c", "5b", "5"}; + String[] tail = {}; + List result = b.getSubBlocksDelimitedWithOptionalTail(start, end, tail); + + assertEquals(2, result.size()); + assertEquals(5, result.get(0).size()); + assertEquals(5, result.get(1).size()); + + tail = new String[] {"6a", "6"}; + result = b.getSubBlocksDelimitedWithOptionalTail(start, end, tail); + assertEquals(2, result.size()); + assertEquals(6, result.get(0).size()); + assertEquals(6, result.get(1).size()); + } + + /* + * The getSubBlock includes the starting element in the result but excludes the ending one + */ + @Test + public void testGetSubBlock() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("2:val2")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.getSubBlock(1, 2); + assertEquals(1, sb.size()); + assertEquals("val2", sb.getTag(0).getValue()); + + sb = b.getSubBlock(1, 1 + 4); + assertEquals(4, sb.size()); + assertEquals("val3", sb.getTag(1).getValue()); + + sb = b.getSubBlock(null, 1); + assertEquals(1, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + + sb = b.getSubBlock(4, null); + assertEquals(1, sb.size()); + assertEquals("val5", sb.getTag(0).getValue()); + + sb = b.getSubBlock(0, 100); + assertEquals(5, sb.size()); + } + + /* + * The sublist method includes both the starting and ending elements in the result + */ + @Test + public void testSublist() { + appends(b, 1, 10); + + SwiftTagListBlock sl = b.sublist(0, 1); + assertEquals(2, sl.size()); + + sl = b.sublist(null, null); + assertEquals(b.size(), sl.size()); + } + + private void appends(SwiftTagListBlock block, int from, int to) { + for (int i = from; i <= to; i++) { + block.append(new Tag("" + i, "val" + i)); + } + } + + @Test + public void testRemoveSubBlock() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:val4")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(5, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("val3", sb.getTag(2).getValue()); + assertEquals("val4", sb.getTag(3).getValue()); + assertEquals("val5", sb.getTag(4).getValue()); + } + + @Test + public void testRemoveSubBlock_2() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3K:val3")); + b.append(new Tag("16S:TEST")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(5, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val2", sb.getTag(1).getValue()); + assertEquals("val3", sb.getTag(2).getValue()); + assertEquals("TEST", sb.getTag(3).getValue()); + assertEquals("val5", sb.getTag(4).getValue()); + } + + @Test + public void testRemoveSubBlock_3() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:HELLO")); + b.append(new Tag("3K:val3")); + b.append(new Tag("16S:TEST")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(5, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("HELLO", sb.getTag(1).getValue()); + assertEquals("val3", sb.getTag(2).getValue()); + assertEquals("TEST", sb.getTag(3).getValue()); + assertEquals("val5", sb.getTag(4).getValue()); + } + + @Test + public void testRemoveSubBlock_4() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:TEST")); + b.append(new Tag("3K:val3")); + b.append(new Tag("16S:TEST")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(2, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + assertEquals("val5", sb.getTag(1).getValue()); + } + + @Test + public void testRemoveSubBlock_5() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:TEST")); + b.append(new Tag("3K:val3")); + b.append(new Tag("16S:FOO")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(1, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + } + + @Test + public void testRemoveSubBlock_6() { + b.append(new Tag("1:val1")); + b.append(new Tag("16R:TEST")); + b.append(new Tag("3K:val3")); + b.append(new Tag("4:FOO")); + b.append(new Tag("5:val5")); + SwiftTagListBlock sb = b.removeSubBlock("TEST"); + assertEquals(1, sb.size()); + assertEquals("val1", sb.getTag(0).getValue()); + } + + /* + * https://github.com/prowide/prowide-core/issues/13 + */ + @Test + public void testRemoveSubBlock_7() { + b.append(Field20.tag("before")); + + // first sub-block + b.append(Field16R.tag("SUBBAL")); + b.append(Field20.tag("first block")); + b.append(Field16S.tag("SUBBAL")); + // second sub-block + b.append(Field16R.tag("SUBBAL")); + b.append(Field20.tag("second block")); + b.append(Field16S.tag("SUBBAL")); + + b.append(Field20.tag("after")); + + SwiftTagListBlock sb = b.removeSubBlock("SUBBAL"); + assertEquals("before", sb.getTag(0).getValue()); + assertEquals("SUBBAL", sb.getTag(1).getValue()); + assertEquals("second block", sb.getTag(2).getValue()); + assertEquals("SUBBAL", sb.getTag(3).getValue()); + assertEquals("after", sb.getTag(4).getValue()); + assertEquals(5, sb.size()); + } + + /* + * https://github.com/prowide/prowide-core/issues/13 + */ + @Test + public void testRemoveSubBlocks() { + b.append(Field20.tag("before")); + + // first sub-block + b.append(Field16R.tag("SUBBAL")); + b.append(Field20.tag("first block")); + b.append(Field16S.tag("SUBBAL")); + // second sub-block + b.append(Field16R.tag("SUBBAL")); + b.append(Field20.tag("second block")); + b.append(Field16S.tag("SUBBAL")); + + b.append(Field20.tag("after")); + + // remove all subblocks + SwiftTagListBlock sb = b.removeSubBlocks("SUBBAL"); + assertEquals("before", sb.getTag(0).getValue()); + assertEquals("after", sb.getTag(1).getValue()); + assertEquals(2, sb.size()); + } + + @Test + public void testEmptyArrayReturn() { + Field[] arr = new SwiftTagListBlock().getFieldsByName("nn"); + assertNotNull(arr); + assertEquals(0, arr.length); + } + + @Test + public void testGetFieldByName19A() { + b.append(Field19A.tag(":SETT")); + assertNotNull(b.getFieldByName(Field19A.NAME, "SETT")); + } + + /** + * @since 7.8.5 + */ + @Test + public void testGetSubBlockByTagNames() { + /* + * empty search and empty block + */ + SwiftTagListBlock result = b.getSubBlockByTagNames(0); + assertNotNull(result); + assertTrue(result.isEmpty()); + + appends(b, 1, 9); + + /* + * filled block, empty search + */ + result = b.getSubBlockByTagNames(0); + assertNotNull(result); + assertTrue(result.isEmpty()); + + /* + * single match on first tag + */ + result = b.getSubBlockByTagNames(0, "1"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals("1", result.getTag(0).getName()); + + /* + * single match on second tag + */ + result = b.getSubBlockByTagNames(0, "2"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals("2", result.getTag(0).getName()); + + /* + * the same with index above match + */ + result = b.getSubBlockByTagNames(8, "2"); + assertNotNull(result); + assertTrue(result.isEmpty()); + + /* + * same with index before match + */ + result = b.getSubBlockByTagNames(1, "2"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals("2", result.getTag(0).getName()); + + /* + * double match on consecutive tags + */ + result = b.getSubBlockByTagNames(0, "2", "3"); + assertNotNull(result); + assertEquals(2, result.size()); + assertEquals("2", result.getTag(0).getName()); + assertEquals("3", result.getTag(1).getName()); + + /* + * double match on non-consecutive tags + */ + result = b.getSubBlockByTagNames(0, "2", "5"); + assertNotNull(result); + assertEquals(2, result.size()); + assertEquals("2", result.getTag(0).getName()); + assertEquals("5", result.getTag(1).getName()); + + /* + * single match because unordered search tags + */ + result = b.getSubBlockByTagNames(0, "5", "2"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals("2", result.getTag(0).getName()); + } + + /** + * @since 7.8.5 + */ + @Test + public void testGetSubBlockByTagNames_repetition() { + b.append(new Tag("1", "1")); + b.append(new Tag("2", "2")); + b.append(new Tag("2", "2")); + b.append(new Tag("2", "2")); + b.append(new Tag("3", "3")); + b.append(new Tag("4", "4")); + + /* + * simple case with repetition on block + */ + SwiftTagListBlock result = b.getSubBlockByTagNames(0, "2"); + assertNotNull(result); + assertEquals(3, result.size()); + assertEquals("2", result.getTag(0).getName()); + assertEquals("2", result.getTag(1).getName()); + assertEquals("2", result.getTag(2).getName()); + + /* + * same as above with other unmatched tags + */ + result = b.getSubBlockByTagNames(0, "foo", "2", "99"); + assertNotNull(result); + assertEquals(3, result.size()); + assertEquals("2", result.getTag(0).getName()); + assertEquals("2", result.getTag(1).getName()); + assertEquals("2", result.getTag(2).getName()); + + /* + * repetition on search tags does not produce any difference + */ + result = b.getSubBlockByTagNames(0, "2", "2", "2"); + assertNotNull(result); + assertEquals(3, result.size()); + assertEquals("2", result.getTag(0).getName()); + assertEquals("2", result.getTag(1).getName()); + assertEquals("2", result.getTag(2).getName()); + } + + /** + * similar to {@link #testGetSubBlockByTagNames()} but getting + * multiple block instances + * + * @since 7.8.5 + */ + @Test + public void testGetSubBlocksByTagNames() { + /* + * empty search and empty block + */ + List result = b.getSubBlocksByTagNames(0); + assertNotNull(result); + assertTrue(result.isEmpty()); + + appends(b, 1, 9); + + /* + * filled block, empty search + */ + result = b.getSubBlocksByTagNames(0); + assertNotNull(result); + assertTrue(result.isEmpty()); + + /* + * single match on first tag + */ + result = b.getSubBlocksByTagNames(0, "1"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(1, result.get(0).size()); + assertEquals("1", result.get(0).getTag(0).getName()); + + /* + * single match on second tag + */ + result = b.getSubBlocksByTagNames(0, "2"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(1, result.get(0).size()); + assertEquals("2", result.get(0).getTag(0).getName()); + + /* + * the same with index above match + */ + result = b.getSubBlocksByTagNames(8, "2"); + assertNotNull(result); + assertTrue(result.isEmpty()); + + /* + * same with index before match + */ + result = b.getSubBlocksByTagNames(1, "2"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(1, result.get(0).size()); + assertEquals("2", result.get(0).getTag(0).getName()); + + /* + * double match on consecutive tags + */ + result = b.getSubBlocksByTagNames(0, "2", "3"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(2, result.get(0).size()); + assertEquals("2", result.get(0).getTag(0).getName()); + assertEquals("3", result.get(0).getTag(1).getName()); + + /* + * double match on non-consecutive tags + */ + result = b.getSubBlocksByTagNames(0, "2", "5"); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(2, result.get(0).size()); + assertEquals("2", result.get(0).getTag(0).getName()); + assertEquals("5", result.get(0).getTag(1).getName()); + + /* + * single match because unordered search tags + */ + result = b.getSubBlocksByTagNames(0, "5", "2"); + assertNotNull(result); + assertEquals(2, result.size()); + // first pass will find 2 + assertEquals(1, result.get(0).size()); + assertEquals("2", result.get(0).getTag(0).getName()); + // second pass will find 5 + assertEquals(1, result.get(1).size()); + assertEquals("5", result.get(1).getTag(0).getName()); + } + + @Test + public void testAdd_1() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + + b.addTag(2, new Tag("4:val4")); + + assertEquals(4, b.getTags().size()); + assertEquals("val1", b.getTag(0).getValue()); + assertEquals("val2", b.getTag(1).getValue()); + assertEquals("val4", b.getTag(2).getValue()); + assertEquals("val3", b.getTag(3).getValue()); + + assertEquals(2, (int) b.getTagIndex("4", null)); + assertEquals(3, (int) b.getTagIndex("3", null)); + } + + @Test + public void testAdd_2() { + b.addTag(0, new Tag("1:val1")); + b.addTag(1, new Tag("2:val2")); + b.addTag(2, new Tag("3:val3")); + + assertEquals(3, b.getTags().size()); + assertEquals("val1", b.getTag(0).getValue()); + assertEquals("val2", b.getTag(1).getValue()); + assertEquals("val3", b.getTag(2).getValue()); + } + + @Test + public void testAdd_3() { + Assertions.assertThrows(IndexOutOfBoundsException.class, () -> b.addTag(1, new Tag("1:val1"))); + } + + @Test + public void testSet() { + b.append(new Tag("1:val1")); + b.append(new Tag("2:val2")); + b.append(new Tag("3:val3")); + b.setTag(2, new Tag("15", "15")); + assertEquals(2, (int) b.getTagIndex("15", null)); + assertNull(b.getTagIndex("3", null)); + } + + @Test + public void testFieldByQualifiers() { + // conditional qualifier is component 3 + b.append(new Tag("22F", ":AAAA//BBBB")); + assertNotNull(b.getFieldByQualifiers("22F", "AAAA", "BBBB")); + + // DSS is ignored + b.append(new Tag("22F", ":AAAA/DSS/CCCC")); + assertNotNull(b.getFieldByQualifiers("22F", "AAAA", "CCCC")); + + // conditional qualifier is component 2 + b.append(new Tag("12C", ":AAAA//BBBB")); + assertNotNull(b.getFieldByQualifiers("12C", "AAAA", "BBBB")); + + // not generic field + b.append(new Tag("22K", "AAAA/BBBB")); + assertNull(b.getFieldByQualifiers("22K", "AAAA", "BBBB")); + } + + @Test + public void testSplitByTagName() { + b.append(new Tag("20:foo")); + b.append(new Tag("21:foo")); + assertTrue(b.splitByTagName(22, null).isEmpty()); + assertTrue(b.splitByTagName(22, "L").isEmpty()); + + b.append(new Tag("22L:foo")); + assertTrue(b.splitByTagName(22, "M").isEmpty()); + assertEquals(1, b.splitByTagName(22, null).size()); + assertEquals(1, b.splitByTagName(22, "L").size()); + + b.append(new Tag("32A:foo")); + b.append(new Tag("22L:foo")); + assertEquals(2, b.splitByTagName(22, null).size()); + assertEquals(2, b.splitByTagName(22, "L").size()); + + b.append(new Tag("22M:foo")); + b.append(new Tag("95P:foo")); + assertEquals(3, b.splitByTagName(22, null).size()); + assertEquals(2, b.splitByTagName(22, "L").size()); + + List list1 = b.splitByTagName(22, null); + assertEquals("22L", list1.get(0).getTag(0).getName()); + assertEquals("32A", list1.get(0).getTag(1).getName()); + assertEquals("22L", list1.get(1).getTag(0).getName()); + assertEquals("22M", list1.get(2).getTag(0).getName()); + assertEquals("95P", list1.get(2).getTag(1).getName()); + + List list2 = b.splitByTagName(22, "L"); + assertEquals("22L", list2.get(0).getTag(0).getName()); + assertEquals("32A", list2.get(0).getTag(1).getName()); + assertEquals("22L", list2.get(1).getTag(0).getName()); + assertEquals("22M", list2.get(1).getTag(1).getName()); + assertEquals("95P", list2.get(1).getTag(2).getName()); + } +} diff --git a/src/test/java/com/prowidesoftware/swift/model/SwiftValueBlockTest.java b/src/test/java/com/prowidesoftware/swift/model/SwiftValueBlockTest.java index c3829563d..c2d8b86c8 100644 --- a/src/test/java/com/prowidesoftware/swift/model/SwiftValueBlockTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/SwiftValueBlockTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,10 @@ public void getValuePart() { static class TestValueBlock extends SwiftValueBlock { @Override - protected void setBlockNumber(Integer blockNumber) { - - } + protected void setBlockNumber(Integer blockNumber) {} @Override - protected void setBlockName(String blockName) { - - } + protected void setBlockName(String blockName) {} @Override public Integer getNumber() { @@ -57,5 +53,4 @@ public String getName() { return null; } } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/TagTest.java b/src/test/java/com/prowidesoftware/swift/model/TagTest.java index 570029476..4760761cb 100644 --- a/src/test/java/com/prowidesoftware/swift/model/TagTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/TagTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,5 +154,4 @@ public void testEqualsIgnoreCR() { */ assertFalse(new Tag("50K:FOO1\nFOO2").equalsIgnoreCR(new Tag("50K:FOO1\nFOO3"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java index 8e77d065e..a8f0b40c0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,11 @@ import static org.junit.jupiter.api.Assertions.*; import com.prowidesoftware.swift.io.ConversionService; +import java.io.IOException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.IOException; - /** * Unparsed text lists tests. * @@ -99,7 +98,6 @@ public void test_getTextAsMessageOK() { @Test public void test_getTextAsMessageBAD() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> assertNull(t.getTextAsMessage(-1))); - } @Test @@ -182,5 +180,4 @@ public void test_bug2822350() throws IOException { @SuppressWarnings("unused") SwiftMessage m3 = SwiftMessage.parse(msg.getUnparsedTexts().getText(1)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/AbstractFieldTest.java b/src/test/java/com/prowidesoftware/swift/model/field/AbstractFieldTest.java index a8ff7618d..40894c377 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/AbstractFieldTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/AbstractFieldTest.java @@ -1,51 +1,50 @@ -/* - * Copyright 2006-2021 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; - -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Disabled; - -/** - * Base implementation for field test cases - * - * @since 7.9.3 - */ -@Disabled -public abstract class AbstractFieldTest { - - protected void testSerializationImpl(final String tagName, String... values) { - try { - for (String v : values) { - Tag t1 = new Tag(tagName, v); - Tag t2 = Field.getField(t1).asTag(); - assertTrue(t1.equalsIgnoreCR(t2), "[" + t1.getValue() + "] is not equals [" + t2.getValue() + "]"); - } - } catch (Exception e) { - fail(e.getMessage()); - } - } - - /** - * All subclasses must implement this test case calling {@link #testSerializationImpl(String, String...)} - * to verify that a field value integrity is preserve after parsing it into components and serializing the - * components back into a plain string. - */ - public abstract void testSerialization(); - -} \ No newline at end of file +/* + * Copyright 2006-2023 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; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import com.prowidesoftware.swift.model.Tag; +import org.junit.jupiter.api.Disabled; + +/** + * Base implementation for field test cases + * + * @since 7.9.3 + */ +@Disabled +public abstract class AbstractFieldTest { + + protected void testSerializationImpl(final String tagName, String... values) { + try { + for (String v : values) { + Tag t1 = new Tag(tagName, v); + Tag t2 = Field.getField(t1).asTag(); + assertTrue(t1.equalsIgnoreCR(t2), "[" + t1.getValue() + "] is not equals [" + t2.getValue() + "]"); + } + } catch (Exception e) { + fail(e.getMessage()); + } + } + + /** + * All subclasses must implement this test case calling {@link #testSerializationImpl(String, String...)} + * to verify that a field value integrity is preserve after parsing it into components and serializing the + * components back into a plain string. + */ + public abstract void testSerialization(); +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/AmountResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/AmountResolverTest.java index ba95491b6..40708b4e7 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/AmountResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/AmountResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.List; +import org.junit.jupiter.api.Test; public class AmountResolverTest { @@ -47,7 +46,6 @@ public void testResolveField32B() { f = new Field32B("USD10,1"); assertEquals(new BigDecimal("10.1"), AmountResolver.amount(f)); - } @Test @@ -67,5 +65,4 @@ public void testResolve90F_multiple() { assertEquals(new BigDecimal("23456.78"), amounts.get(1)); assertEquals(new BigDecimal("1234.56"), _90F.amount()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/BICResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/BICResolverTest.java index b1ec29f22..f4ea85c72 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/BICResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/BICResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class BICResolverTest { diff --git a/src/test/java/com/prowidesoftware/swift/model/field/ContainerInterfacesTest.java b/src/test/java/com/prowidesoftware/swift/model/field/ContainerInterfacesTest.java index 9a3445830..a1741967b 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/ContainerInterfacesTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/ContainerInterfacesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,5 +39,4 @@ public void testInstanceOf() { assertTrue(new Field32Q() instanceof CurrencyContainer); assertFalse(new Field32Q() instanceof AmountContainer); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/CurrencyResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/CurrencyResolverTest.java index 44b6ffcea..0af4fa8c7 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/CurrencyResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/CurrencyResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Currency; import java.util.List; +import org.junit.jupiter.api.Test; public class CurrencyResolverTest { @@ -141,12 +140,9 @@ public Currency currency() { } @Override - public void initializeCurrencies(String cur) { - } + public void initializeCurrencies(String cur) {} @Override - public void initializeCurrencies(Currency cur) { - } + public void initializeCurrencies(Currency cur) {} } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/DateResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/DateResolverTest.java index 411587b3f..1dfba11b1 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/DateResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/DateResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,15 @@ import static org.junit.jupiter.api.Assertions.*; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.junit.jupiter.api.Test; - import java.util.Calendar; import java.util.List; +import org.junit.jupiter.api.Test; public class DateResolverTest { -/* - public List dates() - public Calendar date() -*/ + /* + public List dates() + public Calendar date() + */ @Test public void testResolve69A_multiple() { @@ -73,5 +72,4 @@ public void testResolve32C_null() { // first date assertNull(field.date()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field11RTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field11RTest.java index 94bb2c73a..d21656441 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field11RTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field11RTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,20 +18,16 @@ import static org.junit.jupiter.api.Assertions.*; import com.prowidesoftware.swift.io.writer.FINWriterVisitor; +import java.util.Calendar; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import java.util.Calendar; - public class Field11RTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("11R", - "100\n091019", - "100\n091019\n1234123456" - ); + testSerializationImpl("11R", "100\n091019", "100\n091019\n1234123456"); } @Test @@ -63,7 +59,7 @@ public void testParser() { assertEquals("100", f.getMTNumber()); assertEquals("091019", f.getComponent2()); assertEquals(2009, f.getComponent2AsCalendar().get(Calendar.YEAR)); - assertEquals(10, f.getComponent2AsCalendar().get(Calendar.MONTH) + 1); //MONTH is zero based at Calendar + assertEquals(10, f.getComponent2AsCalendar().get(Calendar.MONTH) + 1); // MONTH is zero based at Calendar assertEquals(19, f.getComponent2AsCalendar().get(Calendar.DAY_OF_MONTH)); assertNull(f.getComponent3()); assertNull(f.getComponent4()); @@ -99,7 +95,9 @@ public void testSetters() { assertEquals("151111", f.getComponent2()); assertEquals("4444666666", f.getComponent3()); assertNull(f.getComponent4()); - assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); + assertEquals( + "103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", + f.getValue()); f = new Field11R(); f.setComponent1("103"); @@ -110,7 +108,9 @@ public void testSetters() { assertEquals("151111", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); - assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); + assertEquals( + "103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", + f.getValue()); f = new Field11R(); f.setComponent1("103"); @@ -125,7 +125,9 @@ public void testSetters() { assertEquals("151019", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); - assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151019" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); + assertEquals( + "103" + FINWriterVisitor.SWIFT_EOL + "151019" + FINWriterVisitor.SWIFT_EOL + "4444666666", + f.getValue()); f = new Field11R(); f.setComponent1("103"); @@ -136,7 +138,9 @@ public void testSetters() { assertEquals("151111", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); - assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); + assertEquals( + "103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", + f.getValue()); f = new Field11R(); f.setComponent1("103"); @@ -149,5 +153,4 @@ public void testSetters() { assertEquals("6", f.getComponent4()); assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "46", f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field11STest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field11STest.java index cecd91de5..4ad5e5f9d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field11STest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field11STest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,16 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import com.prowidesoftware.swift.model.Tag; +import java.util.Calendar; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import java.util.Calendar; - public class Field11STest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("11S", - "195\n121212" - ); + testSerializationImpl("11S", "195\n121212"); } @Test @@ -43,5 +40,4 @@ public void testSerialization2() { String val = tag.getValue(); assertFalse(StringUtils.isBlank(val)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field133Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field133Test.java index 85bb08cd1..01995d651 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field133Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field133Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,8 +46,8 @@ public class Field133Test extends AbstractFieldTest { * * Note: Unsequenced Broadcast cannot contain numbers. */ - private static final String EXAMPLE1_FIELD_133 = "BAZEUS1111"; + private static final String EXAMPLE2_FIELD_133 = "SAAUNZ2101"; private static final String EXAMPLE3_FIELD_133 = "BJBDHQ1506"; private static final String EXAMPLE4_FIELD_133 = "SCCXHK9999"; @@ -55,12 +55,7 @@ public class Field133Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("133", - EXAMPLE1_FIELD_133, - EXAMPLE2_FIELD_133, - EXAMPLE3_FIELD_133, - EXAMPLE4_FIELD_133 - ); + testSerializationImpl("133", EXAMPLE1_FIELD_133, EXAMPLE2_FIELD_133, EXAMPLE3_FIELD_133, EXAMPLE4_FIELD_133); } @Test @@ -141,5 +136,4 @@ public void testGetValue4() { f = new Field133(v); assertEquals(StringUtils.replace(v, "\n", FINWriterVisitor.SWIFT_EOL), f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field13DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field13DTest.java index b267e63df..7a03f56ae 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field13DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field13DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field13DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("13D", - "aaaaaabbbbcddddx" - ); + testSerializationImpl("13D", "aaaaaabbbbcddddx"); } @Test @@ -142,5 +140,4 @@ public void testField13DString() { assertEquals("c", f.getComponent3()); assertEquals("ddddx", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field14STest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field14STest.java index 1d8f501e1..f38444fe6 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field14STest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field14STest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,11 +30,7 @@ public class Field14STest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("14S", - "EMT00", - "CHF01/1400/GBLO", - "GBP01/1000/USNY" - ); + testSerializationImpl("14S", "EMT00", "CHF01/1400/GBLO", "GBP01/1000/USNY"); } @Test @@ -88,5 +84,4 @@ public void testField14STimeAndLocation() { assertEquals("1000", f.getComponent3()); assertEquals("USNY", f.getComponent4()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field19ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field19ATest.java index 734dc7963..b8cd960de 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field19ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field19ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field19ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("19A", - ":abc//errr123", - ":SETT//CHF178626,04" - ); + testSerializationImpl("19A", ":abc//errr123", ":SETT//CHF178626,04"); } @Test @@ -74,13 +70,13 @@ public void testField19AString() { f = new Field19A("///"); assertNull(f.getComponent1()); - assertNull(f.getComponent2()); // the expected component is a letter, so it is not filled with the slash + assertNull(f.getComponent2()); // the expected component is a letter, so it is not filled with the slash assertNull(f.getComponent3()); assertNull(f.getComponent4()); f = new Field19A(":///"); assertNull(f.getComponent1()); - assertNull(f.getComponent2()); // the expected component is a letter, so it is not filled with the slash + assertNull(f.getComponent2()); // the expected component is a letter, so it is not filled with the slash assertNull(f.getComponent3()); assertNull(f.getComponent4()); @@ -152,7 +148,7 @@ public void testField19AString() { assertEquals("abc", f.getComponent1()); assertEquals("e", f.getComponent2()); assertEquals("rrr", f.getComponent3()); - //assertNull(f.getComponent4()); + // assertNull(f.getComponent4()); } @Test @@ -161,5 +157,4 @@ public void testIssueAmountResolver() { Object n = f.getComponentAs(4, Number.class); assertNotNull(n); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field19Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field19Test.java index c036f60b2..27dc7b156 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field19Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field19Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; - +import org.junit.jupiter.api.Test; public class Field19Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("19", - "12345," - ); + testSerializationImpl("19", "12345,"); } @Test @@ -50,5 +46,4 @@ public void testParse19() { assertNotNull(f, "Parse of correct field failed"); assertEquals(new BigDecimal("12345"), f.getComponent1AsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field22CTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field22CTest.java index 804b2e29d..e059f1f4a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field22CTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field22CTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,12 @@ import org.junit.jupiter.api.Test; - public class Field22CTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("22C", - "AAAABB122C4CCCCDD", - "CNFM2L0007GEBABB" - ); + testSerializationImpl("22C", "AAAABB122C4CCCCDD", "CNFM2L0007GEBABB"); } @Test @@ -85,5 +81,4 @@ public void testParse22C() { assertEquals("CCCC", f.getComponent4()); assertEquals("DD", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field23Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field23Test.java index 4c236083b..18ffbc919 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field23Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field23Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,15 +20,12 @@ import org.junit.jupiter.api.Test; - public class Field23Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("23", - "abcd/efgh/ijk/USD//aaa" - ); + testSerializationImpl("23", "abcd/efgh/ijk/USD//aaa"); } @Test @@ -161,4 +158,4 @@ public void testParse23_WithMissingParts() { assertNull(f.getComponent4()); assertEquals("abcd/efgh/ijkl", f.getValue()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field252Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field252Test.java index 76cc5c8bf..09d68fc8d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field252Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field252Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +30,7 @@ public class Field252Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("252", - "MIR4567890123456789012345ENDMIR4567890123456789012345END11112222" - ); + testSerializationImpl("252", "MIR4567890123456789012345ENDMIR4567890123456789012345END11112222"); } @Test @@ -44,5 +42,4 @@ public void testParse252() { assertEquals("1111", f.getComponent3()); assertEquals("2222", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field257Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field257Test.java index 7de1db6ee..60c33ed13 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field257Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field257Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,15 +37,13 @@ public class Field257Test extends AbstractFieldTest { * FOOBARABCDEF210117111122223333 */ private static final String EXAMPLE1_FIELD_257 = "FOOBARXXXXXX731019121213139999"; + private static final String EXAMPLE2_FIELD_257 = "FOOBARABCDEF210117111122223333"; @Override @Test public void testSerialization() { - testSerializationImpl("257", - EXAMPLE1_FIELD_257, - EXAMPLE2_FIELD_257 - ); + testSerializationImpl("257", EXAMPLE1_FIELD_257, EXAMPLE2_FIELD_257); } @Test @@ -85,7 +83,6 @@ public void testParse257Ex1() { assertEquals("1212", f.getComponent3()); assertEquals("1313", f.getComponent4()); assertNull(f.getComponent5()); - } @Test @@ -114,5 +111,4 @@ public void testGetValue2() { f = new Field257(v); assertEquals(StringUtils.replace(v, "\n", FINWriterVisitor.SWIFT_EOL), f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field259Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field259Test.java index 5ca3e1fa2..eefe13c82 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field259Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field259Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,9 +38,7 @@ public class Field259Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("259", - EXAMPLE1_FIELD_259 - ); + testSerializationImpl("259", EXAMPLE1_FIELD_259); } @Test @@ -112,5 +110,4 @@ public void testGetValue1() { Field259 f = new Field259(EXAMPLE1_FIELD_259); assertEquals(EXAMPLE1_FIELD_259, f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field26ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field26ATest.java index 98716f207..5477e1dbf 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field26ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field26ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,15 @@ public class Field26ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("26A", + testSerializationImpl( + "26A", "AAAABBBBCCCCDDDD/FFFF", "68364118512/8516", "68364119321/9330", "68489165771/5775", "68489166203/6212", "68371148100/8104", - "68371148100" - ); + "68371148100"); } /** @@ -99,4 +99,4 @@ public void testField26A_Number() { assertNull(f.getComponent2()); assertEquals("68371148100", f.getValue()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field26CTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field26CTest.java index 4c6252395..5ecaeba9f 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field26CTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field26CTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +30,7 @@ public class Field26CTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("26C", - "A/B/CCCCCDDDDEEEE" - ); + testSerializationImpl("26C", "A/B/CCCCCDDDDEEEE"); } /** @@ -149,5 +147,4 @@ public void testField26C_DenominationForm() { assertEquals("EEEE", f.getComponent5()); assertEquals("FFFFFFFF", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field281Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field281Test.java index 54c2515a9..e0f078c69 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field281Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field281Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field281Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("281", - "1020MIR4567890123456789012345678AFOO" - ); + testSerializationImpl("281", "1020MIR4567890123456789012345678AFOO"); } @Test @@ -39,5 +37,4 @@ public void testParse281() { assertEquals("A", f.getComponent3()); assertEquals("FOO", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field31FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field31FTest.java index c08123a4f..049d6b439 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field31FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field31FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field31FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("31F", - "a\nb\nc\nd" - ); + testSerializationImpl("31F", "a\nb\nc\nd"); } @Test @@ -63,5 +61,4 @@ public void testField31F() { assertEquals("131228", f.getComponent2()); assertEquals("OSAKA WEEKEND", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field31XTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field31XTest.java index 531adb2c9..2b9c621f3 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field31XTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field31XTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field31XTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("31X", - "1312011212", - "FOO" - ); + testSerializationImpl("31X", "1312011212", "FOO"); } /** @@ -61,5 +58,4 @@ public void testField31X() { assertNull(f.getComponent2()); assertEquals("FOO", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field32ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field32ATest.java index 6dff0e684..ad24c891d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field32ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field32ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,20 +17,16 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.Calendar; +import org.junit.jupiter.api.Test; public class Field32ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("32A", - "010203USD123", - "081001USD30625,00" - ); + testSerializationImpl("32A", "010203USD123", "081001USD30625,00"); } @Test @@ -42,7 +38,7 @@ public void testParse32A() { assertEquals(3, f.getComponent1AsCalendar().get(Calendar.DATE)); assertEquals("USD", f.getComponent2()); assertEquals(new BigDecimal("123"), f.getComponent3AsBigDecimal()); - //081001USD30625,00 + // 081001USD30625,00 } @Test @@ -111,5 +107,4 @@ public void testTicketAmountSize() { assertEquals("EUR", f.getComponent2()); assertEquals(new BigDecimal("1765432"), f.getComponent3AsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field32BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field32BTest.java index 608f01b2c..65b670bb0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field32BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field32BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,18 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field32BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("32B", - "USD123" - ); + testSerializationImpl("32B", "USD123"); } @Test @@ -59,5 +56,4 @@ public void testField32B() { assertEquals("123,45", f.getComponent2()); assertEquals(new BigDecimal("123.45"), f.getComponent2AsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field32KTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field32KTest.java index 72c33a494..875bf9072 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field32KTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field32KTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field32KTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("32K", - "D123AAAEUR1234,56", - "123AAAEUR1234,56" - ); + testSerializationImpl("32K", "D123AAAEUR1234,56", "123AAAEUR1234,56"); } /** @@ -85,5 +82,4 @@ public void testField32K() { assertEquals("EUR", f.getComponent4()); assertEquals("1234,56", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field335Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field335Test.java index f35e3aea5..c0780d3cf 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field335Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field335Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,15 +36,13 @@ public class Field335Test extends AbstractFieldTest { * 1800010606BANKBEBBAXXX0008222211100DEUTDEFFXXXX1802 */ private static final String EXAMPLE1_FIELD_335 = "1522010605VNDZBET2AXXX0018000377999BANKBEBBXXXX"; + private static final String EXAMPLE2_FIELD_335 = "1800010606BANKBEBBAXXX0008222211100DEUTDEFFXXXX1802"; @Override @Test public void testSerialization() { - testSerializationImpl("335", - EXAMPLE1_FIELD_335, - EXAMPLE2_FIELD_335 - ); + testSerializationImpl("335", EXAMPLE1_FIELD_335, EXAMPLE2_FIELD_335); } @Test @@ -123,5 +121,4 @@ public void testGetValue2() { f = new Field335(v); assertEquals(StringUtils.replace(v, "\n", FINWriterVisitor.SWIFT_EOL), f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field33GTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field33GTest.java index 393dc3735..eb1f1a189 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field33GTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field33GTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field33GTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("33G", - "USD123,4FOO" - ); + testSerializationImpl("33G", "USD123,4FOO"); } /** @@ -65,5 +63,4 @@ public void testField33G() { assertEquals("123,4", f.getComponent2()); assertEquals("FOO", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field343Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field343Test.java index 6f6c4b6d4..d14ee20af 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field343Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field343Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,7 @@ public class Field343Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("343", - "101 202 103 202" - ); + testSerializationImpl("343", "101 202 103 202"); } @Test @@ -50,5 +48,4 @@ public void testParse343() { assertEquals("202", f.getComponent2()); assertEquals("103", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field345Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field345Test.java index 64c9e69e6..2e214fc07 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field345Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field345Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field345Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("345", - "101202103" - ); + testSerializationImpl("345", "101202103"); } @Test @@ -44,5 +42,4 @@ public void testParse345() { assertEquals("202", f.getComponent2()); assertEquals("103", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field34FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field34FTest.java index 7b2d684af..9adf839b3 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field34FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field34FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,18 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field34FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("34F", - "aaab123,45" - ); + testSerializationImpl("34F", "aaab123,45"); } @Test @@ -104,5 +101,4 @@ public void testField19AString() { assertEquals("123,45", f.getComponent3()); assertEquals(new BigDecimal("123.45"), f.getComponent3AsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field35BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field35BTest.java index e26c0bd5a..de304d465 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field35BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field35BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,17 +27,14 @@ public class Field35BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("35B", - "ISIN HELLO\nAAAA\nBBBB\nCCCC", - "AAAA\nBBBB\nCCCC\nDDDD" - ); + testSerializationImpl("35B", "ISIN HELLO\nAAAA\nBBBB\nCCCC", "AAAA\nBBBB\nCCCC\nDDDD"); } @Test public void testParse() { Field35B f = new Field35B(); - //remaining lines are ignored by parser + // remaining lines are ignored by parser f = new Field35B("ISIN HELLO\nAAAA\nBBBB\nCCCC\nDDDD\nEEEE\nFFFF\nGGGG"); assertEquals("ISIN", f.getComponent1()); assertEquals("HELLO", f.getComponent2()); @@ -102,5 +99,4 @@ public void testGetValue_3() { f = new Field35B(v); assertEquals(StringUtils.replace(v, "\n", FINWriterVisitor.SWIFT_EOL), f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field36ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field36ETest.java index abe83434e..ddf7c5007 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field36ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field36ETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,12 @@ import org.junit.jupiter.api.Test; - public class Field36ETest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("36E", - ":1234//ABCD/c123", - ":1234//ABCD/123" - ); + testSerializationImpl("36E", ":1234//ABCD/c123", ":1234//ABCD/123"); } @Test @@ -84,5 +80,4 @@ public void testParse() { assertEquals("c", f.getComponent3()); assertEquals("123", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field37ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field37ATest.java index b2fc35685..63589cb48 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field37ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field37ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,7 @@ public class Field37ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("37A", - "1234//131201AFOO/ABC" - ); + testSerializationImpl("37A", "1234//131201AFOO/ABC"); } /** @@ -97,5 +95,4 @@ public void testField37A() { assertEquals("FOO", f.getComponent4()); assertEquals("ABC", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field37HTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field37HTest.java index fdd470843..30ebabcf8 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field37HTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field37HTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field37HTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("37H", - "D9,75", - "DN123" - ); + testSerializationImpl("37H", "D9,75", "DN123"); } @Test @@ -93,5 +89,4 @@ public void testFromMt935() { assertNull(f.getComponent2()); assertEquals(new BigDecimal("9.75"), f.getComponentAs(3, Number.class)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field38GTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field38GTest.java index 6989122b7..4fddb8071 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field38GTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field38GTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,7 @@ public class Field38GTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("38G", - "11A/22b" - ); + testSerializationImpl("38G", "11A/22b"); } @Test @@ -39,5 +37,4 @@ public void test() { assertEquals(22, f.getComponent3AsLong()); assertEquals("b", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field41DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field41DTest.java index ceebfa8bd..cb1eaa731 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field41DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field41DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,10 +32,7 @@ public void setup() { @Override @Test public void testSerialization() { - testSerializationImpl("41D", - "ANY BANK\r\nBY NEGOTIATION", - "A\r\nB\r\nC\r\nD\r\nE" - ); + testSerializationImpl("41D", "ANY BANK\r\nBY NEGOTIATION", "A\r\nB\r\nC\r\nD\r\nE"); } @Test @@ -111,5 +108,4 @@ public void testName() { Field41D f = new Field41D(s); assertFalse(StringUtils.isEmpty(f.getComponent5())); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field45BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field45BTest.java index 5aaa7ee22..afbd65a47 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field45BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field45BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,9 +33,8 @@ public void testAsTag() { @Test public void testWithNull() { - Field45B field = new Field45B( (String) null); + Field45B field = new Field45B((String) null); Narrative narrative = field.narrative(); assertTrue(narrative.isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field48Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field48Test.java index c282921a7..4890ad14d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field48Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field48Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,10 +31,7 @@ public void setup() { @Override @Test public void testSerialization() { - testSerializationImpl("48", - "1", - "1/FOO" - ); + testSerializationImpl("48", "1", "1/FOO"); } @Test @@ -51,5 +48,4 @@ public void testGetValue2() { f.setComponent2("FOO"); assertEquals("1234/FOO", f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field49ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field49ATest.java index b9400fde4..cd17abb46 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field49ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field49ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,7 @@ public void setup() { @Override @Test public void testSerialization() { - testSerializationImpl("49A", - "123", - "123\nFOO", - "123\nFOO\nBAR" - ); + testSerializationImpl("49A", "123", "123\nFOO", "123\nFOO\nBAR"); } @Test @@ -52,5 +48,4 @@ public void testGetValue() { f.setComponent2("FOO\nBAR"); assertEquals("1234\r\nFOO\nBAR", f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field50ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field50ATest.java index 3db04c145..c7f3c1eac 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field50ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field50ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field50ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("50A", - "bbb", - "/acc\nbbb" - ); + testSerializationImpl("50A", "bbb", "/acc\nbbb"); } @Test @@ -44,5 +41,4 @@ public void testGetValue3() { assertNull(f.getComponent1()); assertEquals("bbb", f.getComponent2()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field50FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field50FTest.java index 57b044dcb..3f07a6959 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field50FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field50FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,37 +26,16 @@ public class Field50FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("50F", + testSerializationImpl( + "50F", "FFF\nA/B\nC/D\nE/F", - - "AAAA/BB/CCCCCCCC/DD1234567\n" + - "1/JOHN SMITH\n" + - "2/HIGH STREET 6, APT 6C\n" + - "3/BE/BRUSSELS", - + "AAAA/BB/CCCCCCCC/DD1234567\n" + "1/JOHN SMITH\n" + "2/HIGH STREET 6, APT 6C\n" + "3/BE/BRUSSELS", "/123456\n1/JOHN SMITH", - "CODE/AR\n1/JOHN SMITH", - - "/12345678\n" + - "1/SMITH JOHN\n" + - "2/299, PARK AVENUE\n" + - "3/US/NEW YORK, NY 10017", - - "/BE30001216371411\n" + - "1/PHILIPS MARK\n" + - "4/19720830\n" + - "5/BE/BRUSSELS", - - "DRLC/BE/BRUSSELS/NB0949042\n" + - "1/DUPONT JACQUES\n" + - "2/HIGH STREET 6, APT 6C\n" + - "3/BE/BRUSSELS", - - "NIDN/DE/121231234342\n" + - "1/MANN GEORG\n" + - "6/DE/ABC BANK/1234578293" - ); + "/12345678\n" + "1/SMITH JOHN\n" + "2/299, PARK AVENUE\n" + "3/US/NEW YORK, NY 10017", + "/BE30001216371411\n" + "1/PHILIPS MARK\n" + "4/19720830\n" + "5/BE/BRUSSELS", + "DRLC/BE/BRUSSELS/NB0949042\n" + "1/DUPONT JACQUES\n" + "2/HIGH STREET 6, APT 6C\n" + "3/BE/BRUSSELS", + "NIDN/DE/121231234342\n" + "1/MANN GEORG\n" + "6/DE/ABC BANK/1234578293"); } /** @@ -73,7 +52,7 @@ public void testSerialization2() { assertEquals("/1234567", f.getValue()); f.setComponent1("1234567"); - assertEquals("1234567", f.getValue()); //the slash will not be added + assertEquals("1234567", f.getValue()); // the slash will not be added f.setComponent1("1234/AR/ABC"); assertEquals("1234/AR/ABC", f.getValue()); @@ -211,10 +190,8 @@ public void testParse_09() { @Test public void testParse_10() { - Field50F f = new Field50F("AAAA/BB/CCCCCCCC/DD1234567\n" + - "1/JOHN SMITH\n" + - "2/HIGH STREET 6, APT 6C\n" + - "3/BE/BRUSSELS"); + Field50F f = new Field50F( + "AAAA/BB/CCCCCCCC/DD1234567\n" + "1/JOHN SMITH\n" + "2/HIGH STREET 6, APT 6C\n" + "3/BE/BRUSSELS"); assertEquals("AAAA/BB/CCCCCCCC/DD1234567", f.getComponent1()); assertEquals("1", f.getComponent2()); assertEquals("JOHN SMITH", f.getComponent3()); @@ -231,10 +208,7 @@ public void testParse_11() { /* * test sample value */ - final String value = "/1234567890\r\n" + - "1/JOHN SMITH\r\n" + - "2/HIGH STREET 6, APT 6C\r\n" + - "3/BE/BRUSSELS"; + final String value = "/1234567890\r\n" + "1/JOHN SMITH\r\n" + "2/HIGH STREET 6, APT 6C\r\n" + "3/BE/BRUSSELS"; /* * parse value into components @@ -263,10 +237,9 @@ public void testParse_11() { @Test public void testParse_12() { - Field50F f = new Field50F("CUST/HK/11-222-333-44-55-6666-77777\n" + - "1/NORTH WEST LIMITED 38 FOOBAR\n" + - "2/BLOCK 2 BSAS COVE BRASILIA\n" + - "3/HK/HONG KONG, HONG KONG BR NO"); + Field50F f = new Field50F("CUST/HK/11-222-333-44-55-6666-77777\n" + "1/NORTH WEST LIMITED 38 FOOBAR\n" + + "2/BLOCK 2 BSAS COVE BRASILIA\n" + + "3/HK/HONG KONG, HONG KONG BR NO"); assertEquals("CUST/HK/11-222-333-44-55-6666-77777", f.getComponent1()); assertEquals("1", f.getComponent2()); assertEquals("NORTH WEST LIMITED 38 FOOBAR", f.getComponent3()); @@ -278,36 +251,27 @@ public void testParse_12() { @Test public void testDynamicLabels() { - Field50F f = new Field50F("/12345678\n" + - "1/SMITH JOHN\n" + - "2/299, PARK AVENUE\n" + - "3/US/NEW YORK, NY 10017"); + Field50F f = + new Field50F("/12345678\n" + "1/SMITH JOHN\n" + "2/299, PARK AVENUE\n" + "3/US/NEW YORK, NY 10017"); assertEquals("Account", f.getComponentLabel(1)); assertEquals("Name of the Ordering Customer", f.getComponentLabel(3)); assertEquals("Address Line", f.getComponentLabel(5)); assertEquals("Country and Town", f.getComponentLabel(7)); - f = new Field50F("/BE30001216371411\n" + - "1/PHILIPS MARK\n" + - "4/19720830\n" + - "5/BE/BRUSSELS"); + f = new Field50F("/BE30001216371411\n" + "1/PHILIPS MARK\n" + "4/19720830\n" + "5/BE/BRUSSELS"); assertEquals("Account", f.getComponentLabel(1)); assertEquals("Name of the Ordering Customer", f.getComponentLabel(3)); assertEquals("Date of Birth", f.getComponentLabel(5)); assertEquals("Place of Birth", f.getComponentLabel(7)); - f = new Field50F("DRLC/BE/BRUSSELS/NB0949042\n" + - "1/DUPONT JACQUES\n" + - "2/HIGH STREET 6, APT 6C\n" + - "3/BE/BRUSSELS"); + f = new Field50F( + "DRLC/BE/BRUSSELS/NB0949042\n" + "1/DUPONT JACQUES\n" + "2/HIGH STREET 6, APT 6C\n" + "3/BE/BRUSSELS"); assertEquals("Party Identifier", f.getComponentLabel(1)); assertEquals("Name of the Ordering Customer", f.getComponentLabel(3)); assertEquals("Address Line", f.getComponentLabel(5)); assertEquals("Country and Town", f.getComponentLabel(7)); - f = new Field50F("NIDN/DE/121231234342\n" + - "1/MANN GEORG\n" + - "6/DE/ABC BANK/1234578293"); + f = new Field50F("NIDN/DE/121231234342\n" + "1/MANN GEORG\n" + "6/DE/ABC BANK/1234578293"); assertEquals("Party Identifier", f.getComponentLabel(1)); assertEquals("Name of the Ordering Customer", f.getComponentLabel(3)); assertEquals("Customer Identification Number", f.getComponentLabel(5)); @@ -315,10 +279,7 @@ public void testDynamicLabels() { @Test public void testAddedAPI() { - final String value = "/1234567890\r\n" + - "1/JOHN SMITH\r\n" + - "2/HIGH STREET 6, APT 6C\r\n" + - "3/BE/BRUSSELS"; + final String value = "/1234567890\r\n" + "1/JOHN SMITH\r\n" + "2/HIGH STREET 6, APT 6C\r\n" + "3/BE/BRUSSELS"; Field50F f = new Field50F(value); assertTrue(f.contains(1)); @@ -339,16 +300,17 @@ public void testAddedAPI() { */ @Test public void testIssue30() { - Tag t = new Tag("50F", "/123456\n" + - "1/ABC11\n" + - "2/ABC21\n" + - "2/ABC22\n" + - "2/ABC23\n" + - "2/ABC24\n" + - "2/ABC25\n" + - "2/ABC26\n" + - "2/ABC27\n" + - "2/ABC28"); + Tag t = new Tag( + "50F", + "/123456\n" + "1/ABC11\n" + + "2/ABC21\n" + + "2/ABC22\n" + + "2/ABC23\n" + + "2/ABC24\n" + + "2/ABC25\n" + + "2/ABC26\n" + + "2/ABC27\n" + + "2/ABC28"); Field50F f = new Field50F(t); // parser drops invalid additional lines @@ -359,5 +321,4 @@ public void testIssue30() { System.out.println(SwiftParseUtils.getTokenSecondLast(line, "/")); }); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field50GTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field50GTest.java index d7f093f2e..7caea6e68 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field50GTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field50GTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,12 @@ import org.junit.jupiter.api.Test; - public class Field50GTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("50G", - "/0000001111000000\r\nBNPPARIBAS" - ); + testSerializationImpl("50G", "/0000001111000000\r\nBNPPARIBAS"); } @Test @@ -36,5 +33,4 @@ public void testGetValue() { assertEquals(f.getComponent1(), "0000001111000000"); assertEquals(f.getComponent2(), "BNPPARIBAS"); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field50HTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field50HTest.java index 5fd064f40..d022f000c 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field50HTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field50HTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,12 @@ import org.junit.jupiter.api.Test; - public class Field50HTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("50H", - "/0000001111000000\r\nBNPPARIBAS\r\n66 VICTOIRE\r\nPARIS" - ); + testSerializationImpl("50H", "/0000001111000000\r\nBNPPARIBAS\r\n66 VICTOIRE\r\nPARIS"); } @Test @@ -38,5 +35,4 @@ public void testGetValue() { assertEquals(f.getComponent3(), "66 VICTOIRE"); assertEquals(f.getComponent4(), "PARIS"); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field50KTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field50KTest.java index 042d9e9fb..9b656cb0e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field50KTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field50KTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field50KTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("50K", - "/acc", - "/acc\nbbb\nccc\nddd\neee" - ); + testSerializationImpl("50K", "/acc", "/acc\nbbb\nccc\nddd\neee"); } @Test @@ -65,5 +62,4 @@ public void testGetValue3() { assertEquals("ddd", f.getComponent4()); assertEquals("eee", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field52DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field52DTest.java index 8febc675b..669c4e444 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field52DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field52DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,17 +25,12 @@ public class Field52DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("52D", - "//SC1111111\r\nXXX XX\r\n111 XXXXXXXXX XX XXXXXX", - "/D/SC1111111" - ); + testSerializationImpl("52D", "//SC1111111\r\nXXX XX\r\n111 XXXXXXXXX XX XXXXXX", "/D/SC1111111"); } @Test public void test52D_issue6() { - Field52D f = new Field52D("//SC1111111\r\n" - + "XXX XX\r\n" - + "111 XXXXXXXXX XX XXXXXX"); + Field52D f = new Field52D("//SC1111111\r\n" + "XXX XX\r\n" + "111 XXXXXXXXX XX XXXXXX"); assertNull(f.getComponent1()); assertEquals("/SC1111111", f.getComponent2()); assertEquals("XXX XX", f.getComponent3()); @@ -55,5 +50,4 @@ public void test52D_3() { assertNull(f.getComponent1()); assertEquals("D2/SC1111111", f.getComponent2()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field53ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field53ATest.java index 4419a55d9..c2f78fc03 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field53ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field53ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,13 +25,13 @@ public class Field53ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("53A", + testSerializationImpl( + "53A", "/00010001380002000114", "/00010001/3800-02000114", "/C/1234/56", "/D/123\nABCDAEAD", - "ABCDAEAD" - ); + "ABCDAEAD"); } @Test @@ -141,5 +141,4 @@ public void testGetValueDisplay() { assertNull(f.getDCMark()); assertNull(f.getIdentifierCode()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field53BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field53BTest.java index e4ab529b8..9a37963e0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field53BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field53BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,7 @@ public class Field53BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("53B", - "/00010001380002000114", - "/D/1234/56", - "/D\nabcd" - ); + testSerializationImpl("53B", "/00010001380002000114", "/D/1234/56", "/D\nabcd"); } @Test @@ -97,5 +93,4 @@ public void testGetValueDisplay() { assertNull(f.getDCMark()); assertNull(f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field54BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field54BTest.java index 0a4d676f2..c14491ced 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field54BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field54BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,7 @@ public class Field54BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("54B", - "/00010001380002000114", - "/D/1234/56", - "/D\nabcd" - ); + testSerializationImpl("54B", "/00010001380002000114", "/D/1234/56", "/D\nabcd"); } @Test @@ -97,5 +93,4 @@ public void testGetValueDisplay() { assertNull(f.getDCMark()); assertNull(f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field57ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field57ATest.java index ef322aad8..9e57d6c6d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field57ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field57ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,7 @@ public class Field57ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("57A", - "/D/1234\nFOOBAR", - "/1234\nFOOBAR", - "FOOBAR" - ); + testSerializationImpl("57A", "/D/1234\nFOOBAR", "/1234\nFOOBAR", "FOOBAR"); } @Test @@ -48,5 +44,4 @@ public void test_getValue2() { f.setComponent3("FOOBARXX"); assertEquals("/1234567890" + FINWriterVisitor.SWIFT_EOL + "FOOBARXX", f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field57CTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field57CTest.java index ed61c735e..8c4e25681 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field57CTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field57CTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,7 @@ public class Field57CTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("57C", - "/acc/bb" - ); + testSerializationImpl("57C", "/acc/bb"); } @Test @@ -46,5 +44,4 @@ public void testGetComponent1c() { Field57C f = new Field57C("/acc/bb"); assertEquals("acc/bb", f.getComponent1()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field57DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field57DTest.java index b3664c2b3..cfdf4a63d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field57DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field57DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,7 @@ public class Field57DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("57D", - "//\nBIODATA LIMITED\nLONDON WC1 23H\nUNITED KINGDOM", - "//" - ); + testSerializationImpl("57D", "//\nBIODATA LIMITED\nLONDON WC1 23H\nUNITED KINGDOM", "//"); } @Test @@ -38,5 +35,4 @@ public void testEmptyPartyField() { assertEquals("/", f.getComponent2()); assertEquals("", f.getAccount()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field58DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field58DTest.java index 2f230672a..532736453 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field58DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field58DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field58DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("58D", - "/00010001380002000114" - ); + testSerializationImpl("58D", "/00010001380002000114"); } @Test @@ -136,5 +134,4 @@ public void testGetValueDisplay() { assertNull(f.getDCMark()); assertNull(f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field59FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field59FTest.java index 73e7d4d55..783d7e2b0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field59FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field59FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,28 +24,16 @@ public class Field59FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("59F", - "/MT27SBMT59999999026977001\n" + - "1/FOO LTD\n" + - "2/99 FOO RD\n" + - "2/GZIRA\n" + - "3/MT/MALTA", - "/CR79015202220005614288\n" + - "1/Name 1\n" + - "2/Address 1\n" + - "2/Address 2\n" + - "3/DZ/1000" - ); + testSerializationImpl( + "59F", + "/MT27SBMT59999999026977001\n" + "1/FOO LTD\n" + "2/99 FOO RD\n" + "2/GZIRA\n" + "3/MT/MALTA", + "/CR79015202220005614288\n" + "1/Name 1\n" + "2/Address 1\n" + "2/Address 2\n" + "3/DZ/1000"); } @Test public void testGetValue() { final Field59F f = new Field59F( - "/MT27SBMT59999999026977001\n" + - "1/FOO LTD\n" + - "2/99 FOO RD\n" + - "2/GZIRA\n" + - "3/MT/MALTA"); + "/MT27SBMT59999999026977001\n" + "1/FOO LTD\n" + "2/99 FOO RD\n" + "2/GZIRA\n" + "3/MT/MALTA"); assertEquals("MT27SBMT59999999026977001", f.getComponent1()); assertTrue(f.contains(1)); @@ -73,11 +61,7 @@ public void testGetValue() { @Test public void testGetValue2() { final Field59F f = new Field59F( - "/CR79015202220005614288\n" + - "1/Name 1\n" + - "2/Address 1\n" + - "2/Address 2\n" + - "3/DZ/1000"); + "/CR79015202220005614288\n" + "1/Name 1\n" + "2/Address 1\n" + "2/Address 2\n" + "3/DZ/1000"); assertEquals("CR79015202220005614288", f.getComponent1()); assertEquals("1", f.getComponent2()); assertEquals("Name 1", f.getComponent3()); @@ -88,5 +72,4 @@ public void testGetValue2() { assertEquals("3", f.getComponent8()); assertEquals("DZ/1000", f.getComponent9()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field59Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field59Test.java index 599e8b77c..b404ed8b4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field59Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field59Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field59Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("59", - "/acc\nbbb\nccc\nddd\neee" - ); + testSerializationImpl("59", "/acc\nbbb\nccc\nddd\neee"); } @Test @@ -67,7 +65,10 @@ public void testGetWithLabelsRepetitions() { assertEquals("ddd", f.getNameAndAddressLine2()); assertEquals("eee", f.getNameAndAddressLine3()); assertEquals("fff", f.getNameAndAddressLine4()); - assertEquals("ccc" + FINWriterVisitor.SWIFT_EOL + "ddd" + FINWriterVisitor.SWIFT_EOL + "eee" + FINWriterVisitor.SWIFT_EOL + "fff", f.getNameAndAddress(FINWriterVisitor.SWIFT_EOL)); + assertEquals( + "ccc" + FINWriterVisitor.SWIFT_EOL + "ddd" + FINWriterVisitor.SWIFT_EOL + "eee" + + FINWriterVisitor.SWIFT_EOL + "fff", + f.getNameAndAddress(FINWriterVisitor.SWIFT_EOL)); assertEquals("ccc ddd eee fff", f.getNameAndAddress(" ")); assertEquals("cccdddeeefff", f.getNameAndAddress()); f.setComponent3(null); @@ -94,7 +95,9 @@ public void testSetWithLabelsRepetitions() { f = new Field59(); f.setNameAndAddress("aaaa\nbbbb\ncccc"); - assertEquals("aaaa" + FINWriterVisitor.SWIFT_EOL + "bbbb" + FINWriterVisitor.SWIFT_EOL + "cccc", f.getNameAndAddress(FINWriterVisitor.SWIFT_EOL)); + assertEquals( + "aaaa" + FINWriterVisitor.SWIFT_EOL + "bbbb" + FINWriterVisitor.SWIFT_EOL + "cccc", + f.getNameAndAddress(FINWriterVisitor.SWIFT_EOL)); assertEquals("aaaa bbbb cccc", f.getNameAndAddress(" ")); assertEquals("aaaabbbbcccc", f.getNameAndAddress()); } @@ -108,5 +111,4 @@ public void testMultilineApiGetLine1Empty() { public void testMultilineApiGetLine1Null() { assertNull(new Field59((String) null).getLine(1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field60FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field60FTest.java index f0b6d41ed..47e8d9d74 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field60FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field60FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,7 @@ public class Field60FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("60F", - "D121212USD1234,56", - "121212USD1234,56" - ); + testSerializationImpl("60F", "D121212USD1234,56", "121212USD1234,56"); } @Test @@ -59,5 +56,4 @@ public void testSetAmountTag() { public void testSetDCMarkTag() { assertEquals("D", new Field60F().setDCMark("D").asTag().getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field61Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field61Test.java index 706e9f631..442588794 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field61Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field61Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,24 +17,23 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.Calendar; +import org.junit.jupiter.api.Test; public class Field61Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("61", + testSerializationImpl( + "61", "081027C858,28NOPT12716219\n1524/6006/TESORO NACIONAL", "1001060106D341,34N422NONREF\r\nFURTHER REFERENCE", "090227C291553,62NAYG13391140\n1524/6009/TRASPASO AUTOMATICO AL", "020626D120000,NCOLABCD//12345", "1512290201EDZ0000000002,2222FBNKNONREF", - "170717D203336,94NTRFR016341554//2395200 \n01P" - ); + "170717D203336,94NTRFR016341554//2395200 \n01P"); } @Test @@ -81,8 +80,7 @@ public void testParse61_01() { @Test public void testParse_02() { - String val = "081024" + "C" + "10215,NOPT12710361\n" - + "1524/6006/TESORO NACIONAL"; + String val = "081024" + "C" + "10215,NOPT12710361\n" + "1524/6006/TESORO NACIONAL"; Field61 f = new Field61(val); assertNotNull(f); assertEquals(2008, f.getComponent1AsCalendar().get(Calendar.YEAR)); @@ -155,13 +153,13 @@ public void testParse_05() { public void test_DCMark() { /* - C Credit - D Debit - EC Expected Credit - ED Expected Debit - RC Reversal of Credit (debit entry) - RD Reversal of Debit (credit entry) - */ + C Credit + D Debit + EC Expected Credit + ED Expected Debit + RC Reversal of Credit (debit entry) + RD Reversal of Debit (credit entry) + */ Field61 field61; field61 = new Field61("1512290201C0000000002,2222FBNKNONREF"); @@ -186,13 +184,13 @@ RD Reversal of Debit (credit entry) @Test public void test_DCMArk_with_funds_code() { /* - C Credit - D Debit - EC Expected Credit - ED Expected Debit - RC Reversal of Credit (debit entry) - RD Reversal of Debit (credit entry) - */ + C Credit + D Debit + EC Expected Credit + ED Expected Debit + RC Reversal of Credit (debit entry) + RD Reversal of Debit (credit entry) + */ Field61 field61; field61 = new Field61("1512290201CZ0000000002,2222FBNKNONREF"); @@ -234,5 +232,4 @@ public void testPreserveWhitespaces() { assertEquals("2395200 ", f.getComponent9()); assertEquals("01P", f.getComponent10()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field64Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field64Test.java index adc1fafa8..e470950e4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field64Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field64Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field64Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("64", - "090822EUR1234,56", - "D090822EUR1234,56" - ); + testSerializationImpl("64", "090822EUR1234,56", "D090822EUR1234,56"); } @Test @@ -53,5 +50,4 @@ public void testField64String() { assertEquals("EUR", f.getComponent3()); assertEquals("1234,56", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field68ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field68ATest.java index 7b7ecd8e9..71098f395 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field68ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field68ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field68ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("68A", - "130301FOO130302/1234/999", - "130301FOO130302/1234/999//ABC" - ); + testSerializationImpl("68A", "130301FOO130302/1234/999", "130301FOO130302/1234/999//ABC"); } /** @@ -124,5 +121,4 @@ public void testField68A() { assertEquals("999", f.getComponent5()); assertEquals("ABC", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field69BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field69BTest.java index 887e7a3db..06b1194d7 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field69BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field69BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,18 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.util.Calendar; +import org.junit.jupiter.api.Test; public class Field69BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("69B", - ":ABC//20111224131415/20111019142534" - ); + testSerializationImpl("69B", ":ABC//20111224131415/20111019142534"); } @Test @@ -129,5 +126,4 @@ public void testParse69B() { assertEquals(25, f.getComponent5AsCalendar().get(Calendar.MINUTE)); assertEquals(34, f.getComponent5AsCalendar().get(Calendar.SECOND)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field69DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field69DTest.java index 910823e2e..77bd6fd1b 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field69DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field69DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.util.Calendar; +import org.junit.jupiter.api.Test; public class Field69DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("69D", - ":ABC//20111224131415/DEF", - ":PRIC//20210326091730/ONGO" - ); + testSerializationImpl("69D", ":ABC//20111224131415/DEF", ":PRIC//20210326091730/ONGO"); } @Test @@ -106,6 +102,4 @@ public void testParse69D() { assertEquals("091730", f.getComponent3()); assertEquals("ONGO", f.getComponent4()); } - } - diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field69FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field69FTest.java index 5d0ef26de..ea6f75c11 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field69FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field69FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,18 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.util.Calendar; +import org.junit.jupiter.api.Test; public class Field69FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("69F", - ":ABC//DEF/20111224131415" - ); + testSerializationImpl("69F", ":ABC//DEF/20111224131415"); } @Test @@ -84,5 +81,4 @@ public void testParse69F() { assertEquals(14, f.getComponent4AsCalendar().get(Calendar.MINUTE)); assertEquals(15, f.getComponent4AsCalendar().get(Calendar.SECOND)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field70DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field70DTest.java index 43c0ae180..ae05b9d75 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field70DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field70DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,7 @@ public class Field70DTest { @Test public void testParse() { - Field70D f = new Field70D(":REAS//INVALID FIELD 95P..DEAG//ABCDDEFFCU\n" + - "S\n" + - "/SETT/EUR145123"); + Field70D f = new Field70D(":REAS//INVALID FIELD 95P..DEAG//ABCDDEFFCU\n" + "S\n" + "/SETT/EUR145123"); // get components API assertEquals("REAS", f.getComponent1()); @@ -45,5 +43,4 @@ public void testParse() { assertEquals("ABCDDEFFCU", StringUtils.substringAfter(f.getComponent2(), "//")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field70ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field70ETest.java index 9e41fbef2..acd14b071 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field70ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field70ETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,12 @@ import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; - public class Field70ETest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("70E", - ":2134//goobar", - "://goobar" - ); + testSerializationImpl("70E", ":2134//goobar", "://goobar"); } @Test @@ -92,7 +88,7 @@ public void testField70ELines() { assertNull(f.getComponent10()); assertNull(f.getComponent11()); - //remaining lines are ignored by parser + // remaining lines are ignored by parser f = new Field70E("://goobar\nAAAA\nBBBB\nCCCC\nDDDD\nEEEE\nFFFF\nGGGG\nHHHH\nIIII\nJJJJ\nKKKK"); assertEquals("goobar", f.getComponent2()); assertEquals("AAAA", f.getComponent3()); @@ -111,9 +107,7 @@ public void testField70ELines() { */ @Test public void testField70ELines_PreserveSpaces() { - Field70E f = new Field70E(":PACO//The quick brown fox \n" + - "jumps over the\n" + - " the lazy dog"); + Field70E f = new Field70E(":PACO//The quick brown fox \n" + "jumps over the\n" + " the lazy dog"); assertEquals("PACO", f.getQualifier()); assertEquals("The quick brown fox ", f.getNarrativeLine1()); assertEquals("jumps over the", f.getNarrativeLine2()); @@ -142,5 +136,4 @@ public void testJoinNarrative() { f.setComponent1(null); assertEquals("FOO\r\n BAR", StringUtils.substringAfter(f.getValue(), "://")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field70FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field70FTest.java index 8a42d3008..bac891552 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field70FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field70FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,74 +24,73 @@ public class Field70FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("70F", + testSerializationImpl( + "70F", ":ADTX//----REPURCHASE OFFER----\n.\nFTT/N: PURCHASED SHARES WILL BE\nDESTROYED", - ":ABCD//SIMPLE FOO NARRATIVE WITHOUT ANY CODEWORD" - ); + ":ABCD//SIMPLE FOO NARRATIVE WITHOUT ANY CODEWORD"); } @Test public void testField70FString() { - String c2 = "+--------REPURCHASE OFFER---------+\n" + - ".\n" + - "FTT/N: PURCHASED SHARES WILL BE\n" + - "DESTROYED\n" + - ".\n" + - "THE COMPANY ANNOUNCED AN OFFER TO\n" + - "BUY UP TO 18'926'350 OWN SHARES IN\n" + - "ORDER TO REDUCE THE SHARE CAPITAL.\n" + - ".\n" + - "PRICE : NO FIXED PRICE\n" + - "A SECOND TRADING LINE WITH THE\n" + - "ISIN CH0189177055 HAS BEEN\n" + - "ESTABLISHED ON SIX SWISS EXCHANGE.\n" + - ".\n" + - "PLEASE NOTE: UNDER THE SWISS\n" + - "COMPANY ACT, A CAPITAL REDUCTION\n" + - "IS TO BE TREATED AS A PARTIAL\n" + - "LIQUIDATION AND SUBJECT TO A WITH-\n" + - "HOLDING TAX OF 35 PCT PAYABLE ON\n" + - "THE DIFFERENCE BETWEEN THE\n" + - "REPURCHASE PRICE AND THE SHARE\n" + - "NOMINAL VALUE OF CHF 1.00.\n" + - "BENEFICIAL OWNERS DOMICILED IN\n" + - "SWITZERLAND CAN RECLAIM THE FULL\n" + - "AMOUNT OF THE TAX PAID.\n" + - "PERSONS DOMICILED OUTSIDE OF\n" + - "SWITZERLAND CAN RECLAIM THE WITH-\n" + - "HOLDING TAX UNDER ANY DOUBLE\n" + - "TAXATION AGREEMENTS.\n" + - ".\n" + - "PLEASE SELL YOUR SHARES (DISPO)\n" + - "THROUGH THE LEADMANAGER CREDIT\n" + - "SUISSE AG.\n" + - ".\n" + - "PLEASE NOTE: IF YOU HAVE SOLD\n" + - "SECOND-LINE SHARES THROUGH THE LEAD\n" + - "MANAGER CREDIT SUISSE, YOU HAVE TO\n" + - "INSTRUCT SIX SIS WITH SWIFT MT 565\n" + - "TO TRANSFER THE SHARES FROM\n" + - "ORIGINAL-ISIN (FIRST-LINE) TO\n" + - "SECOND-LINE.\n" + - ".\n" + - "PLEASE INDICATE: TRADE-DATE,\n" + - "SETTLEMENT-DATE + YOUR REFFERENCE\n" + - "AND YOUR DIRECT PHONE-NUMBER.\n" + - ".\n" + - "RESTRICTIONS:\n" + - "USA / U.S. PERSONS\n" + - "ALL INVESTORS MUST VERIFY THAT THEY\n" + - "ARE NOT ACTING AGAINST THEIR\n" + - "COUNTRY OF RESIDENCE LAW\n" + - "REGULATIONS.\n" + - "WITH YOUR INSTRUCTION YOU CONFIRM\n" + - "YOUR ELIGIBILITY TO PARTICIPATE IN\n" + - "THE OFFER BEING AWARE OF ANY\n" + - "RESTRICTIONS.\n" + - ".\n" + - "PLEASE IGNORE THE PAYMENT DATE.\n" + - "SETTLEMENT WILL BE 'ONGOING'.\n" + - ".\n"; + String c2 = "+--------REPURCHASE OFFER---------+\n" + ".\n" + + "FTT/N: PURCHASED SHARES WILL BE\n" + + "DESTROYED\n" + + ".\n" + + "THE COMPANY ANNOUNCED AN OFFER TO\n" + + "BUY UP TO 18'926'350 OWN SHARES IN\n" + + "ORDER TO REDUCE THE SHARE CAPITAL.\n" + + ".\n" + + "PRICE : NO FIXED PRICE\n" + + "A SECOND TRADING LINE WITH THE\n" + + "ISIN CH0189177055 HAS BEEN\n" + + "ESTABLISHED ON SIX SWISS EXCHANGE.\n" + + ".\n" + + "PLEASE NOTE: UNDER THE SWISS\n" + + "COMPANY ACT, A CAPITAL REDUCTION\n" + + "IS TO BE TREATED AS A PARTIAL\n" + + "LIQUIDATION AND SUBJECT TO A WITH-\n" + + "HOLDING TAX OF 35 PCT PAYABLE ON\n" + + "THE DIFFERENCE BETWEEN THE\n" + + "REPURCHASE PRICE AND THE SHARE\n" + + "NOMINAL VALUE OF CHF 1.00.\n" + + "BENEFICIAL OWNERS DOMICILED IN\n" + + "SWITZERLAND CAN RECLAIM THE FULL\n" + + "AMOUNT OF THE TAX PAID.\n" + + "PERSONS DOMICILED OUTSIDE OF\n" + + "SWITZERLAND CAN RECLAIM THE WITH-\n" + + "HOLDING TAX UNDER ANY DOUBLE\n" + + "TAXATION AGREEMENTS.\n" + + ".\n" + + "PLEASE SELL YOUR SHARES (DISPO)\n" + + "THROUGH THE LEADMANAGER CREDIT\n" + + "SUISSE AG.\n" + + ".\n" + + "PLEASE NOTE: IF YOU HAVE SOLD\n" + + "SECOND-LINE SHARES THROUGH THE LEAD\n" + + "MANAGER CREDIT SUISSE, YOU HAVE TO\n" + + "INSTRUCT SIX SIS WITH SWIFT MT 565\n" + + "TO TRANSFER THE SHARES FROM\n" + + "ORIGINAL-ISIN (FIRST-LINE) TO\n" + + "SECOND-LINE.\n" + + ".\n" + + "PLEASE INDICATE: TRADE-DATE,\n" + + "SETTLEMENT-DATE + YOUR REFFERENCE\n" + + "AND YOUR DIRECT PHONE-NUMBER.\n" + + ".\n" + + "RESTRICTIONS:\n" + + "USA / U.S. PERSONS\n" + + "ALL INVESTORS MUST VERIFY THAT THEY\n" + + "ARE NOT ACTING AGAINST THEIR\n" + + "COUNTRY OF RESIDENCE LAW\n" + + "REGULATIONS.\n" + + "WITH YOUR INSTRUCTION YOU CONFIRM\n" + + "YOUR ELIGIBILITY TO PARTICIPATE IN\n" + + "THE OFFER BEING AWARE OF ANY\n" + + "RESTRICTIONS.\n" + + ".\n" + + "PLEASE IGNORE THE PAYMENT DATE.\n" + + "SETTLEMENT WILL BE 'ONGOING'.\n" + + ".\n"; Field70F f = new Field70F(":ADTX//" + c2); assertEquals("ADTX", f.getComponent1()); diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field70Test.java b/src/test/java/com/prowidesoftware/swift/model/field/Field70Test.java index afab89954..71d489983 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field70Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field70Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,7 @@ public class Field70Test extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("70", - "a\nb\nc\nd" - ); + testSerializationImpl("70", "a\nb\nc\nd"); } @Test @@ -51,5 +49,4 @@ public void testField70() { assertEquals("b", n.getUnstructuredFragments().get(1)); assertEquals("c", n.getUnstructuredFragments().get(2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field71BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field71BTest.java index 54e6961e8..7c9a2e881 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field71BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field71BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; - +import org.junit.jupiter.api.Test; public class Field71BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("71B", - "/ACGH/B/EUR1,00Fees" - ); + testSerializationImpl("71B", "/ACGH/B/EUR1,00Fees"); } @Test @@ -39,7 +35,7 @@ public void testGetters() { assertEquals("/ACGH/O/EUR1,00Fees", f.getComponent1()); Narrative n = f.narrative(); - //n.getStructured().forEach(System.out::println); + // n.getStructured().forEach(System.out::println); StructuredNarrative structuredNarrative = n.getStructured("ACGH"); assertEquals("ACGH", structuredNarrative.getCodeword()); @@ -77,5 +73,4 @@ public void testGettersScore() { structuredNarrative.setCurrency("EUR/"); assertEquals("EUR/", structuredNarrative.getCurrency()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field77HTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field77HTest.java index 38434d356..1fb2a9101 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field77HTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field77HTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field77HTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("77H", - "ISDA/20200310//2021" - ); + testSerializationImpl("77H", "ISDA/20200310//2021"); } @Test @@ -63,5 +61,4 @@ public void testField77H() { assertEquals("20200310", f.getComponent2()); assertEquals("2021", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field90ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field90ATest.java index 29613a0af..58b6a0768 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field90ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field90ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,20 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field90ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("90A", - ":AAAA//BBBB/N123", - ":AAAA//BBBB/123", - ":DEAL//YIEL/N1234,5" - ); + testSerializationImpl("90A", ":AAAA//BBBB/N123", ":AAAA//BBBB/123", ":DEAL//YIEL/N1234,5"); } @Test @@ -78,5 +73,4 @@ public void testParse90A_3() { assertEquals("1234,5", f.getComponent4()); assertEquals(new BigDecimal("1234.5"), f.getPriceAsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field90FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field90FTest.java index b5715b92a..6fdf307c9 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field90FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field90FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field90FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("90F", - ":DDDD//EEEEEEEE/FFF123/GGG/456" - ); + testSerializationImpl("90F", ":DDDD//EEEEEEEE/FFF123/GGG/456"); } @Test @@ -52,7 +50,7 @@ public void testField90FString() { assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90F(":/"); - //assertTrue(StringUtils.isBlank(f.getComponent1())); + // assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); @@ -155,5 +153,4 @@ public void testField90FString() { assertEquals("GGG", f.getComponent5()); assertEquals("456", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field90JTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field90JTest.java index 03ebabb09..8de2e77d4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field90JTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field90JTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field90JTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("90J", - ":DDDD//EEEEEEEE/FFF123/GGG456" - ); + testSerializationImpl("90J", ":DDDD//EEEEEEEE/FFF123/GGG456"); } @Test @@ -52,7 +50,7 @@ public void testField90JString() { assertTrue(StringUtils.isBlank(f.getComponent6())); f = new Field90J(":/"); - //assertTrue(StringUtils.isBlank(f.getComponent1())); + // assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); @@ -147,5 +145,4 @@ public void testField90JString() { assertEquals("GGG", f.getComponent5()); assertEquals("456", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field90LTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field90LTest.java index cee04d28b..e08d12087 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field90LTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field90LTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; public class Field90LTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("90L", - ":MAXP//235,06", - ":OFFR//N3," - ); + testSerializationImpl("90L", ":MAXP//235,06", ":OFFR//N3,"); } @Test @@ -80,5 +76,4 @@ public void testGetters() { assertEquals("3,", f.getIndexPoints()); assertEquals(new BigDecimal("3"), f.getIndexPointsAsBigDecimal()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field92JTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field92JTest.java index 2147cb633..870f6ece0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field92JTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field92JTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field92JTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("92J", - ":DDDD/EEEEEEEE/FFFF/EUR1234,56/AAAA" - ); + testSerializationImpl("92J", ":DDDD/EEEEEEEE/FFFF/EUR1234,56/AAAA"); } /** @@ -182,5 +180,4 @@ public void testField92JString() { assertEquals("1234,56", f.getComponent5()); assertEquals("AAAA", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field92MTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field92MTest.java index 8cb163068..8e027e96a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field92MTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field92MTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field92MTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("92M", - ":DDDD//EEEEEEEE123/FFFF" - ); + testSerializationImpl("92M", ":DDDD//EEEEEEEE123/FFFF"); } @Test @@ -48,7 +46,7 @@ public void testField92MString() { assertTrue(StringUtils.isBlank(f.getComponent4())); f = new Field92M(":/"); - //assertTrue(StringUtils.isBlank(f.getComponent1())); + // assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); @@ -95,5 +93,4 @@ public void testField92MString() { assertEquals("123", f.getComponent3()); assertEquals("FFFF", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field93BTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field93BTest.java index fd0e5a591..4dab30827 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field93BTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field93BTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field93BTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("93B", - ":DDDD/EEEEEEEE/FFFF/E1234" - ); + testSerializationImpl("93B", ":DDDD/EEEEEEEE/FFFF/E1234"); } /** @@ -143,5 +141,4 @@ public void testField93BString() { assertEquals("E", f.getComponent4()); assertEquals("1234", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field93CTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field93CTest.java index e18b77df7..ab0931d88 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field93CTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field93CTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field93CTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("93C", - ":DDDD//EEEEEEEE/FFFF/E1234" - ); + testSerializationImpl("93C", ":DDDD//EEEEEEEE/FFFF/E1234"); } /** @@ -53,7 +51,7 @@ public void testField93CString() { assertTrue(StringUtils.isBlank(f.getComponent5())); f = new Field93C(":/"); - //assertTrue(StringUtils.isBlank(f.getComponent1())); + // assertTrue(StringUtils.isBlank(f.getComponent1())); assertTrue(StringUtils.isBlank(f.getComponent2())); assertTrue(StringUtils.isBlank(f.getComponent3())); assertTrue(StringUtils.isBlank(f.getComponent4())); @@ -136,5 +134,4 @@ public void testField93CString() { assertEquals("E", f.getComponent4()); assertEquals("1234", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field93ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field93ETest.java index 0e5300213..9622ebc55 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field93ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field93ETest.java @@ -9,11 +9,11 @@ public class Field93ETest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("93E", + testSerializationImpl( + "93E", ":DDDD//EEEE/SSSS/1234,", ":DDDD//EEEE/DDDD/N1234,", - ":DDDD//AAAA/EEEE/N1234567890123456789012345,45" - ); + ":DDDD//AAAA/EEEE/N1234567890123456789012345,45"); } public void testParse() { @@ -24,5 +24,4 @@ public void testParse() { assertEquals("N", f.getComponent4()); assertEquals("1234,", f.getComponent5()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field93FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field93FTest.java index 1fbb8d7ad..5f0cb0570 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field93FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field93FTest.java @@ -9,12 +9,12 @@ public class Field93FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("93F", + testSerializationImpl( + "93F", ":DDDD//EEEE/1234,", ":DDDD//EEEE/N1234,", ":DDDD/111fffff/EEEE/1234,", - ":DDDD/111fffff/EEEE/N1234," - ); + ":DDDD/111fffff/EEEE/N1234,"); } public void testParse() { @@ -25,5 +25,4 @@ public void testParse() { assertEquals("N", f.getComponent4()); assertEquals("1234,", f.getComponent5()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field94DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field94DTest.java index e19a4e9e4..47be89347 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field94DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field94DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,12 @@ import org.junit.jupiter.api.Test; - public class Field94DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("94D", - ":AAAA//BB/C", - ":AAAA///C" - ); + testSerializationImpl("94D", ":AAAA//BB/C", ":AAAA///C"); } @Test @@ -47,5 +43,4 @@ public void test2() { assertNull(f.getComponent2()); assertEquals(f.getComponent3(), "C"); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field94ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field94ETest.java index 7188a391f..d0457d87e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field94ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field94ETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,11 @@ public class Field94ETest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("94E", + testSerializationImpl( + "94E", ":ISSU//foo bar", ":ISSU//foo bar\nsecond line\nthird line", - ":ISSU//foo bar \n second line \n third line " - ); + ":ISSU//foo bar \n second line \n third line "); } @Test @@ -50,5 +50,4 @@ public void testParser2() { assertEquals(" third line", f.getComponent4()); assertEquals("foo bar second line third line", f.getAddress()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field94GTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field94GTest.java index 8998503b1..080ccaadf 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field94GTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field94GTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,6 @@ public class Field94GTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("94G", - ":PACO//Settled\nFully paid 49896.00 USD", - ":SUBB//TYPE OF SAFEKEEPING/GS" - ); + testSerializationImpl("94G", ":PACO//Settled\nFully paid 49896.00 USD", ":SUBB//TYPE OF SAFEKEEPING/GS"); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field94LTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field94LTest.java index 1f1c88f39..a3d6e14d2 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field94LTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field94LTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.util.Locale; +import org.junit.jupiter.api.Test; public class Field94LTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("94L", - ":ISSU//300300E1007142000089", - ":ISSU//12345678AAAAAAAA99" - ); + testSerializationImpl("94L", ":ISSU//300300E1007142000089", ":ISSU//12345678AAAAAAAA99"); } @Test @@ -82,7 +78,5 @@ public void test_setLegalEntityIdentifier() { f.setLegalEntityIdentifier("ABCD1234"); assertEquals("ABCD1234", f.getComponent2()); assertNull(f.getComponent3()); - } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field95LTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field95LTest.java index b63339e6b..c7ac5198a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field95LTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field95LTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.util.Locale; +import org.junit.jupiter.api.Test; public class Field95LTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("95L", - ":ISSU//300300E1007142000089", - ":ISSU//12345678AAAAAAAA99" - ); + testSerializationImpl("95L", ":ISSU//300300E1007142000089", ":ISSU//12345678AAAAAAAA99"); } @Test @@ -82,7 +78,5 @@ public void test_setLegalEntityIdentifier() { f.setLegalEntityIdentifier("ABCD1234"); assertEquals("ABCD1234", f.getComponent2()); assertNull(f.getComponent3()); - } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field97ATest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field97ATest.java index 0b8bdf54c..0fddfe85e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field97ATest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field97ATest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,7 @@ public class Field97ATest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("97A", - ":abc//def//ggg" - ); + testSerializationImpl("97A", ":abc//def//ggg"); } @Test @@ -87,5 +85,4 @@ public void testField97AString() { assertEquals("abc", f.getComponent1()); assertEquals("def//ggg", f.getComponent2()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98CTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98CTest.java index 3479df975..0d1b00067 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98CTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98CTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,14 +22,13 @@ import org.junit.jupiter.api.Test; public class Field98CTest extends AbstractFieldTest { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(Field98CTest.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(Field98CTest.class.getName()); @Override @Test public void testSerialization() { - testSerializationImpl("98C", - ":abc//12121212242424" - ); + testSerializationImpl("98C", ":abc//12121212242424"); } @Test @@ -102,5 +101,4 @@ public void testField98CString() { assertEquals("12121212", f.getComponent2()); assertEquals("242424", f.getComponent3()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98DTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98DTest.java index d2d3bbfb7..495b58bae 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98DTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98DTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field98DTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("98D", - "20150827121212/a10" - ); + testSerializationImpl("98D", "20150827121212/a10"); } @Test @@ -106,5 +104,4 @@ public void testField98D() { assertEquals("10", f.getComponent5()); assertEquals("20150827121212/a10", f.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98ETest.java index 651ded72a..bc8c5a560 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98ETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,15 +22,13 @@ import org.junit.jupiter.api.Test; public class Field98ETest extends AbstractFieldTest { - private static final transient java.util.logging.Logger log = java.util.logging.Logger.getLogger(Field98ETest.class.getName()); + private static final transient java.util.logging.Logger log = + java.util.logging.Logger.getLogger(Field98ETest.class.getName()); @Override @Test public void testSerialization() { - testSerializationImpl("98E", - ":abc//12121212242424,33/N2020", - ":abc//12121212242424,33" - ); + testSerializationImpl("98E", ":abc//12121212242424,33/N2020", ":abc//12121212242424,33"); } @Test @@ -188,5 +186,4 @@ public void testField98EString() { assertEquals("N", f.getComponent5()); assertEquals("2020", f.getComponent6()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98FTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98FTest.java index c0d959ae7..438f26675 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98FTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98FTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ public class Field98FTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("98F", - ":RDDT//ONGO160000", - ":abc/def/ggggggggfffaaaaaa" - ); + testSerializationImpl("98F", ":RDDT//ONGO160000", ":abc/def/ggggggggfffaaaaaa"); } @Test @@ -116,5 +113,4 @@ public void testParse() { assertEquals("ONGO", f.getComponent3()); assertEquals("160000", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98JTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98JTest.java index 9838e93f6..ab8c23f7e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98JTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98JTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field98JTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("98J", - ":FOO//121212121111/ABCDUSAAXXX" - ); + testSerializationImpl("98J", ":FOO//121212121111/ABCDUSAAXXX"); } @Test @@ -82,5 +80,4 @@ public void testField98JString() { assertEquals("2222", f.getComponent3()); assertEquals("foo", f.getComponent4()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/Field98KTest.java b/src/test/java/com/prowidesoftware/swift/model/field/Field98KTest.java index 74e3ec9a1..9f9afd5c2 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/Field98KTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/Field98KTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,7 @@ public class Field98KTest extends AbstractFieldTest { @Override @Test public void testSerialization() { - testSerializationImpl("98K", - ":FOO/AAA/121212121111/TEXT" - ); + testSerializationImpl("98K", ":FOO/AAA/121212121111/TEXT"); } @Test @@ -76,5 +74,4 @@ public void testField98KString() { assertEquals("2222", f.getComponent4()); assertEquals("text", f.getComponent5()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java index 68f55b095..61031a1b0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,15 @@ */ package com.prowidesoftware.swift.model.field; -import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; @Disabled public class FieldComponentLabelsCompatibilityTest { @@ -37,7 +36,10 @@ public static List getClasses(ClassLoader cl, String pack) throws Excepti BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream) upackage.getContent())); String line = null; while ((line = reader.readLine()) != null) { - if (line.endsWith(".class") && line.startsWith("Field") && !line.contains("Test") && !line.equals("Field.class")) { + if (line.endsWith(".class") + && line.startsWith("Field") + && !line.contains("Test") + && !line.equals("Field.class")) { classes.add(Class.forName(dottedPackage + "." + line.substring(0, line.lastIndexOf('.')))); } } @@ -67,7 +69,8 @@ public void test() throws Exception { } } } - System.out.println("total=" + classes.size() + " missing=" + missing + " availableOK=" + availableOK + " availableError=" + availableError); + System.out.println("total=" + classes.size() + " missing=" + missing + " availableOK=" + availableOK + + " availableError=" + availableError); } @Test diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentNameTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentNameTest.java index 61f74eb18..eff95545b 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentNameTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentNameTest.java @@ -20,5 +20,4 @@ public void test() { assertEquals(0, f.componentNameToNumber("foo")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldJsonTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldJsonTest.java index 099a13164..f972440a6 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldJsonTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public class FieldJsonTest { @Test public void toJsonField32A() { Field32A f32A = new Field32A("010203USD123,45"); - //{"name":"32A","date":"010203","currency":"USD","amount":"123"} + // {"name":"32A","date":"010203","currency":"USD","amount":"123"} JsonObject o = JsonParser.parseString(f32A.toJson()).getAsJsonObject(); assertEquals("32A", o.get("name").getAsString()); @@ -40,7 +40,8 @@ public void toJsonField32A() { @Test public void toJsonField71B() { - StructuredNarrative structNarrative = new StructuredNarrative().setCodeword("WITX") + StructuredNarrative structNarrative = new StructuredNarrative() + .setCodeword("WITX") .addNarrativeFragment("CAPITAL GAINS TAX RELATING TO") .addNarrativeFragment("THE PERIOD 1998-07-01 2022-10-30") .addNarrativeFragment("REF 009524780232") @@ -51,16 +52,37 @@ public void toJsonField71B() { Field71B tag71Ba = new Field71B(); tag71Ba.setNarrative(narrative); - assertEquals("CAPITAL GAINS TAX RELATING TO", tag71Ba.narrative().getStructured("WITX").getNarrativeFragments().get(0)); - assertEquals("THE PERIOD 1998-07-01 2022-10-30", tag71Ba.narrative().getStructured("WITX").getNarrativeFragments().get(1)); - assertEquals("REF 009524780232", tag71Ba.narrative().getStructured("WITX").getNarrativeFragments().get(2)); - assertEquals("BANCA DEL TEST", tag71Ba.narrative().getStructured("WITX").getNarrativeFragments().get(3)); + assertEquals( + "CAPITAL GAINS TAX RELATING TO", + tag71Ba.narrative() + .getStructured("WITX") + .getNarrativeFragments() + .get(0)); + assertEquals( + "THE PERIOD 1998-07-01 2022-10-30", + tag71Ba.narrative() + .getStructured("WITX") + .getNarrativeFragments() + .get(1)); + assertEquals( + "REF 009524780232", + tag71Ba.narrative() + .getStructured("WITX") + .getNarrativeFragments() + .get(2)); + assertEquals( + "BANCA DEL TEST", + tag71Ba.narrative() + .getStructured("WITX") + .getNarrativeFragments() + .get(3)); } @Test public void toJsonNarrativeField71B() { - StructuredNarrative structNarrative = new StructuredNarrative().setCodeword("WITX") + StructuredNarrative structNarrative = new StructuredNarrative() + .setCodeword("WITX") .addNarrativeFragment("CAPITAL GAINS TAX RELATING TO") .addNarrativeFragment("THE PERIOD 1998-07-01 2022-10-30") .addNarrativeFragment("REF 009524780232") @@ -71,12 +93,15 @@ public void toJsonNarrativeField71B() { Field71B tag71Ba = new Field71B(); tag71Ba.setNarrative(narrative); - JsonObject tag71BaNarrative = JsonParser.parseString(tag71Ba.toNarrativeFormat()).getAsJsonObject(); + JsonObject tag71BaNarrative = + JsonParser.parseString(tag71Ba.toNarrativeFormat()).getAsJsonObject(); - JsonObject structuredNarrative = tag71BaNarrative.get("structured").getAsJsonArray().get(0).getAsJsonObject(); - assertEquals("WITX",structuredNarrative.get("codeword").getAsString()); + JsonObject structuredNarrative = + tag71BaNarrative.get("structured").getAsJsonArray().get(0).getAsJsonObject(); + assertEquals("WITX", structuredNarrative.get("codeword").getAsString()); - JsonArray narrativeFragments = structuredNarrative.get("narrativeFragments").getAsJsonArray(); + JsonArray narrativeFragments = + structuredNarrative.get("narrativeFragments").getAsJsonArray(); assertTrue(narrativeFragments.get(0).getAsString().contains("CAPITAL GAINS TAX RELATING TO")); assertTrue(narrativeFragments.get(1).getAsString().contains("THE PERIOD 1998-07-01 2022-10-30")); assertTrue(narrativeFragments.get(2).getAsString().contains("REF 009524780232")); @@ -114,10 +139,12 @@ public void toJsonField70() { narrative.addUnstructuredFragment("VALUE 2 "); narrative.addUnstructuredFragment("VALUE 3"); Field70 f70 = new Field70(narrative); - //{"name":"70","narrative":"\"VALUE 1 \\r\\nVALUE 2 \\r\\nVALUE 3\"";} + // {"name":"70","narrative":"\"VALUE 1 \\r\\nVALUE 2 \\r\\nVALUE 3\"";} JsonObject o = JsonParser.parseString(f70.toJson()).getAsJsonObject(); - assertEquals("VALUE 1 VALUE 2 VALUE 3", o.get("narrative").getAsString().replace("\n", "").replace("\r", "")); + assertEquals( + "VALUE 1 VALUE 2 VALUE 3", + o.get("narrative").getAsString().replace("\n", "").replace("\r", "")); } @Test @@ -127,7 +154,7 @@ public void toJsonNarrativeField70() { narrative.addUnstructuredFragment("VALUE 2 "); narrative.addUnstructuredFragment("VALUE 3"); Field70 f70 = new Field70(narrative); - //{"name":"70","narrative":"\"VALUE 1 \\r\\nVALUE 2 \\r\\nVALUE 3\"";} + // {"name":"70","narrative":"\"VALUE 1 \\r\\nVALUE 2 \\r\\nVALUE 3\"";} JsonObject o = JsonParser.parseString(f70.toNarrativeFormat()).getAsJsonObject(); JsonArray asJsonArray = o.get("unstructuredFragments").getAsJsonArray(); @@ -162,7 +189,8 @@ public void fromJson32A() { @Test public void fromJson50D() { - String json50D = "{\"name\":\"50D\",\"dCMark\":\"D\",\"account\":\"1234\",\"nameAndAddress\":\"Foo1\",\"nameAndAddress2\":\"Foo2\",\"nameAndAddress3\":\"Foo3\"}"; + String json50D = + "{\"name\":\"50D\",\"dCMark\":\"D\",\"account\":\"1234\",\"nameAndAddress\":\"Foo1\",\"nameAndAddress2\":\"Foo2\",\"nameAndAddress3\":\"Foo3\"}"; Field50D f50D = Field50D.fromJson(json50D); assertEquals("D", f50D.getDCMark()); assertEquals("1234", f50D.getAccount()); @@ -179,12 +207,11 @@ public void fromJson50D() { */ @Test public void fromJson70() { - String field70JsonStringWithOneNarrative = "{\n" + - " \"name\": \"70\",\n" + - " \"narrative\": \"VALUE 1 VALUE 2\"\n" + - "}"; + String field70JsonStringWithOneNarrative = + "{\n" + " \"name\": \"70\",\n" + " \"narrative\": \"VALUE 1 VALUE 2\"\n" + "}"; Field70 f70 = Field70.fromJson(field70JsonStringWithOneNarrative); - assertEquals("VALUE 1 VALUE 2", f70.narrative().getUnstructuredFragments().get(0)); + assertEquals( + "VALUE 1 VALUE 2", f70.narrative().getUnstructuredFragments().get(0)); assertEquals("VALUE 1 VALUE 2", f70.getComponent(1)); } @@ -195,13 +222,12 @@ public void fromJson70() { */ @Test public void fromJson70_backwardCompatibility() { - String field70JsonStringMoreThanOneNarratives = "{\n" + - " \"name\": \"70\",\n" + - " \"narrative\": \"VALUE 1 \",\n" + - " \"narrative2\": \"VALUE 2 \",\n" + - " \"narrative3\": \"VALUE 3 \",\n" + - " \"narrative4\": \"VALUE 4 \"\n" + - "}"; + String field70JsonStringMoreThanOneNarratives = "{\n" + " \"name\": \"70\",\n" + + " \"narrative\": \"VALUE 1 \",\n" + + " \"narrative2\": \"VALUE 2 \",\n" + + " \"narrative3\": \"VALUE 3 \",\n" + + " \"narrative4\": \"VALUE 4 \"\n" + + "}"; Field70 f70 = Field70.fromJson(field70JsonStringMoreThanOneNarratives); Narrative narrative = f70.narrative(); @@ -216,26 +242,31 @@ public void fromJson70_backwardCompatibility() { */ @Test public void fromJson72() { - String field72WithNarrativeS = "{" + - " 'name': '72'," + - " 'narrative': '/INS/PURPOSE CODE 1670'," + - " 'narrative2': '//SERVICES, SELF COMPANY FUNDING'" + - "}"; + String field72WithNarrativeS = "{" + " 'name': '72'," + + " 'narrative': '/INS/PURPOSE CODE 1670'," + + " 'narrative2': '//SERVICES, SELF COMPANY FUNDING'" + + "}"; Field72 f72 = Field72.fromJson(field72WithNarrativeS); Narrative narrative = f72.narrative(); assertEquals("INS", narrative.getStructured().get(0).getCodeword()); - assertEquals("PURPOSE CODE 1670", narrative.getStructured().get(0).getNarrativeFragments().get(0)); - assertEquals("SERVICES, SELF COMPANY FUNDING", narrative.getStructured().get(0).getNarrativeFragments().get(1)); + assertEquals( + "PURPOSE CODE 1670", + narrative.getStructured().get(0).getNarrativeFragments().get(0)); + assertEquals( + "SERVICES, SELF COMPANY FUNDING", + narrative.getStructured().get(0).getNarrativeFragments().get(1)); } - @Test public void fromJson72B() { Field72 f72 = new Field72("/INS/PURPOSE CODE 1670\n//SERVICES, SELF COMPANY FUNDING"); Narrative narrative = f72.narrative(); assertEquals("INS", narrative.getStructured().get(0).getCodeword()); - assertEquals("PURPOSE CODE 1670", narrative.getStructured().get(0).getNarrativeFragments().get(0)); - assertEquals("SERVICES, SELF COMPANY FUNDING", narrative.getStructured().get(0).getNarrativeFragments().get(1)); + assertEquals( + "PURPOSE CODE 1670", + narrative.getStructured().get(0).getNarrativeFragments().get(0)); + assertEquals( + "SERVICES, SELF COMPANY FUNDING", + narrative.getStructured().get(0).getNarrativeFragments().get(1)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldTest.java index 223a447d4..e434e8973 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,10 @@ import static org.junit.jupiter.api.Assertions.*; import com.prowidesoftware.swift.model.Tag; -import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.Locale; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Test; /** * Test for base class Field. @@ -160,7 +159,7 @@ public void testLabel2() { } @Test - //TODO add API for partyfields structure like field 83J + // TODO add API for partyfields structure like field 83J public void testGetValueByCodewordWorkaround() { final Field83J f = new Field83J("/ACCT/006-6005XXXXXX\n/NAME/JF ASIAN TOTAL RETURN BOND FUND"); assertEquals("006-6005XXXXXX", StringUtils.substringBetween(f.getComponent1(), "/ACCT/", "\n")); @@ -235,7 +234,6 @@ public void testValidName() { assertFalse(Field.validName(null)); } - @Test public void testLines_01() { Field95Q f = new Field95Q(":INVE//JOE DOE"); @@ -313,5 +311,4 @@ public void testAsTag() { // field getValue() is empty, not null, so the Tag ends up with empty as value assertEquals("", t.getValue()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/GetLabelTest.java b/src/test/java/com/prowidesoftware/swift/model/field/GetLabelTest.java index 46d097b9a..aae39114d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/GetLabelTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/GetLabelTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,4 @@ public void test50K() { assertEquals("Name And Address", f.getComponentLabel(2)); assertEquals("Name And Address 2", f.getComponentLabel(3)); } - - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/GetLineField70ETest.java b/src/test/java/com/prowidesoftware/swift/model/field/GetLineField70ETest.java index 094e92075..746f89301 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/GetLineField70ETest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/GetLineField70ETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,20 +17,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class GetLineField70ETest { Field70E field70E; @BeforeEach public void setUp() { - this.field70E = new Field70E(":PACO//The quick brown fox \n" + - "jumps over the\n" + - " the lazy dog"); + this.field70E = new Field70E(":PACO//The quick brown fox \n" + "jumps over the\n" + " the lazy dog"); } @Test @@ -64,5 +61,4 @@ public void testGetLineWithOffset() { assertEquals("jumps over the", field70E.getLine(2, Field70E.NARRATIVE)); assertEquals(" the lazy dog", field70E.getLine(3, Field70E.NARRATIVE)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/GetLineTest.java b/src/test/java/com/prowidesoftware/swift/model/field/GetLineTest.java index da20c6cf2..1bb11c3b3 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/GetLineTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/GetLineTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; /** * Test for fields getLine API. @@ -38,7 +37,7 @@ public void testSimple() { assertEquals("BBBB", f.getLine(3)); assertEquals("CCCC", f.getLine(4)); assertEquals("DDDD", f.getLine(5)); - //remaining lines are ignored by copy constructor + // remaining lines are ignored by copy constructor assertNull(f.getLine(6)); assertNull(f.getLine(7)); assertNull(f.getLine(8)); @@ -245,11 +244,7 @@ public void testAccountNumberDoubleSlash() { @Test public void testField50H() { final Field50H f = new Field50H( - "/8754219990\n" + - "MAG-NUM INC.\n" + - "GENERAL A/C\n" + - "BANHOFFSTRASSE 30\n" + - "ZURICH, SWITZERLAND"); + "/8754219990\n" + "MAG-NUM INC.\n" + "GENERAL A/C\n" + "BANHOFFSTRASSE 30\n" + "ZURICH, SWITZERLAND"); assertEquals("/8754219990", f.getLine(1)); assertEquals("/8754219990", f.getLine(1, 0)); assertEquals("MAG-NUM INC.", f.getLine(2)); diff --git a/src/test/java/com/prowidesoftware/swift/model/field/GetValueDisplayTest.java b/src/test/java/com/prowidesoftware/swift/model/field/GetValueDisplayTest.java index 7c1e23216..f22a20118 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/GetValueDisplayTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/GetValueDisplayTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import java.util.Locale; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Locale; - /** * Test for fields getValueDisplay API. */ @@ -65,10 +64,7 @@ public void test32A() { */ @Test public void test50F() { - final String value = "/1234567890\r\n" + - "1/JOHN SMITH\r\n" + - "2/HIGH STREET 6, APT 6C\r\n" + - "3/BE/BRUSSELS"; + final String value = "/1234567890\r\n" + "1/JOHN SMITH\r\n" + "2/HIGH STREET 6, APT 6C\r\n" + "3/BE/BRUSSELS"; Field50F f = new Field50F(value); assertEquals("1234567890", f.getValueDisplay(1, Locale.US)); } @@ -77,12 +73,11 @@ public void test50F() { * Huge number formatting */ @Disabled("produces heap exception because number is interpreted as exponential value") - //TODO fix getValueDisplay when expression is parsed into exponential value + // TODO fix getValueDisplay when expression is parsed into exponential value @Test public void test95L() { Field95L f = new Field95L(":ISSU//300300E1007142000089"); f.setComponent3("300300E1007142000089"); assertNotNull(f.getValueDisplay(Locale.getDefault())); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolverTest.java index ee79b8c6a..61c67cb33 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/MonetaryAmountResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import com.prowidesoftware.swift.utils.SwiftFormatUtils; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.util.Currency; import java.util.List; +import org.junit.jupiter.api.Test; public class MonetaryAmountResolverTest { @@ -57,5 +56,4 @@ public void testResolve32Q_multiple() { assertEquals("USD", currencyStrings.get(0)); assertEquals("EUR", currencyStrings.get(1)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeBuilderTest.java b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeBuilderTest.java index a71787f08..b62341d2d 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeBuilderTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,8 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; +import org.junit.jupiter.api.Test; /** * @since 8.1.0 @@ -29,28 +28,23 @@ public class NarrativeBuilderTest { @Test public void testUnstructured() { String text = "WE NOTED FCR SHOWING YOURSELVES AS CONSIGNEE PLEASE DISCHARGE US SOONEST"; - Narrative n = Narrative - .builder(35) - .addUnstructured(text) - .build(); + Narrative n = Narrative.builder(35).addUnstructured(text).build(); assertTrue(n.getStructured().isEmpty()); assertEquals(text, n.getUnstructured(" ")); assertEquals(3, n.getUnstructuredFragments().size()); - assertEquals("WE NOTED FCR SHOWING YOURSELVES AS", n.getUnstructuredFragments().get(0)); - assertEquals("CONSIGNEE PLEASE DISCHARGE US", n.getUnstructuredFragments().get(1)); + assertEquals( + "WE NOTED FCR SHOWING YOURSELVES AS", + n.getUnstructuredFragments().get(0)); + assertEquals( + "CONSIGNEE PLEASE DISCHARGE US", n.getUnstructuredFragments().get(1)); assertEquals("SOONEST", n.getUnstructuredFragments().get(2)); - String v = "WE NOTED FCR SHOWING YOURSELVES AS\r\n" + - "CONSIGNEE PLEASE DISCHARGE US\r\n" + - "SOONEST"; + String v = "WE NOTED FCR SHOWING YOURSELVES AS\r\n" + "CONSIGNEE PLEASE DISCHARGE US\r\n" + "SOONEST"; assertEquals(v, n.getValue()); } @Test public void testStructured() { - Narrative n = Narrative - .builder(35) - .addCodeword("REC", "EURO Target") - .build(); + Narrative n = Narrative.builder(35).addCodeword("REC", "EURO Target").build(); assertEquals(1, n.getStructured().size()); assertEquals("REC", n.getStructured().get(0).getCodeword()); assertEquals("EURO Target", n.getStructured().get(0).getNarrative()); @@ -61,8 +55,7 @@ public void testStructured() { @Test public void testRepetitiveCodewords() { - Narrative n = Narrative - .builder(35) + Narrative n = Narrative.builder(35) .addCodeword("ADD", "Text 1") .addCodeword("ADD", "Text 2") .build(); @@ -85,15 +78,18 @@ public void testStructuredLineWrapping() { Narrative n = narrativeBuilder.build(); assertEquals(1, n.getStructured().size()); assertEquals("INS", n.getStructured().get(0).getCodeword()); - assertEquals("JOHN DOE HAS GONE TO AMSTERDAM", n.getStructured().get(0).getNarrativeFragments().get(0)); - assertEquals("AND FROM THERE HE GOES TO PARIS", n.getStructured().get(0).getNarrativeFragments().get(1)); + assertEquals( + "JOHN DOE HAS GONE TO AMSTERDAM", + n.getStructured().get(0).getNarrativeFragments().get(0)); + assertEquals( + "AND FROM THERE HE GOES TO PARIS", + n.getStructured().get(0).getNarrativeFragments().get(1)); assertEquals("AND", n.getStructured().get(0).getNarrativeFragments().get(2)); } @Test public void testStructuredAndUnstructured() { - Narrative n = Narrative - .builder(35) + Narrative n = Narrative.builder(35) .addCodeword("RETN", "59") .addCodeword("BE02", "BENEFICIARIO DESCONOCIDO") .addCodeword("MREF", "0511030094000014") @@ -107,20 +103,20 @@ public void testStructuredAndUnstructured() { assertEquals("MREF", n.getStructured().get(2).getCodeword()); assertEquals("0511030094000014", n.getStructured().get(2).getNarrative()); assertEquals(2, n.getUnstructuredFragments().size()); - assertEquals("Additional unstructured information", n.getUnstructuredFragments().get(0)); + assertEquals( + "Additional unstructured information", + n.getUnstructuredFragments().get(0)); assertEquals("should be at the end", n.getUnstructuredFragments().get(1)); - String v = "/RETN/59\r\n" + - "/BE02/BENEFICIARIO DESCONOCIDO\r\n" + - "/MREF/0511030094000014\r\n" + - "Additional unstructured information\r\n" + - "should be at the end"; + String v = "/RETN/59\r\n" + "/BE02/BENEFICIARIO DESCONOCIDO\r\n" + + "/MREF/0511030094000014\r\n" + + "Additional unstructured information\r\n" + + "should be at the end"; assertEquals(v, n.getValue()); } @Test public void testWithAmount() { - Narrative n = Narrative - .builder(35) + Narrative n = Narrative.builder(35) .addCodewordWithAmount("COMM", "EUR", new BigDecimal("300"), null) .addCodewordWithAmount("CABLE", "USD", new BigDecimal("20.3"), "FOO TEXT") .build(); @@ -141,8 +137,7 @@ public void testWithAmount() { @Test public void testWithCountry() { - Narrative n = Narrative - .builder(35) + Narrative n = Narrative.builder(35) .addCodewordWithCountry("BENEFRES", "IT", null) .addCodewordWithCountry("OTHER", "ES", "Foo Text") .build(); @@ -161,10 +156,7 @@ public void testWithCountry() { @Test public void testCodewordOnly() { - Narrative n = Narrative - .builder(35) - .addCodeword("HOLD", null) - .build(); + Narrative n = Narrative.builder(35).addCodeword("HOLD", null).build(); assertEquals(1, n.getStructured().size()); assertEquals("HOLD", n.getStructured().get(0).getCodeword()); assertNull(n.getStructured().get(0).getNarrative()); @@ -175,8 +167,7 @@ public void testCodewordOnly() { @Test public void testSupplement() { - Narrative n = Narrative - .builder(35) + Narrative n = Narrative.builder(35) .addCodewordWithSupplement("10", "Primary text", "Additional Text") .addCodewordWithSupplement("11", "Primary text that should be wrapped in lines", "Additional Text") .addCodewordWithSupplement("12", "Primary text", "Additional Text that should be wrapped in lines") @@ -190,26 +181,36 @@ public void testSupplement() { // second assertEquals("11", n.getStructured().get(1).getCodeword()); - assertEquals("Primary text that should be wrapped in lines", n.getStructured().get(1).getNarrative(" ")); - assertEquals("Primary text that should be", n.getStructured().get(1).getNarrativeFragments().get(0)); - assertEquals("wrapped in lines", n.getStructured().get(1).getNarrativeFragments().get(1)); + assertEquals( + "Primary text that should be wrapped in lines", + n.getStructured().get(1).getNarrative(" ")); + assertEquals( + "Primary text that should be", + n.getStructured().get(1).getNarrativeFragments().get(0)); + assertEquals( + "wrapped in lines", + n.getStructured().get(1).getNarrativeFragments().get(1)); assertEquals("Additional Text", n.getStructured().get(1).getNarrativeSupplement()); // third assertEquals("12", n.getStructured().get(2).getCodeword()); assertEquals("Primary text", n.getStructured().get(2).getNarrative()); - assertEquals("Additional Text that should be wrapped in lines", n.getStructured().get(2).getNarrativeSupplement(" ")); - assertEquals("Additional Text", n.getStructured().get(2).getNarrativeSupplementFragments().get(0)); - assertEquals("that should be wrapped in lines", n.getStructured().get(2).getNarrativeSupplementFragments().get(1)); + assertEquals( + "Additional Text that should be wrapped in lines", + n.getStructured().get(2).getNarrativeSupplement(" ")); + assertEquals( + "Additional Text", + n.getStructured().get(2).getNarrativeSupplementFragments().get(0)); + assertEquals( + "that should be wrapped in lines", + n.getStructured().get(2).getNarrativeSupplementFragments().get(1)); assertTrue(n.getUnstructuredFragments().isEmpty()); assertNull(n.getUnstructured()); - String v = "/10/Primary text/Additional Text\r\n" + - "/11/Primary text that should be\r\n" + - "//wrapped in lines/Additional Text\r\n" + - "/12/Primary text/Additional Text\r\n" + - "//that should be wrapped in lines"; + String v = "/10/Primary text/Additional Text\r\n" + "/11/Primary text that should be\r\n" + + "//wrapped in lines/Additional Text\r\n" + + "/12/Primary text/Additional Text\r\n" + + "//that should be wrapped in lines"; assertEquals(v, n.getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtilsTest.java b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtilsTest.java index 8fab4f44b..c0bacee79 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeContainerJsonUtilsTest.java @@ -8,46 +8,41 @@ public class NarrativeContainerJsonUtilsTest { @Test void countNarrativesInJsonTestSimple() { - String json = "{\n" + - "'name': '70',\n" + - "'narrative': 'VALUE 1 ',\n" + - "'narrative2': 'VALUE 2 ',\n" + - "'narrative3': 'VALUE 3 ',\n" + - "'narrative4': 'VALUE 4 '\n" + - "}"; + String json = "{\n" + "'name': '70',\n" + + "'narrative': 'VALUE 1 ',\n" + + "'narrative2': 'VALUE 2 ',\n" + + "'narrative3': 'VALUE 3 ',\n" + + "'narrative4': 'VALUE 4 '\n" + + "}"; assertEquals(4, NarrativeContainerJsonUtils.countNarrativesInJson(json)); } @Test void countNarrativesInJsonTestDouble() { - String json = "{\n" + - "\"name\": \"70\",\n" + - "\"narrative\": \"VALUE 1 \",\n" + - "\"narrative2\": \"VALUE 2 \",\n" + - "\"narrative3\": \"VALUE 3 \",\n" + - "\"narrative4\": \"VALUE 4 \"\n" + - "}"; + String json = "{\n" + "\"name\": \"70\",\n" + + "\"narrative\": \"VALUE 1 \",\n" + + "\"narrative2\": \"VALUE 2 \",\n" + + "\"narrative3\": \"VALUE 3 \",\n" + + "\"narrative4\": \"VALUE 4 \"\n" + + "}"; assertEquals(4, NarrativeContainerJsonUtils.countNarrativesInJson(json)); } @Test void countNarrativesInJsonTestComplex() { - String json = - "{\"name\":\"71B\",\n" + - "\"narrative\": \"VALUE 1 \",\n" + - "\"narrative2\": \"VALUE 2 \",\n" + - "\"narrative3\": \"VALUE 3 \",\n" + - "\"narrative4\": \"VALUE 4 \"\n" + - "\"structured\":[{ \"narrativeFragments\":\n" + - "[\"CAPITAL GAINS TAX RELATING TO\",\n" + - "\"THE PERIOD 1998-07-01 2022-10-30\",\n" + - "\"REF 009524780232\",\"BANCA DEL TEST\",\n" + - "\"(REF. ART. 6 DL 461/97)\"],\n" + - "\"narrativeSupplementFragments\":[],\n" + - "\"codeword\":\"WITX\"\n" + - "}],\n" + - "\"unstructuredFragments\":[]}\n"; + String json = "{\"name\":\"71B\",\n" + "\"narrative\": \"VALUE 1 \",\n" + + "\"narrative2\": \"VALUE 2 \",\n" + + "\"narrative3\": \"VALUE 3 \",\n" + + "\"narrative4\": \"VALUE 4 \"\n" + + "\"structured\":[{ \"narrativeFragments\":\n" + + "[\"CAPITAL GAINS TAX RELATING TO\",\n" + + "\"THE PERIOD 1998-07-01 2022-10-30\",\n" + + "\"REF 009524780232\",\"BANCA DEL TEST\",\n" + + "\"(REF. ART. 6 DL 461/97)\"],\n" + + "\"narrativeSupplementFragments\":[],\n" + + "\"codeword\":\"WITX\"\n" + + "}],\n" + + "\"unstructuredFragments\":[]}\n"; assertEquals(4, NarrativeContainerJsonUtils.countNarrativesInJson(json)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeResolverTest.java b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeResolverTest.java index adc642880..90dfb12d9 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/NarrativeResolverTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/NarrativeResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,10 @@ import static org.junit.jupiter.api.Assertions.*; +import java.math.BigDecimal; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import java.math.BigDecimal; - public class NarrativeResolverTest { @Test @@ -45,7 +44,7 @@ public void testWrongField() { */ @Test public void testFormat1_1() { - //empty value + // empty value Narrative n = NarrativeResolver.parse(new Field77A()); assertEquals(0, n.getStructured().size()); assertNull(n.getUnstructured("\n")); @@ -58,9 +57,7 @@ public void testFormat1_1() { */ @Test public void testFormat1_2() { - String v = "WE NOTED FCR SHOWING YOURSELVES\n" + - "AS CONSIGNEE PLEASE DISCHARGE\n" + - "US SOONEST"; + String v = "WE NOTED FCR SHOWING YOURSELVES\n" + "AS CONSIGNEE PLEASE DISCHARGE\n" + "US SOONEST"; Narrative n = NarrativeResolver.parse(new Field77A(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -159,9 +156,7 @@ public void testFormat1_9() { */ @Test public void testFormat2_1() { - String v = "WE NOTED FCR SHOWING YOURSELVES\n" + - "AS CONSIGNEE PLEASE DISCHARGE\n" + - "US SOONEST"; + String v = "WE NOTED FCR SHOWING YOURSELVES\n" + "AS CONSIGNEE PLEASE DISCHARGE\n" + "US SOONEST"; Narrative n = NarrativeResolver.parse(new Field72Z(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -183,8 +178,7 @@ public void testFormat2_2() { */ @Test public void testFormat2_3() { - String v = "/REC123/EURO\n" + - "//Target"; + String v = "/REC123/EURO\n" + "//Target"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(1, n.getStructured().size()); assertEquals("EUROTarget", n.getStructured("REC123").getNarrative()); @@ -197,9 +191,7 @@ public void testFormat2_3() { */ @Test public void testFormat2_4() { - String v = "/RETN/59\n" + - "/BE02/UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014"; + String v = "/RETN/59\n" + "/BE02/UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(3, n.getStructured().size()); assertEquals("59", n.getStructured("RETN").getNarrative()); @@ -213,9 +205,7 @@ public void testFormat2_4() { */ @Test public void testFormat2_5() { - String v = "/RETN/59\n" + - "//UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014"; + String v = "/RETN/59\n" + "//UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(2, n.getStructured().size()); assertEquals("59UNKNOWN BENEFICIARY", n.getStructured("RETN").getNarrative()); @@ -228,9 +218,7 @@ public void testFormat2_5() { */ @Test public void testFormat2_6() { - String v = "/RETN/\n" + - "/BE02/UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014"; + String v = "/RETN/\n" + "/BE02/UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(3, n.getStructured().size()); assertNull(n.getStructured("RETN").getNarrative()); @@ -244,9 +232,7 @@ public void testFormat2_6() { */ @Test public void testFormat2_7() { - String v = "/RETN/\n" + - "//UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014"; + String v = "/RETN/\n" + "//UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(2, n.getStructured().size()); assertEquals("UNKNOWN BENEFICIARY", n.getStructured("RETN").getNarrative()); @@ -259,10 +245,7 @@ public void testFormat2_7() { */ @Test public void testFormat2_8() { - String v = "/RETN/\n" + - "/ /UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014\n" + - "//WELL KNOWN BENEFICIARY"; + String v = "/RETN/\n" + "/ /UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014\n" + "//WELL KNOWN BENEFICIARY"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(1, n.getStructured().size()); assertNull(n.getStructured("RETN").getNarrative()); @@ -274,9 +257,7 @@ public void testFormat2_8() { */ @Test public void testFormat2_9() { - String v = "/RETN/\n" + - "//UNKNOWN BENEFICIARY\n" + - "/MREF/0511030094000014"; + String v = "/RETN/\n" + "//UNKNOWN BENEFICIARY\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(2, n.getStructured().size()); assertEquals("UNKNOWN BENEFICIARY", n.getStructured("RETN").getNarrative()); @@ -289,12 +270,12 @@ public void testFormat2_9() { */ @Test public void testFormat2_10() { - String v = "/12BNF34/1000057346REDEMPTION MERRILL L\n" + - "//YNCH FUNDSFFC 123455600000078 //BAN\n" + - "//COFOO / FOO"; + String v = "/12BNF34/1000057346REDEMPTION MERRILL L\n" + "//YNCH FUNDSFFC 123455600000078 //BAN\n" + + "//COFOO / FOO"; Narrative n = NarrativeResolver.parse(new Field72(v)); assertEquals(1, n.getStructured().size()); - assertEquals("1000057346REDEMPTION MERRILL LYNCH FUNDSFFC 123455600000078 //BANCOFOO / FOO", + assertEquals( + "1000057346REDEMPTION MERRILL LYNCH FUNDSFFC 123455600000078 //BANCOFOO / FOO", n.getStructured("12BNF34").getNarrative()); assertNull(n.getUnstructured()); } @@ -304,10 +285,7 @@ public void testFormat2_10() { */ @Test public void testFormat2_11() { - String v = "/MYCODE/FOO BAR\n" + - "//CONTINUATION OF MYCODE\n" + - "FREE ADDITIONAL NARRATIVE\n" + - "CONTINUATION"; + String v = "/MYCODE/FOO BAR\n" + "//CONTINUATION OF MYCODE\n" + "FREE ADDITIONAL NARRATIVE\n" + "CONTINUATION"; Narrative n = NarrativeResolver.parse(new Field77J(v)); assertEquals(1, n.getStructured().size()); assertEquals("FOO BAR CONTINUATION OF MYCODE", n.getStructured("MYCODE").getNarrative(" ")); @@ -326,9 +304,7 @@ public void testFormat2_11() { */ @Test public void testFormat3_1() { - String v = "YOUR CHARGES GBP 95,\n" + - "CABLE GBP10,\n" + - "INTEREST GBP18,"; + String v = "YOUR CHARGES GBP 95,\n" + "CABLE GBP10,\n" + "INTEREST GBP18,"; Narrative n = NarrativeResolver.parse(new Field73A(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -350,8 +326,7 @@ public void testFormat3_2() { */ @Test public void testFormat3_3() { - String v = "/COMM/EUR300,\n" + - "/CABLE/USD20,3"; + String v = "/COMM/EUR300,\n" + "/CABLE/USD20,3"; Narrative n = NarrativeResolver.parse(new Field71D(v)); assertEquals(2, n.getStructured().size()); assertEquals("EUR", n.getStructured("COMM").getCurrency()); @@ -368,8 +343,7 @@ public void testFormat3_3() { */ @Test public void testFormat3_4() { - String v = "/TELECHAR/USD21,\n" + - "/COMM/USD14,"; + String v = "/TELECHAR/USD21,\n" + "/COMM/USD14,"; Narrative n = NarrativeResolver.parse(new Field71B(v)); assertEquals(2, n.getStructured().size()); assertEquals("USD", n.getStructured("TELECHAR").getCurrency()); @@ -400,15 +374,22 @@ public void testFormat3_5() { */ @Test public void testFormat3_6() { - String v = "/WITX/CAPITAL GAINS TAX RELATING TO\n" + - "//THE PERIOD 1998-07-01 2022-10-30\n" + - "//REF 009524780232\n" + - "//BANCA DEL TEST"; + String v = "/WITX/CAPITAL GAINS TAX RELATING TO\n" + "//THE PERIOD 1998-07-01 2022-10-30\n" + + "//REF 009524780232\n" + + "//BANCA DEL TEST"; Narrative n = NarrativeResolver.parse(new Field71B(v)); - assertEquals("CAPITAL GAINS TAX RELATING TO", n.getStructured("WITX").getNarrativeFragments().get(0)); - assertEquals("THE PERIOD 1998-07-01 2022-10-30", n.getStructured("WITX").getNarrativeFragments().get(1)); - assertEquals("REF 009524780232", n.getStructured("WITX").getNarrativeFragments().get(2)); - assertEquals("BANCA DEL TEST", n.getStructured("WITX").getNarrativeFragments().get(3)); + assertEquals( + "CAPITAL GAINS TAX RELATING TO", + n.getStructured("WITX").getNarrativeFragments().get(0)); + assertEquals( + "THE PERIOD 1998-07-01 2022-10-30", + n.getStructured("WITX").getNarrativeFragments().get(1)); + assertEquals( + "REF 009524780232", + n.getStructured("WITX").getNarrativeFragments().get(2)); + assertEquals( + "BANCA DEL TEST", + n.getStructured("WITX").getNarrativeFragments().get(3)); } /* @@ -453,11 +434,10 @@ public void testFormat3Score_2() { */ @Test public void testFormat3Score_3() { - String v = "/ISSU/B/EUR150,00\n" + - "/TELECHAR/B/EUR20,00Fees\n" + - "/POST/O/EUR8,50\n" + - "//INIT OF MYCODE\n" + - "//CONTINUATION OF MYCODE"; + String v = "/ISSU/B/EUR150,00\n" + "/TELECHAR/B/EUR20,00Fees\n" + + "/POST/O/EUR8,50\n" + + "//INIT OF MYCODE\n" + + "//CONTINUATION OF MYCODE"; Narrative n = NarrativeResolver.parse(new Field71B(v)); assertEquals(3, n.getStructured().size()); assertEquals("EUR", n.getStructured("ISSU").getCurrency()); @@ -472,8 +452,12 @@ public void testFormat3Score_3() { assertEquals("EUR", n.getStructured("POST").getCurrency()); assertEquals("O", n.getStructured("POST").getBankCode()); assertEquals(new BigDecimal("8.50"), n.getStructured("POST").getAmount()); - assertEquals("INIT OF MYCODE", n.getStructured("POST").getNarrativeFragments().get(0)); - assertEquals("CONTINUATION OF MYCODE", n.getStructured("POST").getNarrativeFragments().get(1)); + assertEquals( + "INIT OF MYCODE", + n.getStructured("POST").getNarrativeFragments().get(0)); + assertEquals( + "CONTINUATION OF MYCODE", + n.getStructured("POST").getNarrativeFragments().get(1)); assertNull(n.getUnstructured()); } @@ -698,8 +682,7 @@ public void testFormat5_3() { */ @Test public void testFormat5_4() { - String v = "WE HAVE RECEIVED THE FOLLOWING\n" + - "MESSAGE FROM BNF BANK FBACUAUX"; + String v = "WE HAVE RECEIVED THE FOLLOWING\n" + "MESSAGE FROM BNF BANK FBACUAUX"; Narrative n = NarrativeResolver.parse(new Field75(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -750,7 +733,8 @@ public void testFormat5_8() { Narrative n = NarrativeResolver.parse(new Field76(v)); assertEquals(1, n.getStructured().size()); assertEquals("FIRST QUERY RESPONSE", n.getStructured("1").getNarrative(" ")); - assertEquals("SUPPLEMENT CONTINUATION OF SUPPLEMENT", n.getStructured("1").getNarrativeSupplement(" ")); + assertEquals( + "SUPPLEMENT CONTINUATION OF SUPPLEMENT", n.getStructured("1").getNarrativeSupplement(" ")); assertNull(n.getUnstructured()); } @@ -763,45 +747,56 @@ public void testFormat5_8() { @Test public void testFormat6_1() { - String v = "/ADD/+COPY OF CERTIFICATE OF ORIGIN\n" + - "SHOWING GOODS ARE OF BELGIAN ORIGIN\n" + - "/ADD/+COPY OF CONSULAR INVOICE MENTIONING\n" + - "IMPORT REGISTRATION NUMBER 123"; + String v = "/ADD/+COPY OF CERTIFICATE OF ORIGIN\n" + "SHOWING GOODS ARE OF BELGIAN ORIGIN\n" + + "/ADD/+COPY OF CONSULAR INVOICE MENTIONING\n" + + "IMPORT REGISTRATION NUMBER 123"; Narrative n = NarrativeResolver.parse(new Field46B(v)); assertEquals(2, n.getStructured().size()); - assertEquals("+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN", n.getStructured("ADD").getNarrative(" ")); - assertEquals("+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN", n.getStructured().get(0).getNarrative(" ")); - assertEquals("+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", n.getStructured().get(1).getNarrative(" ")); + assertEquals( + "+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN", + n.getStructured("ADD").getNarrative(" ")); + assertEquals( + "+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN", + n.getStructured().get(0).getNarrative(" ")); + assertEquals( + "+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", + n.getStructured().get(1).getNarrative(" ")); assertNull(n.getStructured("FOO")); assertNull(n.getUnstructured()); } @Test public void testFormat6_2() { - String v = "/ADD/+COPY OF CERTIFICATE OF ORIGIN\n" + - "SHOWING GOODS ARE OF BELGIAN ORIGIN\n" + - "//ADD/+COPY OF CONSULAR INVOICE MENTIONING\n" + - "IMPORT REGISTRATION NUMBER 123"; + String v = "/ADD/+COPY OF CERTIFICATE OF ORIGIN\n" + "SHOWING GOODS ARE OF BELGIAN ORIGIN\n" + + "//ADD/+COPY OF CONSULAR INVOICE MENTIONING\n" + + "IMPORT REGISTRATION NUMBER 123"; Narrative n = NarrativeResolver.parse(new Field49M(v)); assertEquals(1, n.getStructured().size()); - assertEquals("+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN //ADD/+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", n.getStructured("ADD").getNarrative(" ")); - assertEquals("+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN //ADD/+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", n.getStructured().get(0).getNarrative(" ")); + assertEquals( + "+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN //ADD/+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", + n.getStructured("ADD").getNarrative(" ")); + assertEquals( + "+COPY OF CERTIFICATE OF ORIGIN SHOWING GOODS ARE OF BELGIAN ORIGIN //ADD/+COPY OF CONSULAR INVOICE MENTIONING IMPORT REGISTRATION NUMBER 123", + n.getStructured().get(0).getNarrative(" ")); assertNull(n.getStructured("FOO")); assertNull(n.getUnstructured()); } @Test public void testFormat6_3() { - String v = "/ADD/59\n" + - "/0123456789/BENEFICIARIO DESCONOCIDO\n" + - "/MREF/0511030094000014"; + String v = "/ADD/59\n" + "/0123456789/BENEFICIARIO DESCONOCIDO\n" + "/MREF/0511030094000014"; Narrative n = NarrativeResolver.parse(new Field49N(v)); assertEquals(2, n.getStructured().size()); - assertEquals("59/0123456789/BENEFICIARIO DESCONOCIDO", n.getStructured("ADD").getNarrative()); + assertEquals( + "59/0123456789/BENEFICIARIO DESCONOCIDO", n.getStructured("ADD").getNarrative()); assertEquals("0511030094000014", n.getStructured("MREF").getNarrative()); assertEquals("59", n.getStructured().get(0).getNarrativeFragments().get(0)); - assertEquals("/0123456789/BENEFICIARIO DESCONOCIDO", n.getStructured().get(0).getNarrativeFragments().get(1)); - assertEquals("0511030094000014", n.getStructured().get(1).getNarrativeFragments().get(0)); + assertEquals( + "/0123456789/BENEFICIARIO DESCONOCIDO", + n.getStructured().get(0).getNarrativeFragments().get(1)); + assertEquals( + "0511030094000014", + n.getStructured().get(1).getNarrativeFragments().get(0)); assertNull(n.getUnstructured()); } @@ -821,12 +816,12 @@ public void testFormat7_1() { @Test public void testFormat7_2() { - String v = "/CNC/FRA. 2213 CUENTA 18 SEPTIEMBRE\n" + - "// MANT\n" + - "//NIMIENTO EQUIPOS E INSTALACIONES"; + String v = "/CNC/FRA. 2213 CUENTA 18 SEPTIEMBRE\n" + "// MANT\n" + "//NIMIENTO EQUIPOS E INSTALACIONES"; Narrative n = NarrativeResolver.parse(new Field70(v)); assertEquals(1, n.getStructured().size()); - assertEquals("FRA. 2213 CUENTA 18 SEPTIEMBRE MANTNIMIENTO EQUIPOS E INSTALACIONES", n.getStructured("CNC").getNarrative()); + assertEquals( + "FRA. 2213 CUENTA 18 SEPTIEMBRE MANTNIMIENTO EQUIPOS E INSTALACIONES", + n.getStructured("CNC").getNarrative()); assertNull(n.getUnstructured()); } @@ -849,8 +844,7 @@ public void testFormat7_4() { @Test public void testFormat7_5() { - String v = "/VALD/20040509\n" + - "/SETC/USD"; + String v = "/VALD/20040509\n" + "/SETC/USD"; Narrative n = NarrativeResolver.parse(new Field77D(v)); assertEquals(2, n.getStructured().size()); assertEquals("20040509", n.getStructured("VALD").getNarrative()); @@ -860,12 +854,11 @@ public void testFormat7_5() { @Test public void testFormat7_6() { - String v = "IN THE ABSENCE OF ANY OTHER MASTER\n" + - "AGREEMENT BETWEEN US WHICH GOVERNS\n" + - "FOREIGN EXCHANGE TRANSACTIONS, THE\n" + - "1997 INTERNATIONAL FOREIGN EXCHANGE\n" + - "MASTER AGREEMENT (IFEMA) TERMS\n" + - "SHALL APPLY"; + String v = "IN THE ABSENCE OF ANY OTHER MASTER\n" + "AGREEMENT BETWEEN US WHICH GOVERNS\n" + + "FOREIGN EXCHANGE TRANSACTIONS, THE\n" + + "1997 INTERNATIONAL FOREIGN EXCHANGE\n" + + "MASTER AGREEMENT (IFEMA) TERMS\n" + + "SHALL APPLY"; Narrative n = NarrativeResolver.parse(new Field77D(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -895,31 +888,32 @@ public void testFormat8_2() { @Test public void testFormat8_3() { - String v = "/NAME/Jones/Brian/DEPT/IRS Back Office\n" + - " - more DEPT description"; + String v = "/NAME/Jones/Brian/DEPT/IRS Back Office\n" + " - more DEPT description"; Narrative n = NarrativeResolver.parse(new Field29A(v)); assertEquals(2, n.getStructured().size()); assertEquals("Jones/Brian", n.getStructured("NAME").getNarrative()); - assertEquals("IRS Back Office - more DEPT description", n.getStructured("DEPT").getNarrative()); + assertEquals( + "IRS Back Office - more DEPT description", + n.getStructured("DEPT").getNarrative()); assertNull(n.getUnstructured()); } @Test public void testFormat8_4() { - String v = "/NAME/Jones/Brian//DEPT/IRS Back Office\n" + - " - more DEPT description/description2/GENDER/Male"; + String v = "/NAME/Jones/Brian//DEPT/IRS Back Office\n" + " - more DEPT description/description2/GENDER/Male"; Narrative n = NarrativeResolver.parse(new Field29A(v)); assertEquals(3, n.getStructured().size()); assertEquals("Jones/Brian/", n.getStructured("NAME").getNarrative()); - assertEquals("IRS Back Office - more DEPT description/description2", n.getStructured("DEPT").getNarrative()); + assertEquals( + "IRS Back Office - more DEPT description/description2", + n.getStructured("DEPT").getNarrative()); assertEquals("Male", n.getStructured("GENDER").getNarrative()); assertNull(n.getUnstructured()); } @Test public void testFormat8_5() { - String v = "/unstruct/NAME/Jones/DEPT/IRS Back Office\n" + - " - more DEPT description/description2/GENDER/Male"; + String v = "/unstruct/NAME/Jones/DEPT/IRS Back Office\n" + " - more DEPT description/description2/GENDER/Male"; Narrative n = NarrativeResolver.parse(new Field29A(v)); assertEquals(0, n.getStructured().size()); assertEquals(v, n.getUnstructured("\n")); @@ -928,14 +922,16 @@ public void testFormat8_5() { @Test public void testFormat8_6() { // for field 61 the structure narrative could be part of the supplementary details - Narrative n = NarrativeResolver.parse(new Field61("1512171218RCF23423,S202d//23sdf\n/OCMT/EUR123,4/EXCH/EUR0,01")); + Narrative n = + NarrativeResolver.parse(new Field61("1512171218RCF23423,S202d//23sdf\n/OCMT/EUR123,4/EXCH/EUR0,01")); assertEquals(2, n.getStructured().size()); assertEquals("EUR123,4", n.getStructured("OCMT").getNarrative()); } @Test public void testFormat8_7() { - Narrative n = NarrativeResolver.parseFormat8("/OCMT/EUR10000,\n//CHGS/EUR100,/xxxxxxxxxx\n/CHGS/EUR50,/\n//xxxxxxxxxx"); + Narrative n = NarrativeResolver.parseFormat8( + "/OCMT/EUR10000,\n//CHGS/EUR100,/xxxxxxxxxx\n/CHGS/EUR50,/\n//xxxxxxxxxx"); assertEquals(3, n.getStructured().size()); assertEquals("EUR10000,/", n.getStructured().get(0).getNarrative()); assertEquals("EUR100,/xxxxxxxxxx", n.getStructured().get(1).getNarrative()); @@ -967,7 +963,6 @@ void isCurrencyAndAmountShortSizeWithoutBankCode() { assertFalse(NarrativeResolver.isCurrencyAndAmount(v)); } - @Test void isCurrencyAndNoAmount() { String v = "EURA"; diff --git a/src/test/java/com/prowidesoftware/swift/model/field/NationalClearingSystemComponentTest.java b/src/test/java/com/prowidesoftware/swift/model/field/NationalClearingSystemComponentTest.java index 2bef1dd63..cccc5675c 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/NationalClearingSystemComponentTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/NationalClearingSystemComponentTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,8 +43,8 @@ public void testField52AParse() { assertEquals("//ATBBBBB\r\nABNANL2A", f.getValue()); assertNull(f.getDCMark()); assertNull(f.getComponent1()); - assertEquals("/ATBBBBB", f.getComponent2()); //component getter will keep the extra slash - assertEquals("ATBBBBB", f.getAccount()); //account getter will trims the starting slash + assertEquals("/ATBBBBB", f.getComponent2()); // component getter will keep the extra slash + assertEquals("ATBBBBB", f.getAccount()); // account getter will trims the starting slash assertEquals("ABNANL2A", f.getIdentifierCode()); } @@ -52,7 +52,7 @@ public void testField52AParse() { public void testField52ABuild() { Field52A f = new Field52A(); - //we need to add the explicit extra slash to the component value + // we need to add the explicit extra slash to the component value f.setComponent2("/ATBBBBB"); f.setComponent3("ABNANL2A"); @@ -214,5 +214,4 @@ public void testField59A() { assertEquals("/CHBBBBBB", f.getComponent1()); assertEquals("CHBBBBBB", f.getAccount()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/field/OptionJPartyFieldTest.java b/src/test/java/com/prowidesoftware/swift/model/field/OptionJPartyFieldTest.java index 4157d2dc4..04253f6fd 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/OptionJPartyFieldTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/OptionJPartyFieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,10 @@ public class OptionJPartyFieldTest { @Test public void testGetValueByCodeword() { - TestPartyField f = new TestPartyField("/ABIC/CHASUS33\n" + - "/NAME/12345xxxxx12345xxxxx12345+++++1234\n" + - "/ACCT/12345xxxxx12345xxxxx12345/NETS/\n" + - "/ADD1/12345xxxxx12345xxxxx12345+++++1234\n" + - "5/ADD2/12345xxxxx12345xxxxx12345+++++123"); + TestPartyField f = new TestPartyField("/ABIC/CHASUS33\n" + "/NAME/12345xxxxx12345xxxxx12345+++++1234\n" + + "/ACCT/12345xxxxx12345xxxxx12345/NETS/\n" + + "/ADD1/12345xxxxx12345xxxxx12345+++++1234\n" + + "5/ADD2/12345xxxxx12345xxxxx12345+++++123"); assertNull(f.getValueByCodeword(Codeword.SVBY)); assertNull(f.getValueByCodeword(Codeword.NETS)); assertNull(f.getValueByCodeword(Codeword.SSIS)); @@ -60,5 +59,4 @@ public String getName() { return null; } } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/field/SwiftParseUtilsTest.java b/src/test/java/com/prowidesoftware/swift/model/field/SwiftParseUtilsTest.java index 4aed8672d..ceac3f2c5 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/SwiftParseUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/SwiftParseUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,15 +43,21 @@ public void testSplitComponents() { assertEquals("foo", SwiftParseUtils.splitComponents(":foo//", ":", "//").get(0)); assertEquals(2, SwiftParseUtils.splitComponents(":foo//abc", ":", "//").size()); - assertEquals("foo", SwiftParseUtils.splitComponents(":foo//abc", ":", "//").get(0)); - assertEquals("abc", SwiftParseUtils.splitComponents(":foo//abc", ":", "//").get(1)); + assertEquals( + "foo", SwiftParseUtils.splitComponents(":foo//abc", ":", "//").get(0)); + assertEquals( + "abc", SwiftParseUtils.splitComponents(":foo//abc", ":", "//").get(1)); assertEquals(2, SwiftParseUtils.splitComponents("foo//abc", ":", "//").size()); - assertEquals("foo", SwiftParseUtils.splitComponents("foo//abc", ":", "//").get(0)); - assertEquals("abc", SwiftParseUtils.splitComponents("foo//abc", ":", "//").get(1)); + assertEquals( + "foo", SwiftParseUtils.splitComponents("foo//abc", ":", "//").get(0)); + assertEquals( + "abc", SwiftParseUtils.splitComponents("foo//abc", ":", "//").get(1)); assertEquals(1, SwiftParseUtils.splitComponents(":foo/abc", ":", "//").size()); - assertEquals("foo/abc", SwiftParseUtils.splitComponents(":foo/abc", ":", "//").get(0)); + assertEquals( + "foo/abc", + SwiftParseUtils.splitComponents(":foo/abc", ":", "//").get(0)); } @Test @@ -205,7 +211,8 @@ public void testGetTokenSecondLast() { assertEquals("foo/def", SwiftParseUtils.getTokenSecondLast("abc/foo/def", "/")); assertEquals("foo/def/", SwiftParseUtils.getTokenSecondLast("abc/foo/def/", "/")); assertEquals("foo/def//", SwiftParseUtils.getTokenSecondLast("abc/foo/def//", "/")); - assertEquals("foo/def/hsjs/slkdjf//dsd", SwiftParseUtils.getTokenSecondLast("abc/foo/def/hsjs/slkdjf//dsd", "/")); + assertEquals( + "foo/def/hsjs/slkdjf//dsd", SwiftParseUtils.getTokenSecondLast("abc/foo/def/hsjs/slkdjf//dsd", "/")); assertEquals("/", SwiftParseUtils.getTokenSecondLast("//", "/")); assertEquals("/", SwiftParseUtils.getTokenSecondLast("///", "//")); } @@ -228,7 +235,9 @@ public void testGetTokenSecondLastWithPrefix() { assertEquals("foo/def", SwiftParseUtils.getTokenSecondLast("/abc/foo/def", "/", "/")); assertEquals("foo/def/", SwiftParseUtils.getTokenSecondLast(":abc/foo/def/", ":", "/")); assertEquals("foo/def//", SwiftParseUtils.getTokenSecondLast(":abc/foo/def//", ":", "/")); - assertEquals("foo/def/hsjs/slkdjf//dsd", SwiftParseUtils.getTokenSecondLast(":abc/foo/def/hsjs/slkdjf//dsd", ":", "/")); + assertEquals( + "foo/def/hsjs/slkdjf//dsd", + SwiftParseUtils.getTokenSecondLast(":abc/foo/def/hsjs/slkdjf//dsd", ":", "/")); assertEquals("/", SwiftParseUtils.getTokenSecondLast("://", ":", "/")); assertEquals("/", SwiftParseUtils.getTokenSecondLast(":///", ":", "//")); } @@ -324,5 +333,4 @@ public void testRemovePrefix() { assertEquals("aaa", SwiftParseUtils.removePrefix("/aaa", "/")); assertEquals("/aaa", SwiftParseUtils.removePrefix("//aaa", "/")); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMTTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMTTest.java index b73c62bd9..88726c765 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMTTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMTTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,17 +33,18 @@ import com.prowidesoftware.swift.model.mt.mt5xx.MT549; import com.prowidesoftware.swift.model.mt.mt9xx.MT940; import com.prowidesoftware.swift.utils.TestUtils; -import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Test; public class AbstractMTTest { @Test public void testGetSequence() { - SwiftMessage m = new MT102().append(MT102.SequenceA.newInstance(Field32A.tag("foo"))).getSwiftMessage(); + SwiftMessage m = new MT102() + .append(MT102.SequenceA.newInstance(Field32A.tag("foo"))) + .getSwiftMessage(); TestUtils.append(m, MT102.SequenceB.newInstance(Field32A.tag("bar"))); AbstractMT o = m.toMT(); SwiftTagListBlock A = o.getSequence("A"); @@ -54,11 +55,11 @@ public void testGetSequence() { @Test public void testGetSequenceList() { - SwiftMessage m = new MT102().append( - MT102.SequenceA.newInstance(Field32A.tag("foo")) + SwiftMessage m = new MT102() + .append(MT102.SequenceA.newInstance(Field32A.tag("foo")) .append(MT102.SequenceB.newInstance(Field32A.tag("bar"))) - .append(MT102.SequenceB.newInstance(Field32A.tag("bar1"), Field32A.tag("bar2"))) - ).getSwiftMessage(); + .append(MT102.SequenceB.newInstance(Field32A.tag("bar1"), Field32A.tag("bar2")))) + .getSwiftMessage(); AbstractMT o = m.toMT(); List Bs = o.getSequenceList("B"); assertNotNull(Bs); @@ -72,55 +73,56 @@ public void testGetSequenceList() { @Test public void test_conversin_to_xml() { - String fin = "{1:F01FMACUS33AXXX1625159979}{2:O5471302141113CHASUSU9AXXX05821058501411131302N}{3:{108:001823CQ1833911}}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//T314314CDM0\n" + - ":23G:NEWM\n" + - ":98E::PREP//20141113130218/N05\n" + - ":16R:LINK\n" + - ":20C::RELA//00013507299330A\n" + - ":16S:LINK\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20141107\n" + - ":98A::ESET//20141113\n" + - ":98A::SETT//20141113\n" + - ":90A::DEAL//PRCT/102,713552\n" + - ":35B:/US/3132MAD40\n" + - "FOO MORTPASS 3.5+ 01/NOV/2044\n" + - "Q2 PN+ Q29423\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::ESTT//AMOR/7999999,573\n" + - ":36B::ESTT//FAMT/8167548,\n" + - ":97A::SAFE//P 61947\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/USFW/021000021\n" + - ":97A::SAFE//FBCMBS\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95R::BUYR/DTCYID/00355\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//FRNYUS33\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::DEAL//USD8217083,72\n" + - ":16S:AMT\n" + - ":16R:AMT\n" + - ":19A::ACRU//USD9333,33\n" + - ":16S:AMT\n" + - ":16R:AMT\n" + - ":19A::ESTT//USD8226417,05\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - ":16R:OTHRPRTY\n" + - ":95P::MEOR//CHASUS33\n" + - ":16S:OTHRPRTY\n" + - "-}"; + String fin = + "{1:F01FMACUS33AXXX1625159979}{2:O5471302141113CHASUSU9AXXX05821058501411131302N}{3:{108:001823CQ1833911}}{4:\n" + + ":16R:GENL\n" + + ":20C::SEME//T314314CDM0\n" + + ":23G:NEWM\n" + + ":98E::PREP//20141113130218/N05\n" + + ":16R:LINK\n" + + ":20C::RELA//00013507299330A\n" + + ":16S:LINK\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20141107\n" + + ":98A::ESET//20141113\n" + + ":98A::SETT//20141113\n" + + ":90A::DEAL//PRCT/102,713552\n" + + ":35B:/US/3132MAD40\n" + + "FOO MORTPASS 3.5+ 01/NOV/2044\n" + + "Q2 PN+ Q29423\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::ESTT//AMOR/7999999,573\n" + + ":36B::ESTT//FAMT/8167548,\n" + + ":97A::SAFE//P 61947\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/USFW/021000021\n" + + ":97A::SAFE//FBCMBS\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95R::BUYR/DTCYID/00355\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//FRNYUS33\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::DEAL//USD8217083,72\n" + + ":16S:AMT\n" + + ":16R:AMT\n" + + ":19A::ACRU//USD9333,33\n" + + ":16S:AMT\n" + + ":16R:AMT\n" + + ":19A::ESTT//USD8226417,05\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + ":16R:OTHRPRTY\n" + + ":95P::MEOR//CHASUS33\n" + + ":16S:OTHRPRTY\n" + + "-}"; MT547 mt = new MT547(fin); String xml = mt.xml(); assertTrue(StringUtils.contains(xml, "FMACUS33AXXX")); @@ -132,25 +134,26 @@ public void test_conversin_to_xml() { @Test public void testParsingSystemMessage() throws IOException { - final String msg = "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":23E:SDVA\n" + - ":26T:001\n" + - ":32A:151104XOF27000000,\n" + - ":50K:/0020121503484101\n" + - "FOO VORYEAUGEIS\n" + - ":53A:/D/D00030901\n" + - "ECOCMLBA\n" + - ":57A:/C/A00031061\n" + - "OMFNCIAB\n" + - ":59:/010010100100014010010160\n" + - "FOO VOYAGES\n" + - ":70:TRANSFERT\n" + - ":71A:SHA\n" + - ":72:/CODTYPTR/001\n" + - "//REGLEMENT\n" + - "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; + final String msg = + "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + + ":20:1234567890\n" + + ":23B:CRED\n" + + ":23E:SDVA\n" + + ":26T:001\n" + + ":32A:151104XOF27000000,\n" + + ":50K:/0020121503484101\n" + + "FOO VORYEAUGEIS\n" + + ":53A:/D/D00030901\n" + + "ECOCMLBA\n" + + ":57A:/C/A00031061\n" + + "OMFNCIAB\n" + + ":59:/010010100100014010010160\n" + + "FOO VOYAGES\n" + + ":70:TRANSFERT\n" + + ":71A:SHA\n" + + ":72:/CODTYPTR/001\n" + + "//REGLEMENT\n" + + "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; AbstractMT asm = AbstractMT.parse(msg); assertNotNull(asm); @@ -237,25 +240,26 @@ public void testRemoveInnerSequences3() { @Test public void testGetFields() throws IOException { - final String msg = "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":23E:SDVA\n" + - ":26T:001\n" + - ":32A:151104XOF27000000,\n" + - ":50K:/0020121503484101\n" + - "FOO VORYEAUGEIS\n" + - ":53A:/D/D00030901\n" + - "ECOCMLBA\n" + - ":57A:/C/A00031061\n" + - "OMFNCIAB\n" + - ":59:/010010100100014010010160\n" + - "FOO VOYAGES\n" + - ":70:TRANSFERT\n" + - ":71A:SHA\n" + - ":72:/CODTYPTR/001\n" + - "//REGLEMENT\n" + - "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; + final String msg = + "{1:F21OMFNCIABAXXX6368087500}{4:{177:1511041614}{451:0}}{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{113:0030}{108:001RTGS153030005}}{4:\n" + + ":20:1234567890\n" + + ":23B:CRED\n" + + ":23E:SDVA\n" + + ":26T:001\n" + + ":32A:151104XOF27000000,\n" + + ":50K:/0020121503484101\n" + + "FOO VORYEAUGEIS\n" + + ":53A:/D/D00030901\n" + + "ECOCMLBA\n" + + ":57A:/C/A00031061\n" + + "OMFNCIAB\n" + + ":59:/010010100100014010010160\n" + + "FOO VOYAGES\n" + + ":70:TRANSFERT\n" + + ":71A:SHA\n" + + ":72:/CODTYPTR/001\n" + + "//REGLEMENT\n" + + "-}{5:{MAC:00000000}{CHK:0AF226411593}}{S:{SPD:}{SAC:}{COP:P}}"; AbstractMT asm = AbstractMT.parse(msg); List fields = asm.getFields(); @@ -265,11 +269,12 @@ public void testGetFields() throws IOException { @Test public void testGetFieldsInvalidBlockBrackets() throws IOException { - final String msg = "{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{108:210323165210}{4:\n" + - ":20:1234567890\n" + - ":23B:CRED\n" + - ":23E:SDVA\n" + - "-}"; + final String msg = + "{1:F01OMFNCIABAXXX6368087500}{2:O1031542151104BCAOSNDPAXXX22438129121511041542N}{3:{108:210323165210}{4:\n" + + ":20:1234567890\n" + + ":23B:CRED\n" + + ":23E:SDVA\n" + + "-}"; AbstractMT asm = AbstractMT.parse(msg); List fields = asm.getFields(); assertTrue(fields.isEmpty()); @@ -277,23 +282,23 @@ public void testGetFieldsInvalidBlockBrackets() throws IOException { @Test public void testMTClassParse() { - MT940 mt = MT940.parse("{1:F01ANASCH20AXXX0000000000}{2:I940BSCHGB2LXEQUN}{3:{108:FOOB3926BE868XXX}}{4:\n" + - ":20:123456\n" + - ":25:123-304958\n" + - ":28C:123/1\n" + - ":60F:C980622USD395212311,71\n" + - ":61:980623C50000000,NTRFNONREF//8951234\n" + - "ORDER BK OF NYC WESTERN CASH RESERVE\n" + - ":61:980625C5700000,NFEX036960//8954321\n" + - ":61:980626C200000,NDIVNONREF//8846543\n" + - ":86:DIVIDEND LORAL CORP\n" + - "PREFERRED STOCK 1ST QUARTER 1998\n" + - ":62F:C980623USD451112311,71\n" + - ":64:C980623USD445212311,71\n" + - ":65:C980625USD450912311,71\n" + - ":65:C980626USD451112311,71\n" + - ":86:PRIME RATE AS OF TODAY 11 PCT\n" + - "-}{5:{CHK:3916EF336FF7}}"); + MT940 mt = MT940.parse( + "{1:F01ANASCH20AXXX0000000000}{2:I940BSCHGB2LXEQUN}{3:{108:FOOB3926BE868XXX}}{4:\n" + ":20:123456\n" + + ":25:123-304958\n" + + ":28C:123/1\n" + + ":60F:C980622USD395212311,71\n" + + ":61:980623C50000000,NTRFNONREF//8951234\n" + + "ORDER BK OF NYC WESTERN CASH RESERVE\n" + + ":61:980625C5700000,NFEX036960//8954321\n" + + ":61:980626C200000,NDIVNONREF//8846543\n" + + ":86:DIVIDEND LORAL CORP\n" + + "PREFERRED STOCK 1ST QUARTER 1998\n" + + ":62F:C980623USD451112311,71\n" + + ":64:C980623USD445212311,71\n" + + ":65:C980625USD450912311,71\n" + + ":65:C980626USD451112311,71\n" + + ":86:PRIME RATE AS OF TODAY 11 PCT\n" + + "-}{5:{CHK:3916EF336FF7}}"); assertEquals(ServiceIdType._01, mt.getSwiftMessage().getBlock1().getServiceIdType()); } @@ -306,7 +311,5 @@ public void testAbstractMt() throws IOException { } catch (Exception e) { fail("No exception expected"); } - } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMtJsonTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMtJsonTest.java index e7ad07b2d..f2ce867e7 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMtJsonTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/AbstractMtJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,6 @@ import com.prowidesoftware.swift.utils.SwiftMessageComparator; import org.junit.jupiter.api.Test; -import java.util.List; - /** * Test for JSON API in AbstractMT and subclasses */ @@ -39,317 +37,362 @@ public class AbstractMtJsonTest { @Test public void testMT547ToJson() { - String fin = "{1:F01FMACUS33AXXX1625159979}{2:O5471302141113CHASUSU9AXXX05821058501411131302N}{3:{108:001823CQ1833911}}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//T314314CDM0\n" + - ":23G:NEWM\n" + - ":98E::PREP//20141113130218/N05\n" + - ":16R:LINK\n" + - ":20C::RELA//00013507299330A\n" + - ":16S:LINK\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::TRAD//20141107\n" + - ":98A::ESET//20141113\n" + - ":98A::SETT//20141113\n" + - ":90A::DEAL//PRCT/102,713552\n" + - ":35B:/US/3132MAD40\n" + - "FOO MORTPASS 3.5+ 01/NOV/2044\n" + - "Q2 PN+ Q29423\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::ESTT//AMOR/7999999,573\n" + - ":36B::ESTT//FAMT/8167548,\n" + - ":97A::SAFE//P 61947\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95R::REAG/USFW/021000021\n" + - ":97A::SAFE//FBCMBS\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95R::BUYR/DTCYID/00355\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//FRNYUS33\n" + - ":16S:SETPRTY\n" + - ":16R:AMT\n" + - ":19A::DEAL//USD8217083,72\n" + - ":16S:AMT\n" + - ":16R:AMT\n" + - ":19A::ACRU//USD9333,33\n" + - ":16S:AMT\n" + - ":16R:AMT\n" + - ":19A::ESTT//USD8226417,05\n" + - ":16S:AMT\n" + - ":16S:SETDET\n" + - ":16R:OTHRPRTY\n" + - ":95P::MEOR//CHASUS33\n" + - ":16S:OTHRPRTY\n" + - "-}"; + String fin = + "{1:F01FMACUS33AXXX1625159979}{2:O5471302141113CHASUSU9AXXX05821058501411131302N}{3:{108:001823CQ1833911}}{4:\n" + + ":16R:GENL\n" + + ":20C::SEME//T314314CDM0\n" + + ":23G:NEWM\n" + + ":98E::PREP//20141113130218/N05\n" + + ":16R:LINK\n" + + ":20C::RELA//00013507299330A\n" + + ":16S:LINK\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::TRAD//20141107\n" + + ":98A::ESET//20141113\n" + + ":98A::SETT//20141113\n" + + ":90A::DEAL//PRCT/102,713552\n" + + ":35B:/US/3132MAD40\n" + + "FOO MORTPASS 3.5+ 01/NOV/2044\n" + + "Q2 PN+ Q29423\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::ESTT//AMOR/7999999,573\n" + + ":36B::ESTT//FAMT/8167548,\n" + + ":97A::SAFE//P 61947\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95R::REAG/USFW/021000021\n" + + ":97A::SAFE//FBCMBS\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95R::BUYR/DTCYID/00355\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//FRNYUS33\n" + + ":16S:SETPRTY\n" + + ":16R:AMT\n" + + ":19A::DEAL//USD8217083,72\n" + + ":16S:AMT\n" + + ":16R:AMT\n" + + ":19A::ACRU//USD9333,33\n" + + ":16S:AMT\n" + + ":16R:AMT\n" + + ":19A::ESTT//USD8226417,05\n" + + ":16S:AMT\n" + + ":16S:SETDET\n" + + ":16R:OTHRPRTY\n" + + ":95P::MEOR//CHASUS33\n" + + ":16S:OTHRPRTY\n" + + "-}"; MT547 mt = new MT547(fin); String toJson = mt.toJson(); JsonObject o = JsonParser.parseString(toJson).getAsJsonObject(); - assertEquals("FMACUS33AXXX", o.get("basicHeaderBlock").getAsJsonObject().get("logicalTerminal").getAsString()); - assertEquals("CHASUSU9AXXX", o.get("applicationHeaderBlock").getAsJsonObject().get("MIRLogicalTerminal").getAsString()); - assertEquals("108", o.get("userHeaderBlock").getAsJsonObject().get("fields").getAsJsonArray().get(0).getAsJsonObject().get("name").getAsString()); - assertEquals("98E", o.get("textBlock").getAsJsonObject().get("fields").getAsJsonArray().get(3).getAsJsonObject().get("name").getAsString()); - assertEquals("PREP", o.get("textBlock").getAsJsonObject().get("fields").getAsJsonArray().get(3).getAsJsonObject().get("qualifier").getAsString()); - assertEquals("N", o.get("textBlock").getAsJsonObject().get("fields").getAsJsonArray().get(3).getAsJsonObject().get("sign").getAsString()); + assertEquals( + "FMACUS33AXXX", + o.get("basicHeaderBlock") + .getAsJsonObject() + .get("logicalTerminal") + .getAsString()); + assertEquals( + "CHASUSU9AXXX", + o.get("applicationHeaderBlock") + .getAsJsonObject() + .get("MIRLogicalTerminal") + .getAsString()); + assertEquals( + "108", + o.get("userHeaderBlock") + .getAsJsonObject() + .get("fields") + .getAsJsonArray() + .get(0) + .getAsJsonObject() + .get("name") + .getAsString()); + assertEquals( + "98E", + o.get("textBlock") + .getAsJsonObject() + .get("fields") + .getAsJsonArray() + .get(3) + .getAsJsonObject() + .get("name") + .getAsString()); + assertEquals( + "PREP", + o.get("textBlock") + .getAsJsonObject() + .get("fields") + .getAsJsonArray() + .get(3) + .getAsJsonObject() + .get("qualifier") + .getAsString()); + assertEquals( + "N", + o.get("textBlock") + .getAsJsonObject() + .get("fields") + .getAsJsonArray() + .get(3) + .getAsJsonObject() + .get("sign") + .getAsString()); } @Test public void testMT547FromJson() { - String json = "{\n" + - " \"type\": \"MT\",\n" + - " \"basicHeaderBlock\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FMACUS33AXXX\",\n" + - " \"sessionNumber\": \"1625\",\n" + - " \"sequenceNumber\": \"159979\"\n" + - " },\n" + - " \"applicationHeaderBlock\": {\n" + - " \"senderInputTime\": \"1302\",\n" + - " \"MIRDate\": \"141113\",\n" + - " \"MIRLogicalTerminal\": \"CHASUSU9AXXX\",\n" + - " \"MIRSessionNumber\": \"0582\",\n" + - " \"MIRSequenceNumber\": \"105850\",\n" + - " \"receiverOutputDate\": \"141113\",\n" + - " \"receiverOutputTime\": \"1302\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"547\",\n" + - " \"direction\": \"O\"\n" + - " },\n" + - " \"userHeaderBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"108\",\n" + - " \"mUR\": \"001823CQ1833911\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"textBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"GENL\"\n" + - " },\n" + - " {\n" + - " \"name\": \"20C\",\n" + - " \"qualifier\": \"SEME\",\n" + - " \"reference\": \"T314314CDM0\"\n" + - " },\n" + - " {\n" + - " \"name\": \"23G\",\n" + - " \"function\": \"NEWM\"\n" + - " },\n" + - " {\n" + - " \"name\": \"98E\",\n" + - " \"qualifier\": \"PREP\",\n" + - " \"date\": \"20141113\",\n" + - " \"time\": \"130218\",\n" + - " \"sign\": \"N\",\n" + - " \"uTCIndicator\": \"05\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"LINK\"\n" + - " },\n" + - " {\n" + - " \"name\": \"20C\",\n" + - " \"qualifier\": \"RELA\",\n" + - " \"reference\": \"00013507299330A\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"LINK\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"GENL\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"TRADDET\"\n" + - " },\n" + - " {\n" + - " \"name\": \"98A\",\n" + - " \"qualifier\": \"TRAD\",\n" + - " \"date\": \"20141107\"\n" + - " },\n" + - " {\n" + - " \"name\": \"98A\",\n" + - " \"qualifier\": \"ESET\",\n" + - " \"date\": \"20141113\"\n" + - " },\n" + - " {\n" + - " \"name\": \"98A\",\n" + - " \"qualifier\": \"SETT\",\n" + - " \"date\": \"20141113\"\n" + - " },\n" + - " {\n" + - " \"name\": \"90A\",\n" + - " \"qualifier\": \"DEAL\",\n" + - " \"percentageTypeCode\": \"PRCT\",\n" + - " \"price\": \"102,713552\"\n" + - " },\n" + - " {\n" + - " \"name\": \"35B\",\n" + - " \"description\": \"/US/3132MAD40\",\n" + - " \"description2\": \"FOO MORTPASS 3.5+ 01/NOV/2044\",\n" + - " \"description3\": \"Q2 PN+ Q29423\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"TRADDET\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"FIAC\"\n" + - " },\n" + - " {\n" + - " \"name\": \"36B\",\n" + - " \"qualifier\": \"ESTT\",\n" + - " \"quantityTypeCode\": \"AMOR\",\n" + - " \"quantity\": \"7999999,573\"\n" + - " },\n" + - " {\n" + - " \"name\": \"36B\",\n" + - " \"qualifier\": \"ESTT\",\n" + - " \"quantityTypeCode\": \"FAMT\",\n" + - " \"quantity\": \"8167548,\"\n" + - " },\n" + - " {\n" + - " \"name\": \"97A\",\n" + - " \"qualifier\": \"SAFE\",\n" + - " \"account\": \"P 61947\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"FIAC\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"SETDET\"\n" + - " },\n" + - " {\n" + - " \"name\": \"22F\",\n" + - " \"qualifier\": \"SETR\",\n" + - " \"indicator\": \"TRAD\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"95R\",\n" + - " \"qualifier\": \"REAG\",\n" + - " \"dataSourceScheme\": \"USFW\",\n" + - " \"proprietaryCode\": \"021000021\"\n" + - " },\n" + - " {\n" + - " \"name\": \"97A\",\n" + - " \"qualifier\": \"SAFE\",\n" + - " \"account\": \"FBCMBS\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"95R\",\n" + - " \"qualifier\": \"BUYR\",\n" + - " \"dataSourceScheme\": \"DTCYID\",\n" + - " \"proprietaryCode\": \"00355\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"95P\",\n" + - " \"qualifier\": \"PSET\",\n" + - " \"bIC\": \"FRNYUS33\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"SETPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"19A\",\n" + - " \"qualifier\": \"DEAL\",\n" + - " \"currency\": \"USD\",\n" + - " \"amount\": \"8217083,72\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"19A\",\n" + - " \"qualifier\": \"ACRU\",\n" + - " \"currency\": \"USD\",\n" + - " \"amount\": \"9333,33\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"19A\",\n" + - " \"qualifier\": \"ESTT\",\n" + - " \"currency\": \"USD\",\n" + - " \"amount\": \"8226417,05\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"AMT\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"SETDET\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16R\",\n" + - " \"blockName\": \"OTHRPRTY\"\n" + - " },\n" + - " {\n" + - " \"name\": \"95P\",\n" + - " \"qualifier\": \"MEOR\",\n" + - " \"bIC\": \"CHASUS33\"\n" + - " },\n" + - " {\n" + - " \"name\": \"16S\",\n" + - " \"blockName\": \"OTHRPRTY\"\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; - + String json = "{\n" + " \"type\": \"MT\",\n" + + " \"basicHeaderBlock\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FMACUS33AXXX\",\n" + + " \"sessionNumber\": \"1625\",\n" + + " \"sequenceNumber\": \"159979\"\n" + + " },\n" + + " \"applicationHeaderBlock\": {\n" + + " \"senderInputTime\": \"1302\",\n" + + " \"MIRDate\": \"141113\",\n" + + " \"MIRLogicalTerminal\": \"CHASUSU9AXXX\",\n" + + " \"MIRSessionNumber\": \"0582\",\n" + + " \"MIRSequenceNumber\": \"105850\",\n" + + " \"receiverOutputDate\": \"141113\",\n" + + " \"receiverOutputTime\": \"1302\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"547\",\n" + + " \"direction\": \"O\"\n" + + " },\n" + + " \"userHeaderBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"108\",\n" + + " \"mUR\": \"001823CQ1833911\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"textBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"GENL\"\n" + + " },\n" + + " {\n" + + " \"name\": \"20C\",\n" + + " \"qualifier\": \"SEME\",\n" + + " \"reference\": \"T314314CDM0\"\n" + + " },\n" + + " {\n" + + " \"name\": \"23G\",\n" + + " \"function\": \"NEWM\"\n" + + " },\n" + + " {\n" + + " \"name\": \"98E\",\n" + + " \"qualifier\": \"PREP\",\n" + + " \"date\": \"20141113\",\n" + + " \"time\": \"130218\",\n" + + " \"sign\": \"N\",\n" + + " \"uTCIndicator\": \"05\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"LINK\"\n" + + " },\n" + + " {\n" + + " \"name\": \"20C\",\n" + + " \"qualifier\": \"RELA\",\n" + + " \"reference\": \"00013507299330A\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"LINK\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"GENL\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"TRADDET\"\n" + + " },\n" + + " {\n" + + " \"name\": \"98A\",\n" + + " \"qualifier\": \"TRAD\",\n" + + " \"date\": \"20141107\"\n" + + " },\n" + + " {\n" + + " \"name\": \"98A\",\n" + + " \"qualifier\": \"ESET\",\n" + + " \"date\": \"20141113\"\n" + + " },\n" + + " {\n" + + " \"name\": \"98A\",\n" + + " \"qualifier\": \"SETT\",\n" + + " \"date\": \"20141113\"\n" + + " },\n" + + " {\n" + + " \"name\": \"90A\",\n" + + " \"qualifier\": \"DEAL\",\n" + + " \"percentageTypeCode\": \"PRCT\",\n" + + " \"price\": \"102,713552\"\n" + + " },\n" + + " {\n" + + " \"name\": \"35B\",\n" + + " \"description\": \"/US/3132MAD40\",\n" + + " \"description2\": \"FOO MORTPASS 3.5+ 01/NOV/2044\",\n" + + " \"description3\": \"Q2 PN+ Q29423\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"TRADDET\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"FIAC\"\n" + + " },\n" + + " {\n" + + " \"name\": \"36B\",\n" + + " \"qualifier\": \"ESTT\",\n" + + " \"quantityTypeCode\": \"AMOR\",\n" + + " \"quantity\": \"7999999,573\"\n" + + " },\n" + + " {\n" + + " \"name\": \"36B\",\n" + + " \"qualifier\": \"ESTT\",\n" + + " \"quantityTypeCode\": \"FAMT\",\n" + + " \"quantity\": \"8167548,\"\n" + + " },\n" + + " {\n" + + " \"name\": \"97A\",\n" + + " \"qualifier\": \"SAFE\",\n" + + " \"account\": \"P 61947\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"FIAC\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"SETDET\"\n" + + " },\n" + + " {\n" + + " \"name\": \"22F\",\n" + + " \"qualifier\": \"SETR\",\n" + + " \"indicator\": \"TRAD\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"95R\",\n" + + " \"qualifier\": \"REAG\",\n" + + " \"dataSourceScheme\": \"USFW\",\n" + + " \"proprietaryCode\": \"021000021\"\n" + + " },\n" + + " {\n" + + " \"name\": \"97A\",\n" + + " \"qualifier\": \"SAFE\",\n" + + " \"account\": \"FBCMBS\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"95R\",\n" + + " \"qualifier\": \"BUYR\",\n" + + " \"dataSourceScheme\": \"DTCYID\",\n" + + " \"proprietaryCode\": \"00355\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"95P\",\n" + + " \"qualifier\": \"PSET\",\n" + + " \"bIC\": \"FRNYUS33\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"SETPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"19A\",\n" + + " \"qualifier\": \"DEAL\",\n" + + " \"currency\": \"USD\",\n" + + " \"amount\": \"8217083,72\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"19A\",\n" + + " \"qualifier\": \"ACRU\",\n" + + " \"currency\": \"USD\",\n" + + " \"amount\": \"9333,33\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"19A\",\n" + + " \"qualifier\": \"ESTT\",\n" + + " \"currency\": \"USD\",\n" + + " \"amount\": \"8226417,05\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"AMT\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"SETDET\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16R\",\n" + + " \"blockName\": \"OTHRPRTY\"\n" + + " },\n" + + " {\n" + + " \"name\": \"95P\",\n" + + " \"qualifier\": \"MEOR\",\n" + + " \"bIC\": \"CHASUS33\"\n" + + " },\n" + + " {\n" + + " \"name\": \"16S\",\n" + + " \"blockName\": \"OTHRPRTY\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; MT547 mt = (MT547) AbstractMT.fromJson(json); @@ -372,16 +415,16 @@ public void testToJsonAndFromJson() { SwiftMessageComparator comp = new SwiftMessageComparator(); comp.setIgnoreEolsInMultiline(true); - MT103 mt = MT103.parse("{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + - ":20:REFERENCE\n" + - ":23B:CRED\n" + - ":32A:130204USD1234567,89\n" + - ":50K:/12345678901234567890\n" + - "FOOBANKXXXXX\n" + - ":59:/12345678901234567890\n" + - "JOE DOE\n" + - ":71A:OUR\n" + - "-}{5:{CHK:C77F8E009597}{PDE:}}"); + MT103 mt = MT103.parse("{1:F01FOOSEDR0AXXX0000000000}{3:{113:SEPA}{108:ILOVESEPA}}{2:I103FOORECV0XXXXN}{4:\n" + + ":20:REFERENCE\n" + + ":23B:CRED\n" + + ":32A:130204USD1234567,89\n" + + ":50K:/12345678901234567890\n" + + "FOOBANKXXXXX\n" + + ":59:/12345678901234567890\n" + + "JOE DOE\n" + + ":71A:OUR\n" + + "-}{5:{CHK:C77F8E009597}{PDE:}}"); SwiftMessage original = mt.getSwiftMessage(); @@ -389,7 +432,7 @@ public void testToJsonAndFromJson() { * to JSON */ String json = mt.toJson(); - //System.out.println(json); + // System.out.println(json); /* * Generic fromJson implementation @@ -409,21 +452,22 @@ public void testToJsonAndFromJson() { */ @Test public void testJsonSlashPreserveField59() { - String fin = "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + - ":20:D051026EUR100057\n" + - ":13C:/RNCTIME/0802+0000\n" + - ":23B:CRED\n" + - ":32A:051028EUR6740,91\n" + - ":33B:EUR6740,91\n" + - ":50A:SSSSESMMXXX\n" + - ":53A:BBBBESMMXXX\n" + - ":57A:FOOBARYYXXX\n" + - ":59:/ES0123456789012345671234\n" + - "FOOOOO 1000 FOOBAR S.A.\n" + - ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + - "/123123123: FOOVIMAR 2000 FOOBAR\n" + - ":71A:SHA" + - "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; + String fin = + "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n" + + ":20:D051026EUR100057\n" + + ":13C:/RNCTIME/0802+0000\n" + + ":23B:CRED\n" + + ":32A:051028EUR6740,91\n" + + ":33B:EUR6740,91\n" + + ":50A:SSSSESMMXXX\n" + + ":53A:BBBBESMMXXX\n" + + ":57A:FOOBARYYXXX\n" + + ":59:/ES0123456789012345671234\n" + + "FOOOOO 1000 FOOBAR S.A.\n" + + ":70:REDEMPTS. TRADEDATE 2222-10-26\n" + + "/123123123: FOOVIMAR 2000 FOOBAR\n" + + ":71A:SHA" + + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}"; SwiftMessage m = MT103.parse(fin).getSwiftMessage(); @@ -432,124 +476,133 @@ public void testJsonSlashPreserveField59() { JsonObject o = JsonParser.parseString(toJsonV1SwiftMessage).getAsJsonObject(); assertNotNull(o); - assertEquals("/ES0123456789012345671234\nFOOOOO 1000 FOOBAR S.A.", o.get("data").getAsJsonObject().get("block4").getAsJsonObject().getAsJsonArray("tags").get(8).getAsJsonObject().get("value").getAsString()); + assertEquals( + "/ES0123456789012345671234\nFOOOOO 1000 FOOBAR S.A.", + o.get("data") + .getAsJsonObject() + .get("block4") + .getAsJsonObject() + .getAsJsonArray("tags") + .get(8) + .getAsJsonObject() + .get("value") + .getAsString()); } @Test public void testMT103_Field70() { - String mt103JsonOneNarrative = "{\n" + - " \"type\": \"MT\",\n" + - " \"basicHeaderBlock\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + - " \"sessionNumber\": \"0000\",\n" + - " \"sequenceNumber\": \"000000\"\n" + - " },\n" + - " \"applicationHeaderBlock\": {\n" + - " \"receiverAddress\": \"FOORECV0XXXX\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"103\",\n" + - " \"direction\": \"I\"\n" + - " },\n" + - " \"userHeaderBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"113\",\n" + - " \"bankingPriority\": \"SEPA\"\n" + - " },\n" + - " {\n" + - " \"name\": \"108\",\n" + - " \"mUR\": \"ILOVESEPA\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"textBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"reference\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"70\",\n" + - " \"narrative\": \"Narrative Value 1\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"trailerBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"CHK\",\n" + - " \"value\": \"C77F8E009597\"\n" + - " },\n" + - " {\n" + - " \"name\": \"PDE\"\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; + String mt103JsonOneNarrative = "{\n" + " \"type\": \"MT\",\n" + + " \"basicHeaderBlock\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + + " \"sessionNumber\": \"0000\",\n" + + " \"sequenceNumber\": \"000000\"\n" + + " },\n" + + " \"applicationHeaderBlock\": {\n" + + " \"receiverAddress\": \"FOORECV0XXXX\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"103\",\n" + + " \"direction\": \"I\"\n" + + " },\n" + + " \"userHeaderBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"113\",\n" + + " \"bankingPriority\": \"SEPA\"\n" + + " },\n" + + " {\n" + + " \"name\": \"108\",\n" + + " \"mUR\": \"ILOVESEPA\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"textBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"reference\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"70\",\n" + + " \"narrative\": \"Narrative Value 1\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"trailerBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"CHK\",\n" + + " \"value\": \"C77F8E009597\"\n" + + " },\n" + + " {\n" + + " \"name\": \"PDE\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; MT103 mt103 = (MT103) AbstractMT.fromJson(mt103JsonOneNarrative); - String narrativeFinalValue = mt103.getField70().narrative().getUnstructuredFragments().get(0); + String narrativeFinalValue = + mt103.getField70().narrative().getUnstructuredFragments().get(0); assertEquals("Narrative Value 1", narrativeFinalValue); assertEquals("Narrative Value 1", mt103.getField70().getComponent(1)); } @Test public void testMT103_Field70_backwardCompatibility() { - String mt103JsonMoreThanOneNarrative = "{\n" + - " \"type\": \"MT\",\n" + - " \"basicHeaderBlock\": {\n" + - " \"applicationId\": \"F\",\n" + - " \"serviceId\": \"01\",\n" + - " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + - " \"sessionNumber\": \"0000\",\n" + - " \"sequenceNumber\": \"000000\"\n" + - " },\n" + - " \"applicationHeaderBlock\": {\n" + - " \"receiverAddress\": \"FOORECV0XXXX\",\n" + - " \"messagePriority\": \"N\",\n" + - " \"messageType\": \"103\",\n" + - " \"direction\": \"I\"\n" + - " },\n" + - " \"userHeaderBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"113\",\n" + - " \"bankingPriority\": \"SEPA\"\n" + - " },\n" + - " {\n" + - " \"name\": \"108\",\n" + - " \"mUR\": \"ILOVESEPA\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"textBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"20\",\n" + - " \"reference\": \"REFERENCE\"\n" + - " },\n" + - " {\n" + - " \"name\": \"70\",\n" + - " \"narrative\": \"Narrative Value 1 \",\n" + - " \"narrative2\": \"Narrative Value 2 \",\n" + - " \"narrative3\": \"Narrative Value 3\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"trailerBlock\": {\n" + - " \"fields\": [\n" + - " {\n" + - " \"name\": \"CHK\",\n" + - " \"value\": \"C77F8E009597\"\n" + - " },\n" + - " {\n" + - " \"name\": \"PDE\"\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; + String mt103JsonMoreThanOneNarrative = "{\n" + " \"type\": \"MT\",\n" + + " \"basicHeaderBlock\": {\n" + + " \"applicationId\": \"F\",\n" + + " \"serviceId\": \"01\",\n" + + " \"logicalTerminal\": \"FOOSEDR0AXXX\",\n" + + " \"sessionNumber\": \"0000\",\n" + + " \"sequenceNumber\": \"000000\"\n" + + " },\n" + + " \"applicationHeaderBlock\": {\n" + + " \"receiverAddress\": \"FOORECV0XXXX\",\n" + + " \"messagePriority\": \"N\",\n" + + " \"messageType\": \"103\",\n" + + " \"direction\": \"I\"\n" + + " },\n" + + " \"userHeaderBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"113\",\n" + + " \"bankingPriority\": \"SEPA\"\n" + + " },\n" + + " {\n" + + " \"name\": \"108\",\n" + + " \"mUR\": \"ILOVESEPA\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"textBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"20\",\n" + + " \"reference\": \"REFERENCE\"\n" + + " },\n" + + " {\n" + + " \"name\": \"70\",\n" + + " \"narrative\": \"Narrative Value 1 \",\n" + + " \"narrative2\": \"Narrative Value 2 \",\n" + + " \"narrative3\": \"Narrative Value 3\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"trailerBlock\": {\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"CHK\",\n" + + " \"value\": \"C77F8E009597\"\n" + + " },\n" + + " {\n" + + " \"name\": \"PDE\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; MT103 mt103 = (MT103) AbstractMT.fromJson(mt103JsonMoreThanOneNarrative); @@ -559,82 +612,82 @@ public void testMT103_Field70_backwardCompatibility() { assertEquals("Narrative Value 3", narrative.getUnstructuredFragments().get(2)); } - @Test public void testMT202_Field72() { - String mt202JsonOneNarrative = "{" + - " 'type': 'MT'," + - " 'basicHeaderBlock': {" + - " 'applicationId': 'F'," + - " 'serviceId': '01'," + - " 'logicalTerminal': 'GECGHKHHAXXX'," + - " 'sessionNumber': '0000'," + - " 'sequenceNumber': '000000'" + - " }," + - " 'applicationHeaderBlock': {" + - " 'receiverAddress': 'EXMTHKHHXXXX'," + - " 'senderInputTime': null," + - " 'MIRDate': null," + - " 'MIRLogicalTerminal': null," + - " 'MIRSessionNumber': null," + - " 'MIRSequenceNumber': null," + - " 'receiverOutputDate': null," + - " 'receiverOutputTime': null," + - " 'messagePriority': 'N'," + - " 'messageType': '202'," + - " 'direction': 'I'" + - " }," + - " 'userHeaderBlock': {" + - " 'fields': [" + - " {" + - " 'name': '121'," + - " 'uniqueReference': '36e05862-4af1-43ed-a54c-ccdcf0101396'" + - " }" + - " ]" + - " }," + - " 'textBlock': {" + - " 'fields': [" + - " {" + - " 'name': '20'," + - " 'reference': 'TEST2021234'" + - " }," + - " {" + - " 'name': '21'," + - " 'reference': 'TEST202123233'" + - " }," + - " {" + - " 'name': '32A'," + - " 'date': '230131'," + - " 'currency': 'USD'," + - " 'amount': '7878778,'" + - " }," + - " {" + - " 'name': '58A'," + - " 'account': '898989'," + - " 'bIC': 'EXMTHKHH'" + - " }," + - " {" + - " 'name': '72'," + - " 'structured': [" + - " {" + - " 'narrativeFragments': [" + - " 'PURPOSE CODE 1670'," + - " 'SERVICES, SELF COMPANY FUNDING'" + - " ]," + - " 'narrativeSupplementFragments': []," + - " 'codeword': 'INS'" + - " }" + - " ]" + - " }" + - " ]" + - " }" + - "}"; + String mt202JsonOneNarrative = "{" + " 'type': 'MT'," + + " 'basicHeaderBlock': {" + + " 'applicationId': 'F'," + + " 'serviceId': '01'," + + " 'logicalTerminal': 'GECGHKHHAXXX'," + + " 'sessionNumber': '0000'," + + " 'sequenceNumber': '000000'" + + " }," + + " 'applicationHeaderBlock': {" + + " 'receiverAddress': 'EXMTHKHHXXXX'," + + " 'senderInputTime': null," + + " 'MIRDate': null," + + " 'MIRLogicalTerminal': null," + + " 'MIRSessionNumber': null," + + " 'MIRSequenceNumber': null," + + " 'receiverOutputDate': null," + + " 'receiverOutputTime': null," + + " 'messagePriority': 'N'," + + " 'messageType': '202'," + + " 'direction': 'I'" + + " }," + + " 'userHeaderBlock': {" + + " 'fields': [" + + " {" + + " 'name': '121'," + + " 'uniqueReference': '36e05862-4af1-43ed-a54c-ccdcf0101396'" + + " }" + + " ]" + + " }," + + " 'textBlock': {" + + " 'fields': [" + + " {" + + " 'name': '20'," + + " 'reference': 'TEST2021234'" + + " }," + + " {" + + " 'name': '21'," + + " 'reference': 'TEST202123233'" + + " }," + + " {" + + " 'name': '32A'," + + " 'date': '230131'," + + " 'currency': 'USD'," + + " 'amount': '7878778,'" + + " }," + + " {" + + " 'name': '58A'," + + " 'account': '898989'," + + " 'bIC': 'EXMTHKHH'" + + " }," + + " {" + + " 'name': '72'," + + " 'structured': [" + + " {" + + " 'narrativeFragments': [" + + " 'PURPOSE CODE 1670'," + + " 'SERVICES, SELF COMPANY FUNDING'" + + " ]," + + " 'narrativeSupplementFragments': []," + + " 'codeword': 'INS'" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "}"; MT202 mt202 = (MT202) AbstractMT.fromJson(mt202JsonOneNarrative); Narrative narrative = mt202.getField72().narrative(); StructuredNarrative structuredNarrative = narrative.getStructured().get(0); assertEquals("INS", structuredNarrative.getCodeword()); - assertEquals("PURPOSE CODE 1670", structuredNarrative.getNarrativeFragments().get(0)); - assertEquals("SERVICES, SELF COMPANY FUNDING", structuredNarrative.getNarrativeFragments().get(1)); + assertEquals( + "PURPOSE CODE 1670", structuredNarrative.getNarrativeFragments().get(0)); + assertEquals( + "SERVICES, SELF COMPANY FUNDING", + structuredNarrative.getNarrativeFragments().get(1)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/MTVariantTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/MTVariantTest.java index 9e466744d..f316afdbe 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/MTVariantTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/MTVariantTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MTVariantTest { @Test @@ -58,5 +57,4 @@ public void testExtract() { assertEquals(MTVariant.ISLFIN, MTVariant.extract("202_ISLFIN").get()); assertEquals(MTVariant.ISLFIN, MTVariant.extract("fin.202.ISLFIN").get()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/SequenceUtilsTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/SequenceUtilsTest.java index 0aad17913..04acba625 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/SequenceUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/SequenceUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/SequencesAPITest.java b/src/test/java/com/prowidesoftware/swift/model/mt/SequencesAPITest.java index 4caaf1f7e..ea26e425b 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/SequencesAPITest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/SequencesAPITest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,8 @@ import com.prowidesoftware.swift.model.mt.mt3xx.MT360; import com.prowidesoftware.swift.model.mt.mt5xx.MT564; import com.prowidesoftware.swift.model.mt.mt6xx.MT670; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class SequencesAPITest { @@ -120,43 +119,38 @@ public void testMT564_SequenceEList_6() { @Test public void testMT564_SequenceC() { - final String s = - "{1:F01SWHQBEBBAXXX0001000001}{2:I564SWHQBEBBXBILN}{3:{108:495}}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//FU00003020000001\n" + - ":20C::CORP//OTHR000000000302\n" + - ":23G:NEWM\n" + - ":22F::CAEV//OTHR\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20141204070253\n" + - ":25D::PROC//PREU\n" + - ":16S:GENL\n" + - - ":16R:USECU\n" + - ":35B:ISIN AT0000A00GJ3\n" + - "FOO 322 Euro\n" + - " FOO Duration(T)\n" + - ":16R:ACCTINFO\n" + - ":97C::SAFE//GENR\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - - ":16R:CADETL\n" + - ":98A::EFFD//20150129\n" + - ":70G::WEBB//sssss\n" + - ":16S:CADETL\n" + - - ":16R:ADDINFO\n" + - ":70E::ADTX//Fondsfusion\n" + - " FOO 322 Euro \n" + - "FOO Duration\n" + - ":70E::TXNR//Foobar \n" + - "Kapitalanlage Gesellschaft\n" + - " m.b.H. informiert gem.\n" + - " Paragraph133 Abs. 9 InvFG\n" + - " 2011, dass\n" + - ":16S:ADDINFO\n" + - "-}"; + final String s = "{1:F01SWHQBEBBAXXX0001000001}{2:I564SWHQBEBBXBILN}{3:{108:495}}{4:\n" + ":16R:GENL\n" + + ":20C::SEME//FU00003020000001\n" + + ":20C::CORP//OTHR000000000302\n" + + ":23G:NEWM\n" + + ":22F::CAEV//OTHR\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20141204070253\n" + + ":25D::PROC//PREU\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN AT0000A00GJ3\n" + + "FOO 322 Euro\n" + + " FOO Duration(T)\n" + + ":16R:ACCTINFO\n" + + ":97C::SAFE//GENR\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":98A::EFFD//20150129\n" + + ":70G::WEBB//sssss\n" + + ":16S:CADETL\n" + + ":16R:ADDINFO\n" + + ":70E::ADTX//Fondsfusion\n" + + " FOO 322 Euro \n" + + "FOO Duration\n" + + ":70E::TXNR//Foobar \n" + + "Kapitalanlage Gesellschaft\n" + + " m.b.H. informiert gem.\n" + + " Paragraph133 Abs. 9 InvFG\n" + + " 2011, dass\n" + + ":16S:ADDINFO\n" + + "-}"; final MT564 m = new MT564(s); assertEquals(0, m.getSequenceC().size()); assertEquals(0, MT564.getSequenceC(m.getSwiftMessage().getBlock4()).size()); @@ -164,43 +158,41 @@ public void testMT564_SequenceC() { @Test public void testMT564_SequenceB1() { - MT564 mt = MT564.parse("{1:F01SAMPLEXXXXXX0300000054}{2:O5641738190122EDISGB2LAXXX12345123451901230111N}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//VQ8000V1LOI51000\n" + - ":20C::SEME//VQ8000V1LOI51000\n" + - ":23G:NEWM\n" + - ":22F::CAEV//ACTV\n" + - ":22F::CAMV//MAND\n" + - ":25D::PROC//COMP\n" + - ":16S:GENL\n" + + MT564 mt = MT564.parse( + "{1:F01SAMPLEXXXXXX0300000054}{2:O5641738190122EDISGB2LAXXX12345123451901230111N}{4:\n" + ":16R:GENL\n" + + ":20C::CORP//VQ8000V1LOI51000\n" + + ":20C::SEME//VQ8000V1LOI51000\n" + + ":23G:NEWM\n" + + ":22F::CAEV//ACTV\n" + + ":22F::CAMV//MAND\n" + + ":25D::PROC//COMP\n" + + ":16S:GENL\n" + + - // B1 not present in USECU (B) - ":16R:USECU\n" + - ":35B:ISIN INE411H01032\n" + - ":16R:ACCTINFO\n" + - ":97C::SAFE//GENR\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + + // B1 not present in USECU (B) + ":16R:USECU\n" + + ":35B:ISIN INE411H01032\n" + + ":16R:ACCTINFO\n" + + ":97C::SAFE//GENR\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":17B::DFLT//Y\n" + + ":16R:SECMOVE\n" + + ":22H::CRDB//CRED\n" + + ":35B:ISIN XXXXXXXX91B9\n" + + - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":17B::DFLT//Y\n" + - - ":16R:SECMOVE\n" + - ":22H::CRDB//CRED\n" + - ":35B:ISIN XXXXXXXX91B9\n" + - - // colliding FIA sequence in SECMOVE - ":16R:FIA\n" + - ":92A::PRFC//N0,1\n" + - ":16S:FIA\n" + - - ":98A::PAYD//20250329\n" + - ":16S:SECMOVE\n" + - - ":16S:CAOPTN\n" + - "-}"); + // colliding FIA sequence in SECMOVE + ":16R:FIA\n" + + ":92A::PRFC//N0,1\n" + + ":16S:FIA\n" + + ":98A::PAYD//20250329\n" + + ":16S:SECMOVE\n" + + ":16S:CAOPTN\n" + + "-}"); MT564.SequenceB seqB = mt.getSequenceB(); assertNotNull(seqB); assertEquals(6, seqB.size()); @@ -224,15 +216,8 @@ public void test_NPE() { @Test public void testMT670_SequenceC() { MT670 m = new MT670() - .append(MT670.SequenceA2.newInstance( - Field95P.tag("SSIR") - ) - ) - .append(MT670.SequenceB.newInstance( - MT670.SequenceB2.newInstance( - Field22F.tag("PMTH") - )) - ); + .append(MT670.SequenceA2.newInstance(Field95P.tag("SSIR"))) + .append(MT670.SequenceB.newInstance(MT670.SequenceB2.newInstance(Field22F.tag("PMTH")))); assertTrue(m.getSequenceC().isEmpty()); } @@ -264,21 +249,13 @@ public void testMT101_NewSequenceB() { @Test public void testMT104_SequenceC() { MT104 m = new MT104() - .append(MT104.SequenceA.newInstance( - Field20.tag("FOO"), - Field30.tag("FOO") - )) + .append(MT104.SequenceA.newInstance(Field20.tag("FOO"), Field30.tag("FOO"))) .append(MT104.SequenceB.newInstance( - Field21.tag("FOO"), - Field32B.tag("FOO"), - Field59.tag("FOO"), - Field36.tag("FOO") - )) + Field21.tag("FOO"), Field32B.tag("FOO"), Field59.tag("FOO"), Field36.tag("FOO"))) .append(Field32B.tag("FOO"), Field71G.tag("FOO")); assertFalse(m.getSequenceC().isEmpty()); assertEquals(2, m.getSequenceC().size()); assertEquals(Field32B.NAME, m.getSequenceC().getTag(0).getName()); assertEquals(Field71G.NAME, m.getSequenceC().getTag(1).getName()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT010Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT010Test.java index 4d9f05aee..dbe731d66 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT010Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT010Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import com.prowidesoftware.swift.model.field.*; import org.junit.jupiter.api.Test; - public class MT010Test { private final String sample = "{1:F01VNDZBET2AXXX0000000000}{2:I010DYDYXXXXXXXXN}{4:" @@ -64,4 +63,4 @@ public void test_create() { m.append(new Field104("U")); assertEquals(sample, m.message()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT011Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT011Test.java index e7e7ce27e..24a2da735 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT011Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT011Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import com.prowidesoftware.swift.model.field.Field175; import org.junit.jupiter.api.Test; - public class MT011Test { private final String sample = "{1:F01VNDZBET2AXXX0000000000}{2:I011DYDYXXXXXXXXN}{4:" @@ -54,7 +53,6 @@ public void test_parse() { assertNotNull(m.getField107()); assertEquals("010605VNDZGBT2AXXX0017000244", m.getField107().getValue()); - } @Test @@ -70,4 +68,4 @@ public void test_create() { assertEquals(sample, m.message()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT015Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT015Test.java index 8a98476b1..d73b0add1 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT015Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT015Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,7 @@ public class MT015Test { - private final String sample = "{1:F01VNDZBET2AXXX0000000000}{2:I015DYDYXXXXXXXXN}{4:" - + "{405:V22}}"; + private final String sample = "{1:F01VNDZBET2AXXX0000000000}{2:I015DYDYXXXXXXXXN}{4:" + "{405:V22}}"; @Test public void test_parse() { diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT019Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT019Test.java index 99a02ed54..149fd1fc4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT019Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT019Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT020Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT020Test.java index ea33d4ccc..5f47633b2 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT020Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT020Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,9 @@ public void test_parse2() { assertEquals("VNDZBET2AXXX", m.getField102().getValue()); assertNotNull(m.getField252()); - assertEquals("050801VNDZBET2AXXX0134000649050801VNDZBET2AXXX0135000663", m.getField252().getValue()); + assertEquals( + "050801VNDZBET2AXXX0134000649050801VNDZBET2AXXX0135000663", + m.getField252().getValue()); } @Test @@ -101,7 +103,9 @@ public void test_parse4() { assertEquals("VNDZBET2AXXX", m.getField102().getValue()); assertNotNull(m.getField254()); - assertEquals("050723VNDZBET2AXXX0207001127050723VNDZBET2AXXX0210001130", m.getField254().getValue()); + assertEquals( + "050723VNDZBET2AXXX0207001127050723VNDZBET2AXXX0210001130", + m.getField254().getValue()); } @Test @@ -239,5 +243,4 @@ public void test_create8() { assertEquals(sample8, m.message()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT021Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT021Test.java index 111201f2a..52a2833d8 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT021Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT021Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,5 +70,4 @@ public void test_create1() { assertEquals(sample1, m.message()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT022Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT022Test.java index e14f8340e..c44399f92 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT022Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT022Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +89,9 @@ public void test_parse3() { assertEquals("VNDZBET2AXXX", m.getField102().getValue()); assertNotNull(m.getField252()); - assertEquals("050822VNDZBET2AXXX0294001093050822VNDZBET2AXXX0294001096", m.getField252().getValue()); + assertEquals( + "050822VNDZBET2AXXX0294001093050822VNDZBET2AXXX0294001096", + m.getField252().getValue()); } @Test @@ -113,7 +115,9 @@ public void test_parse5() { assertEquals("VNDZBET2AXXX", m.getField102().getValue()); assertNotNull(m.getField254()); - assertEquals("050822VNDZBET2AXXX0025000093050822VNDZBET2AXXX002500009714501454", m.getField254().getValue()); + assertEquals( + "050822VNDZBET2AXXX0025000093050822VNDZBET2AXXX002500009714501454", + m.getField254().getValue()); } @Test @@ -239,5 +243,4 @@ public void test_create8() { assertEquals(sample8, m.message()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT023Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT023Test.java index cb92cd51f..a4b21f8fc 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT023Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT023Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,5 +70,4 @@ public void test_create1() { assertEquals(sample1, m.message()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT024Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT024Test.java index c6f77590c..a6ea3d6c0 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT024Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT024Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT025Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT025Test.java index 7dc3c36b2..e776f7172 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT025Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT025Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT028Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT028Test.java index 171672b95..8011f9bc4 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT028Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT028Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,11 +26,10 @@ public class MT028Test { - private final String sample1 = "{1:F01VNDZBET2AXXX0000000000}{2:I028DYDYXXXXXXXXN}{4:" - + "{103:TGT}{243:1}}"; + private final String sample1 = "{1:F01VNDZBET2AXXX0000000000}{2:I028DYDYXXXXXXXXN}{4:" + "{103:TGT}{243:1}}"; - private final String sample2 = "{1:F01VNDZBET2AXXX0000000000}{2:I028DYDYXXXXXXXXN}{4:" - + "{103:TGT}{243:2}{177:0106051000}}"; + private final String sample2 = + "{1:F01VNDZBET2AXXX0000000000}{2:I028DYDYXXXXXXXXN}{4:" + "{103:TGT}{243:2}{177:0106051000}}"; private final String sample3 = "{1:F01VNDZBET2AXXX0000000000}{2:I028DYDYXXXXXXXXN}{4:" + "{103:TGT}{243:1}{177:0106052200}{177:0106062359}}"; diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT031Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT031Test.java index a74c86977..e202dd535 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT031Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/MT031Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,5 @@ public void test_create() { m.append(new Field177("0106052359")); assertEquals(sample1, m.message()); - } } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/package-info.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/package-info.java index b23ee4859..beb7a1197 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/package-info.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt0xx/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,4 +19,4 @@ * * @author sebastian */ -package com.prowidesoftware.swift.model.mt.mt0xx; \ No newline at end of file +package com.prowidesoftware.swift.model.mt.mt0xx; diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT101Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT101Test.java index fb1a0c7b6..5b23dba1c 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT101Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT101Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import static org.junit.jupiter.api.Assertions.*; import com.prowidesoftware.swift.model.field.Field59; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class MT101Test { @@ -34,39 +33,34 @@ public void test1() { @Test public void testSequences() { - MT101 mt = MT101.parse("{1:F01ABCDVEC0AXXX5480000053}{2:I101FOOBARAAXXXXN}{4:\n" + - ":20:FILEREF2\n" + - ":21R:UKSUPPLIER990901\n" + - ":28D:1/1\n" + - ":50H:/8754219990\n" + - "MAG-NUM INC.\n" + - "GENERAL A/C\n" + - "BAHNOFFSTRASSE 30\n" + - "ZURICH, SWITZERLAND\n" + - ":30:020905\n" + - - ":21:TRANSREF1\n" + - ":32B:GBP12500,\n" + - ":59:/1091282\n" + - "Beneficiary 1\n" + - ":71A:OUR\n" + - - ":21:TRANSREF2\n" + - ":32B:GBP15000,\n" + - ":59:/8123560\n" + - "Beneficiary 2\n" + - ":71A:OUR\n" + - - ":21:TRANSREF3\n" + - ":32B:GBP10000,\n" + - ":59:/2179742\n" + - "Beneficiary3\n" + - ":71A:OUR\n" + - "-}"); + MT101 mt = MT101.parse("{1:F01ABCDVEC0AXXX5480000053}{2:I101FOOBARAAXXXXN}{4:\n" + ":20:FILEREF2\n" + + ":21R:UKSUPPLIER990901\n" + + ":28D:1/1\n" + + ":50H:/8754219990\n" + + "MAG-NUM INC.\n" + + "GENERAL A/C\n" + + "BAHNOFFSTRASSE 30\n" + + "ZURICH, SWITZERLAND\n" + + ":30:020905\n" + + ":21:TRANSREF1\n" + + ":32B:GBP12500,\n" + + ":59:/1091282\n" + + "Beneficiary 1\n" + + ":71A:OUR\n" + + ":21:TRANSREF2\n" + + ":32B:GBP15000,\n" + + ":59:/8123560\n" + + "Beneficiary 2\n" + + ":71A:OUR\n" + + ":21:TRANSREF3\n" + + ":32B:GBP10000,\n" + + ":59:/2179742\n" + + "Beneficiary3\n" + + ":71A:OUR\n" + + "-}"); List transfers = mt.getSequenceBList(); assertEquals(3, transfers.size()); assertEquals("TRANSREF3", transfers.get(2).getFieldByName("21").getValue()); assertEquals("Beneficiary3", ((Field59) transfers.get(2).getFieldByName("59")).getNameAndAddressLine1()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103Test.java index 7191bcb88..784a3e3c8 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,5 +29,4 @@ public void test1() { assertNotNull(m.getUETR()); assertFalse(m.getSwiftMessage().isSTP()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_REMITTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_REMITTest.java index 662c4e51a..f1b446219 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_REMITTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_REMITTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,5 +29,4 @@ public void test1() { assertNotNull(m.getUETR()); assertTrue(m.getSwiftMessage().isREMIT()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_STPTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_STPTest.java index 8f78c9590..3c7cf0877 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_STPTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt1xx/MT103_STPTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,5 +29,4 @@ public void test1() { assertNotNull(m.getUETR()); assertTrue(m.getSwiftMessage().isSTP()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202COVTest.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202COVTest.java index 1c2007318..986a4192a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202COVTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202COVTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,12 +40,9 @@ public void test2() { Field21.tag("RELREF"), Field32A.tag("121212USD1234,56"), Field58A.tag("ABCOCOBMXXX"))) - .append(MT202COV.SequenceB.newInstance( - Field50A.tag("DEFOCOBMXXX"), - Field59A.tag("GHIOCOBMXXX"))); + .append(MT202COV.SequenceB.newInstance(Field50A.tag("DEFOCOBMXXX"), Field59A.tag("GHIOCOBMXXX"))); assertNotNull(m.getUETR()); assertTrue(m.getSwiftMessage().isCOV()); assertEquals(6, m.getSwiftMessage().getBlock4().getTags().size()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202Test.java index 1b40a7414..86b2c880a 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT202Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,5 +27,4 @@ public void test1() { MT202 m = new MT202(); assertNotNull(m.getUETR()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT205Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT205Test.java index 9381e73f8..6d4cb42ce 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT205Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt2xx/MT205Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,5 +27,4 @@ public void test1() { MT205 m = new MT205(); assertNotNull(m.getUETR()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT300Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT300Test.java index 3ad579548..9c5e43459 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT300Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT300Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,49 +18,43 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class MT300Test { @Test public void test1() { - String fin = "{1:F01ABCDSKB0AXXX1024007372}{2:O3001920140829ABCDHUH0AXXX21390371231409011800N}{4:\n" + - ":15A:\n" + - ":20:712443\n" + - ":22A:NEWT\n" + - ":22C:FOO12345678\n" + - ":17U:N\n" + - ":82A:ABCDHUH0XXX\n" + - ":87A:ABCDSKB0XXX\n" + - ":15B:\n" + - ":30T:20140829\n" + - ":30V:20140902\n" + - ":36:232,1\n" + - ":32B:USD200000,\n" + - ":53A:BOFAUS30XXX\n" + - ":57A:BOFAUS30XXX\n" + - ":33B:HUF46420000,\n" + - ":53A:ABCDHUH0XXX\n" + - ":57A:/1178200781106853\n" + - "ABCDHUH0XXX\n" + - ":15E:\n" + - - ":22L:ESMA1\n" + - ":22M:W3MOO00A18\n" + - ":22N:00OTP00KS00FWD000000000000000123\n" + - - ":22L:ESMA2\n" + - - ":22L:ESMA3\n" + - ":22M:W3MOO00A19\n" + - ":22N:00OTP00KS00FWD000000000000000234\n" + - ":22M:W3MOO00A20\n" + - ":22N:00OTP00KS00FWD000000000000000345\n" + - - ":22L:ESMA4\n" + - "-}"; + String fin = "{1:F01ABCDSKB0AXXX1024007372}{2:O3001920140829ABCDHUH0AXXX21390371231409011800N}{4:\n" + ":15A:\n" + + ":20:712443\n" + + ":22A:NEWT\n" + + ":22C:FOO12345678\n" + + ":17U:N\n" + + ":82A:ABCDHUH0XXX\n" + + ":87A:ABCDSKB0XXX\n" + + ":15B:\n" + + ":30T:20140829\n" + + ":30V:20140902\n" + + ":36:232,1\n" + + ":32B:USD200000,\n" + + ":53A:BOFAUS30XXX\n" + + ":57A:BOFAUS30XXX\n" + + ":33B:HUF46420000,\n" + + ":53A:ABCDHUH0XXX\n" + + ":57A:/1178200781106853\n" + + "ABCDHUH0XXX\n" + + ":15E:\n" + + ":22L:ESMA1\n" + + ":22M:W3MOO00A18\n" + + ":22N:00OTP00KS00FWD000000000000000123\n" + + ":22L:ESMA2\n" + + ":22L:ESMA3\n" + + ":22M:W3MOO00A19\n" + + ":22N:00OTP00KS00FWD000000000000000234\n" + + ":22M:W3MOO00A20\n" + + ":22N:00OTP00KS00FWD000000000000000345\n" + + ":22L:ESMA4\n" + + "-}"; MT300 m = MT300.parse(fin); // test getter for E1 @@ -96,5 +90,4 @@ public void test1() { assertEquals("W3MOO00A20", found.get(2).getTag(3).getValue()); assertEquals("00OTP00KS00FWD000000000000000345", found.get(2).getTag(4).getValue()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT304Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT304Test.java index 5c5596672..2d2e7b936 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT304Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt3xx/MT304Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,39 +18,39 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import com.prowidesoftware.swift.model.Tag; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; - public class MT304Test { @Test public void test() { - String msg = "{1:F01AAAAUS30AXXX0000123450}{2:O3041357180702BBBBGB44AXXX00000000001806281357N}{4:\n" + - ":15A:\n" + - ":20:REF11111\n" + - ":22A:NEWT\n" + - ":94A:ASET\n" + - ":83J:/NAME/NA\n" + - ":82J:/NAME/BBBBUS33XXX\n" + - ":87A:CCCCUS33XXX\n" + - ":15B:\n" + - ":30T:20220415\n" + - ":30V:20220415\n" + - ":36:2,95\n" + + String msg = "{1:F01AAAAUS30AXXX0000123450}{2:O3041357180702BBBBGB44AXXX00000000001806281357N}{4:\n" + ":15A:\n" + + ":20:REF11111\n" + + ":22A:NEWT\n" + + ":94A:ASET\n" + + ":83J:/NAME/NA\n" + + ":82J:/NAME/BBBBUS33XXX\n" + + ":87A:CCCCUS33XXX\n" + + ":15B:\n" + + ":30T:20220415\n" + + ":30V:20220415\n" + + ":36:2,95\n" + + // B1 - ":32B:HKD1947,\n" + + ":32B:HKD1947,\n" + + // missing mandatory 53a - ":57A:AAAAUS30XXX\n" + + ":57A:AAAAUS30XXX\n" + + // B2 - ":33B:GYD46549,\n" + - ":53A:EEEEUS33XXX\n" + - ":56J:/ABIC/DDDDUS33XXX\n" + - "/NAME/ksdjskjskf\n" + - "/ADD1/ok\n" + - "/CITY/lol\n" + - ":57A:AAAAUS30XXX\n" + - "-}"; + ":33B:GYD46549,\n" + + ":53A:EEEEUS33XXX\n" + + ":56J:/ABIC/DDDDUS33XXX\n" + + "/NAME/ksdjskjskf\n" + + "/ADD1/ok\n" + + "/CITY/lol\n" + + ":57A:AAAAUS30XXX\n" + + "-}"; MT304 mt304 = new MT304(msg); MT304.SequenceB1 b1 = mt304.getSequenceB1(); @@ -63,5 +63,4 @@ public void test() { assertEquals(new Tag("33B", "GYD46549,"), b2.getTags().get(0)); assertEquals(new Tag("53A", "EEEEUS33XXX"), b2.getTags().get(1)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT535Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT535Test.java index 5537392cf..fcae41fc8 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT535Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT535Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,5 +60,4 @@ public void test2() { m.append(MT535.SequenceB1c.newInstance()); assertTrue(m.getSequenceB1b1List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT536Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT536Test.java index e387ad39c..d785c0789 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT536Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT536Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,5 +43,4 @@ public void test2() { m.append(MT536.SequenceB1a1.newInstance()); assertTrue(m.getSequenceA1List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT537Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT537Test.java index e79f58c79..1fd715430 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT537Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT537Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,8 @@ import com.prowidesoftware.swift.model.SwiftTagListBlock; import com.prowidesoftware.swift.model.field.Field22H; import com.prowidesoftware.swift.model.field.Field95C; -import org.junit.jupiter.api.Test; - import java.util.List; - +import org.junit.jupiter.api.Test; public class MT537Test { @@ -73,8 +71,8 @@ public void testC2a() { m.append(MT537.SequenceC.newInstance(MT537.SequenceC2.newInstance(MT537.SequenceC2a.newInstance()))); assertEquals(1, MT537.getSequenceCList(m.getSwiftMessage().getBlock4()).size()); assertEquals(1, MT537.getSequenceC2List(m.getSwiftMessage().getBlock4()).size()); - assertEquals(1, MT537.getSequenceC2aList(m.getSwiftMessage().getBlock4()).size()); - + assertEquals( + 1, MT537.getSequenceC2aList(m.getSwiftMessage().getBlock4()).size()); } @Test @@ -82,13 +80,11 @@ public void testC2a_from_S285() { SwiftTagListBlock C2_contents = new SwiftTagListBlock() .append(Field22H.tag(":REDE//DELI")) .append(MT537.SequenceC2a.newInstance(Field95C.tag(":DEAG"))); - MT537 m = new MT537() - .append(MT537.SequenceC.newInstance( - MT537.SequenceC2.newInstance(C2_contents) - )); + MT537 m = new MT537().append(MT537.SequenceC.newInstance(MT537.SequenceC2.newInstance(C2_contents))); assertEquals(1, MT537.getSequenceCList(m.getSwiftMessage().getBlock4()).size()); assertEquals(1, MT537.getSequenceC2List(m.getSwiftMessage().getBlock4()).size()); - assertEquals(1, MT537.getSequenceC2aList(m.getSwiftMessage().getBlock4()).size()); + assertEquals( + 1, MT537.getSequenceC2aList(m.getSwiftMessage().getBlock4()).size()); assertEquals(1, m.getSequenceCList().size()); assertEquals(1, m.getSequenceC2List().size()); @@ -175,7 +171,9 @@ public void testB_overlappingD1a1B1a() { MT537 m = new MT537(); m.append(MT537.SequenceB.newInstance(MT537.SequenceB1.newInstance())); m.append(MT537.SequenceB.newInstance(MT537.SequenceB1.newInstance())); - m.append(MT537.SequenceD.newInstance(MT537.SequenceD1.newInstance(MT537.SequenceD1a.newInstance(MT537.SequenceD1a1.newInstance(MT537.SequenceD1a1B.newInstance(MT537.SequenceD1a1B1.newInstance(MT537.SequenceD1a1B1a.newInstance()))))))); + m.append(MT537.SequenceD.newInstance(MT537.SequenceD1.newInstance( + MT537.SequenceD1a.newInstance(MT537.SequenceD1a1.newInstance(MT537.SequenceD1a1B.newInstance( + MT537.SequenceD1a1B1.newInstance(MT537.SequenceD1a1B1a.newInstance()))))))); List sequences = m.getSequenceBList(); assertFalse(sequences.isEmpty()); assertEquals(2, sequences.size()); @@ -187,9 +185,10 @@ public void testB_overlappingD1a1B1a() { @Test public void testB_overlappingD1a1B1a_2() { MT537 m = new MT537(); - m.append(MT537.SequenceD.newInstance(MT537.SequenceD1.newInstance(MT537.SequenceD1a.newInstance(MT537.SequenceD1a1.newInstance(MT537.SequenceD1a1B.newInstance(MT537.SequenceD1a1B1.newInstance(MT537.SequenceD1a1B1a.newInstance()))))))); + m.append(MT537.SequenceD.newInstance(MT537.SequenceD1.newInstance( + MT537.SequenceD1a.newInstance(MT537.SequenceD1a1.newInstance(MT537.SequenceD1a1B.newInstance( + MT537.SequenceD1a1B1.newInstance(MT537.SequenceD1a1B1a.newInstance()))))))); List sequences = m.getSequenceBList(); assertTrue(sequences.isEmpty()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT538Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT538Test.java index 554330538..4eb033812 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT538Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT538Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT538Test { /** @@ -44,5 +43,4 @@ public void test2() { m.append(MT538.SequenceB2a1.newInstance()); assertTrue(m.getSequenceA1List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT540Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT540Test.java index e2e25f439..4b8385997 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT540Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT540Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,48 +22,46 @@ import com.prowidesoftware.swift.model.field.Field; import com.prowidesoftware.swift.model.field.Field20C; import com.prowidesoftware.swift.model.mt.AbstractMT; -import org.junit.jupiter.api.Test; - import java.io.IOException; - +import org.junit.jupiter.api.Test; public class MT540Test { public static final String MT_540_CANC = - "{1:F01AAAAFRPPAGSS0000000000}{2:O5401445211216BBBBFRPPAHCM5C3E1000002112161445N}{3:{108:5123C3E10}}{4:\n" + - ":16R:GENL\n" + - ":20C::SEME//TFH5436259-999\n" + - ":23G:CANC\n" + - ":98C::PREP//20211216144402\n" + - ":16R:LINK\n" + - ":20C::PREV//TFH5436259-999\n" + - ":16S:LINK\n" + - ":16S:GENL\n" + - ":16R:TRADDET\n" + - ":98A::SETT//20211216\n" + - ":98A::TRAD//20211216\n" + - ":35B:ISIN FR0099001N99\n" + - "FRTR 0 25 02 24 EUR\n" + - ":16S:TRADDET\n" + - ":16R:FIAC\n" + - ":36B::SETT//FAMT/31000000,\n" + - ":97A::SAFE//0528808067001999\n" + - ":16S:FIAC\n" + - ":16R:SETDET\n" + - ":22F::SETR//TRAD\n" + - ":16R:SETPRTY\n" + - ":95P::DEAG//CCCCBEBEECL\n" + - ":97A::SAFE//94999\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::SELL//DDDDFRPPHCM\n" + - ":97A::SAFE//94999\n" + - ":16S:SETPRTY\n" + - ":16R:SETPRTY\n" + - ":95P::PSET//EEEEFRPPXXX\n" + - ":16S:SETPRTY\n" + - ":16S:SETDET\n" + - "-}"; + "{1:F01AAAAFRPPAGSS0000000000}{2:O5401445211216BBBBFRPPAHCM5C3E1000002112161445N}{3:{108:5123C3E10}}{4:\n" + + ":16R:GENL\n" + + ":20C::SEME//TFH5436259-999\n" + + ":23G:CANC\n" + + ":98C::PREP//20211216144402\n" + + ":16R:LINK\n" + + ":20C::PREV//TFH5436259-999\n" + + ":16S:LINK\n" + + ":16S:GENL\n" + + ":16R:TRADDET\n" + + ":98A::SETT//20211216\n" + + ":98A::TRAD//20211216\n" + + ":35B:ISIN FR0099001N99\n" + + "FRTR 0 25 02 24 EUR\n" + + ":16S:TRADDET\n" + + ":16R:FIAC\n" + + ":36B::SETT//FAMT/31000000,\n" + + ":97A::SAFE//0528808067001999\n" + + ":16S:FIAC\n" + + ":16R:SETDET\n" + + ":22F::SETR//TRAD\n" + + ":16R:SETPRTY\n" + + ":95P::DEAG//CCCCBEBEECL\n" + + ":97A::SAFE//94999\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::SELL//DDDDFRPPHCM\n" + + ":97A::SAFE//94999\n" + + ":16S:SETPRTY\n" + + ":16R:SETPRTY\n" + + ":95P::PSET//EEEEFRPPXXX\n" + + ":16S:SETPRTY\n" + + ":16S:SETDET\n" + + "-}"; @Test void field20C_should_be_returned_by_MT540_CANC() { @@ -76,7 +74,8 @@ void field20C_should_be_returned_by_MT540_CANC() { assertThat(mt540.getField20C()).hasSize(2); assertThat(mt540.getField20C().get(0).getReference()).isEqualTo("TFH5436259-999"); - Field fieldByName = mt540.getSwiftMessage().getBlock4().getFieldByName(Field20C.NAME, SchemeConstantsS.SEME); + Field fieldByName = + mt540.getSwiftMessage().getBlock4().getFieldByName(Field20C.NAME, SchemeConstantsS.SEME); assertThat(fieldByName.getComponents()).hasSize(2); assertThat(fieldByName.getComponent(1)).isEqualTo("SEME"); assertThat(fieldByName.getComponent(2)).isEqualTo("TFH5436259-999"); @@ -85,5 +84,4 @@ void field20C_should_be_returned_by_MT540_CANC() { fail(); } } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT564Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT564Test.java index 2aeeb6eed..fd6dc62f5 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT564Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT564Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT564Test { /** @@ -47,40 +46,36 @@ public void test2() { @Test public void testGetSequences() { - MT564 mt = MT564.parse("{1:F01FOOBARXXBGLO0524000001}{2:I564AAAABEBEXECLN}{4:\n" + - ":16R:GENL\n" + - ":20C::CORP//11111111\n" + - ":20C::SEME//2222222\n" + - ":23G:NEWM\n" + - ":22F::CAEV//EXWA\n" + - ":22F::CAMV//MAND\n" + - ":98C::PREP//20151016170651\n" + - ":25D::PROC//PREU\n" + - ":16S:GENL\n" + - ":16R:USECU\n" + - ":35B:ISIN DE000UT12345\n" + - "UBS LDN FOO IFX\n" + - ":16R:ACCTINFO\n" + - ":97A::SAFE//71xx0000\n" + - ":93B::ELIG//UNIT/1000,\n" + - ":93B::SETT//UNIT/1000,\n" + - ":16S:ACCTINFO\n" + - ":16S:USECU\n" + - - ":16R:CADETL\n" + - ":17B::CERT//Y\n" + - ":17B::LEOG//Y\n" + - ":17B::SRDC//Y\n" + - ":16S:CADETL\n" + - - ":16R:CAOPTN\n" + - ":13A::CAON//001\n" + - ":22F::CAOP//CASH\n" + - ":17B::DFLT//Y\n" + - ":17B::APLI//Y\n" + - ":16S:CAOPTN\n" + - - "-}"); + MT564 mt = MT564.parse("{1:F01FOOBARXXBGLO0524000001}{2:I564AAAABEBEXECLN}{4:\n" + ":16R:GENL\n" + + ":20C::CORP//11111111\n" + + ":20C::SEME//2222222\n" + + ":23G:NEWM\n" + + ":22F::CAEV//EXWA\n" + + ":22F::CAMV//MAND\n" + + ":98C::PREP//20151016170651\n" + + ":25D::PROC//PREU\n" + + ":16S:GENL\n" + + ":16R:USECU\n" + + ":35B:ISIN DE000UT12345\n" + + "UBS LDN FOO IFX\n" + + ":16R:ACCTINFO\n" + + ":97A::SAFE//71xx0000\n" + + ":93B::ELIG//UNIT/1000,\n" + + ":93B::SETT//UNIT/1000,\n" + + ":16S:ACCTINFO\n" + + ":16S:USECU\n" + + ":16R:CADETL\n" + + ":17B::CERT//Y\n" + + ":17B::LEOG//Y\n" + + ":17B::SRDC//Y\n" + + ":16S:CADETL\n" + + ":16R:CAOPTN\n" + + ":13A::CAON//001\n" + + ":22F::CAOP//CASH\n" + + ":17B::DFLT//Y\n" + + ":17B::APLI//Y\n" + + ":16S:CAOPTN\n" + + "-}"); // CADTL assertFalse(mt.getSequenceD().isEmpty()); @@ -88,5 +83,4 @@ public void testGetSequences() { // CAOPTN assertEquals(1, mt.getSequenceEList().size()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT566Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT566Test.java index d21d09b0e..d2d843c89 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT566Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT566Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT566Test { /** @@ -44,5 +43,4 @@ public void test2() { m.append(MT566.SequenceD1a.newInstance()); assertTrue(m.getSequenceB1().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT575Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT575Test.java index 45ddf4020..e87a83655 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT575Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT575Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT575Test { /** @@ -83,5 +82,4 @@ public void test5() { m.append(MT575.SequenceC2a.newInstance()); assertTrue(m.getSequenceB1a4List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT576Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT576Test.java index e80a4a55b..4b44df045 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT576Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT576Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT576Test { /** @@ -44,5 +43,4 @@ public void test2() { m.append(MT576.SequenceB2a.newInstance()); assertTrue(m.getSequenceA1List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT586Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT586Test.java index ee1bfa20b..24aa886ca 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT586Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt5xx/MT586Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; - public class MT586Test { /** @@ -44,5 +43,4 @@ public void test2() { m.append(MT586.SequenceB1.newInstance()); assertTrue(m.getSequenceA1List().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT670Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT670Test.java index 4c42af473..020a705dc 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT670Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT670Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test; - public class MT670Test { @Test @@ -49,5 +48,4 @@ public void test3() { m.append(MT670.SequenceC.newInstance()); assertFalse(m.getSequenceC().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT671Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT671Test.java index f418cc88d..193349d46 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT671Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt6xx/MT671Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test; - public class MT671Test { @Test @@ -48,5 +47,4 @@ public void test3() { m.append(MT671.SequenceC.newInstance()); assertFalse(m.getSequenceC().isEmpty()); } - } diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt7xx/MT798Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt7xx/MT798Test.java index 2b728f75c..09f49cada 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt7xx/MT798Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt7xx/MT798Test.java @@ -12,41 +12,40 @@ public class MT798Test { @Test public void testSubMessageType() { - String fin = "{1:F01AAAADEM0AXXX0000000000}{2:I798BBBBITRRXMCEN2020}{4:\n" + - ":20:12345\n" + - ":12:760\n" + - ":77E:\n" + - ":27A:2/2\n" + - ":21A:2201091711320000\n" + - ":15A:\n" + - ":27:1/1\n" + - ":22A:ISSU\n" + - ":15B:\n" + - ":20:Bla Blah\n" + - ":30:250109\n" + - ":22D:DGAR\n" + - ":40C:ISPR\n" + - ":23B:FIXD\n" + - ":31E:250109\n" + - ":35G:If things happen\n" + - ":50:Mr. App\n" + - "This Way\n" + - "Our City\n" + - ":51:Mr. Obligor\n" + - "His stay\n" + - ":52D:Mr. Issue\n" + - ":59:Mr. Bene\n" + - "In Road\n" + - ":56A:ANLAITRRMFE\n" + - ":32B:USD23456789,\n" + - ":77U:Terms and conditions\n" + - "have been defined\n" + - ":45L:Some details\n" + - "about the underlying tx\n" + - ":24E:MAIL\n" + - ":24G:OTHR\n" + - "Foobar\n" + - "-}"; + String fin = "{1:F01AAAADEM0AXXX0000000000}{2:I798BBBBITRRXMCEN2020}{4:\n" + ":20:12345\n" + + ":12:760\n" + + ":77E:\n" + + ":27A:2/2\n" + + ":21A:2201091711320000\n" + + ":15A:\n" + + ":27:1/1\n" + + ":22A:ISSU\n" + + ":15B:\n" + + ":20:Bla Blah\n" + + ":30:250109\n" + + ":22D:DGAR\n" + + ":40C:ISPR\n" + + ":23B:FIXD\n" + + ":31E:250109\n" + + ":35G:If things happen\n" + + ":50:Mr. App\n" + + "This Way\n" + + "Our City\n" + + ":51:Mr. Obligor\n" + + "His stay\n" + + ":52D:Mr. Issue\n" + + ":59:Mr. Bene\n" + + "In Road\n" + + ":56A:ANLAITRRMFE\n" + + ":32B:USD23456789,\n" + + ":77U:Terms and conditions\n" + + "have been defined\n" + + ":45L:Some details\n" + + "about the underlying tx\n" + + ":24E:MAIL\n" + + ":24G:OTHR\n" + + "Foobar\n" + + "-}"; MT798 mt798 = MT798.parse(fin); assertEquals(26, mt798.getSwiftMessage().getBlock4().getTags().size()); @@ -60,51 +59,48 @@ public void testSubMessageType() { @Test public void buildSubMessageType() { - String fin = "{1:F01AAAADEM0AXXX0000000000}{2:I760BBBBITRRXMCEN2020}{4:\n" + - ":27A:2/2\n" + - ":21A:2201091711320000\n" + - ":15A:\n" + - ":27:1/1\n" + - ":22A:ISSU\n" + - ":15B:\n" + - ":20:Bla Blah\n" + - ":30:250109\n" + - ":22D:DGAR\n" + - ":40C:ISPR\n" + - ":23B:FIXD\n" + - ":31E:250109\n" + - ":35G:If things happen\n" + - ":50:Mr. App\n" + - "This Way\n" + - "Our City\n" + - ":51:Mr. Obligor\n" + - "His stay\n" + - ":52D:Mr. Issue\n" + - ":59:Mr. Bene\n" + - "In Road\n" + - ":56A:ANLAITRRMFE\n" + - ":32B:USD23456789,\n" + - ":77U:Terms and conditions\n" + - "have been defined\n" + - ":45L:Some details\n" + - "about the underlying tx\n" + - ":24E:MAIL\n" + - ":24G:OTHR\n" + - "Foobar\n" + - "-}"; + String fin = "{1:F01AAAADEM0AXXX0000000000}{2:I760BBBBITRRXMCEN2020}{4:\n" + ":27A:2/2\n" + + ":21A:2201091711320000\n" + + ":15A:\n" + + ":27:1/1\n" + + ":22A:ISSU\n" + + ":15B:\n" + + ":20:Bla Blah\n" + + ":30:250109\n" + + ":22D:DGAR\n" + + ":40C:ISPR\n" + + ":23B:FIXD\n" + + ":31E:250109\n" + + ":35G:If things happen\n" + + ":50:Mr. App\n" + + "This Way\n" + + "Our City\n" + + ":51:Mr. Obligor\n" + + "His stay\n" + + ":52D:Mr. Issue\n" + + ":59:Mr. Bene\n" + + "In Road\n" + + ":56A:ANLAITRRMFE\n" + + ":32B:USD23456789,\n" + + ":77U:Terms and conditions\n" + + "have been defined\n" + + ":45L:Some details\n" + + "about the underlying tx\n" + + ":24E:MAIL\n" + + ":24G:OTHR\n" + + "Foobar\n" + + "-}"; MT760 subMessage = MT760.parse(fin); // wrap the MT760 ina 798 envelop MT798 mt798 = new MT798(subMessage.getSender(), subMessage.getReceiver()); - mt798 - .append(Field20.tag("1234")) - .append(Field12.tag(subMessage.getMessageType())) - .append(Field77E.emptyTag()); + mt798.append(Field20.tag("1234")) + .append(Field12.tag(subMessage.getMessageType())) + .append(Field77E.emptyTag()); subMessage.getSwiftMessage().getBlock4().getTags().forEach(t -> mt798.append(t)); int count = subMessage.getSwiftMessage().getBlock4().getTags().size(); assertEquals(count + 3, mt798.getSwiftMessage().getBlock4().getTags().size()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/model/mt/mt9xx/MT920Test.java b/src/test/java/com/prowidesoftware/swift/model/mt/mt9xx/MT920Test.java index 3939610fb..53e2162a7 100644 --- a/src/test/java/com/prowidesoftware/swift/model/mt/mt9xx/MT920Test.java +++ b/src/test/java/com/prowidesoftware/swift/model/mt/mt9xx/MT920Test.java @@ -5,32 +5,28 @@ import com.prowidesoftware.swift.model.field.Field12; import com.prowidesoftware.swift.model.field.Field25; import com.prowidesoftware.swift.model.field.Field34F; -import org.junit.jupiter.api.Test; - import java.util.List; +import org.junit.jupiter.api.Test; public class MT920Test { - final String message = "{1:F01AAAACAX0BXXX0502000001}{2:I920BBBBAU21XXXXN}{3:{108:19B12BFE0F043124}{121:f0c54bfc-77a5-4bc6-9a5b-0e50d3975960}}{4:\n" + - ":20:bb131231234\n" + - - ":12:940\n" + - ":25:111111111111\n" + - ":34F:USDD1100,\n" + - ":34F:EURC1200,\n" + - - ":12:941\n" + - ":25:2222222222\n" + - ":34F:USDD2100,\n" + - ":34F:USDC2200,\n" + - - ":12:950\n" + - ":25:3333333333\n" + - ":34F:USDC3100,\n" + - - ":12:942\n" + - ":25:CH9000244444G76402290\n" + - "-}"; + final String message = + "{1:F01AAAACAX0BXXX0502000001}{2:I920BBBBAU21XXXXN}{3:{108:19B12BFE0F043124}{121:f0c54bfc-77a5-4bc6-9a5b-0e50d3975960}}{4:\n" + + ":20:bb131231234\n" + + ":12:940\n" + + ":25:111111111111\n" + + ":34F:USDD1100,\n" + + ":34F:EURC1200,\n" + + ":12:941\n" + + ":25:2222222222\n" + + ":34F:USDD2100,\n" + + ":34F:USDC2200,\n" + + ":12:950\n" + + ":25:3333333333\n" + + ":34F:USDC3100,\n" + + ":12:942\n" + + ":25:CH9000244444G76402290\n" + + "-}"; @Test public void test() { @@ -57,5 +53,4 @@ public void test() { assertEquals("942", loops.get(3).getTagValue(Field12.NAME)); assertEquals("CH9000244444G76402290", loops.get(3).getTagValue(Field25.NAME)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/AckMessageComparatorTest.java b/src/test/java/com/prowidesoftware/swift/utils/AckMessageComparatorTest.java index f544a55ec..53fdf4a53 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/AckMessageComparatorTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/AckMessageComparatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,8 @@ import com.prowidesoftware.swift.io.parser.SwiftParser; import com.prowidesoftware.swift.model.SwiftBlock1; import com.prowidesoftware.swift.model.SwiftMessage; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; /** * Swift message comparator for tests. @@ -89,7 +88,6 @@ public void test1() { b2.setServiceId("99"); b2.setSessionNumber("190"); - AckMessageComparator comp = new AckMessageComparator(); assertTrue(comp.compareB1(b1, b2)); @@ -116,17 +114,15 @@ public void testCompare() throws IOException { @Test public void testCompare2() throws IOException { - String fin1 = "{1:F01AAAADEF0AXXX0023000109}{2:I999BBBBGB20AXXXN}{4:\r\n" + - ":20:1234\r\n" + - ":21:REPORT NAN\r\n" + - ":79:TEST 13 NOV 2020\r\n" + - "-}{5:{CHK:201113000184}{TNG:}}"; - - String fin2 = "{1:F01AAAADEF0BXXX0000000000}{2:I999BBBBGB20XXXXN}{4:\r\n" + - ":20:1234\r\n" + - ":21:REPORT NAN\r\n" + - ":79:TEST 13 NOV 2020\r\n" + - "-}"; + String fin1 = "{1:F01AAAADEF0AXXX0023000109}{2:I999BBBBGB20AXXXN}{4:\r\n" + ":20:1234\r\n" + + ":21:REPORT NAN\r\n" + + ":79:TEST 13 NOV 2020\r\n" + + "-}{5:{CHK:201113000184}{TNG:}}"; + + String fin2 = "{1:F01AAAADEF0BXXX0000000000}{2:I999BBBBGB20XXXXN}{4:\r\n" + ":20:1234\r\n" + + ":21:REPORT NAN\r\n" + + ":79:TEST 13 NOV 2020\r\n" + + "-}"; AckMessageComparator comp = new AckMessageComparator(); SwiftMessage msg1 = SwiftMessage.parse(fin1); @@ -139,17 +135,15 @@ public void testCompare2() throws IOException { @Test public void testCompare3() throws IOException { - String fin1 = "{1:F01AAAADEFXAXXX0023000109}{2:I999BBBBGB22XXXXN}{4:\r\n" + - ":20:1234\r\n" + - ":21:REPORT NAN\r\n" + - ":79:TEST 13 NOV 2020\r\n" + - "-}{5:{CHK:201113000184}{TNG:}}"; - - String fin2 = "{1:F01AAAADEF0AXXX0023000109}{2:I999BBBBGB20XXXXN}{4:\r\n" + - ":20:1234\r\n" + - ":21:REPORT NAN\r\n" + - ":79:TEST 13 NOV 2020\r\n" + - "-}"; + String fin1 = "{1:F01AAAADEFXAXXX0023000109}{2:I999BBBBGB22XXXXN}{4:\r\n" + ":20:1234\r\n" + + ":21:REPORT NAN\r\n" + + ":79:TEST 13 NOV 2020\r\n" + + "-}{5:{CHK:201113000184}{TNG:}}"; + + String fin2 = "{1:F01AAAADEF0AXXX0023000109}{2:I999BBBBGB20XXXXN}{4:\r\n" + ":20:1234\r\n" + + ":21:REPORT NAN\r\n" + + ":79:TEST 13 NOV 2020\r\n" + + "-}"; AckMessageComparator comp = new AckMessageComparator(); SwiftMessage msg1 = SwiftMessage.parse(fin1); @@ -159,5 +153,4 @@ public void testCompare3() throws IOException { comp.setIgnoreLocationFlag(true); assertEquals(0, comp.compare(msg1, msg2)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/IsoUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/IsoUtilsTest.java index 62a997e54..93278070f 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/IsoUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/IsoUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,22 +100,26 @@ public void testCountriesUserAssigned() { @Test public void testAddCountry_1() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry(null)); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry(null)); } @Test public void testAddCountry_2() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("33")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("33")); } @Test public void testAddCountry_3() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("aa")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("aa")); } @Test public void testAddCountry_4() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("AAA")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCountry("AAA")); } @Test @@ -127,22 +131,26 @@ public void testAddCountry_5() { @Test public void testAddCurrency_1() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency(null)); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency(null)); } @Test public void testAddCurrency_2() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("333")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("333")); } @Test public void testAddCurrency_3() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("aaa")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("aaa")); } @Test public void testAddCurrency_4() { - Assertions.assertThrows(IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("AAAA")); + Assertions.assertThrows( + IllegalArgumentException.class, () -> IsoUtils.getInstance().addCurrency("AAAA")); } @Test @@ -151,5 +159,4 @@ public void testAddCurrency_5() { assertTrue(IsoUtils.getInstance().isValidISOCurrency("DSZ")); IsoUtils.getInstance().getCurrencies().remove("DSZ"); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/LineWrapperTest.java b/src/test/java/com/prowidesoftware/swift/utils/LineWrapperTest.java index dd99fa022..180a18d42 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/LineWrapperTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/LineWrapperTest.java @@ -15,15 +15,12 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.function.BiFunction; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; public class LineWrapperTest { @@ -38,7 +35,8 @@ public void testWrapIntoList() { @Test public void testWrapIntoListReadOnly() { - assertThrows(RuntimeException.class, () -> LineWrapper.wrapIntoList("abc", 5).add("def")); + assertThrows( + RuntimeException.class, () -> LineWrapper.wrapIntoList("abc", 5).add("def")); } @Test @@ -59,8 +57,7 @@ public void testWrapEmpty() { @Test public void testWrapSpaces1() { - List actual = LineWrapper.wrapIntoList(" 012 34567890 01", - 3); + List actual = LineWrapper.wrapIntoList(" 012 34567890 01", 3); assertEquals("012", actual.get(0)); assertEquals("345", actual.get(1)); assertEquals("678", actual.get(2)); @@ -70,9 +67,8 @@ public void testWrapSpaces1() { @Test public void testWrapSpaces2() { - List actual = LineWrapper.wrapIntoListStrict(" 012 34567890 01 a ", - 3); - assertEquals(actual.size(),6); + List actual = LineWrapper.wrapIntoListStrict(" 012 34567890 01 a ", 3); + assertEquals(actual.size(), 6); assertEquals("012", actual.get(0)); assertEquals(" 34", actual.get(1)); assertEquals("567", actual.get(2)); @@ -83,13 +79,12 @@ public void testWrapSpaces2() { @Test public void testWrapSpaces3() { - List actual = LineWrapper.wrapIntoListStrict(" 012345678900123456789001 23456789001234567890 0123456789001234567890", - 35); + List actual = LineWrapper.wrapIntoListStrict( + " 012345678900123456789001 23456789001234567890 0123456789001234567890", 35); assertEquals("012345678900123456789001 2345678900", actual.get(0)); assertEquals("1234567890 0123456789001234567890", actual.get(1)); } - @Test void testWrapIntoListStrict() { // given @@ -123,45 +118,41 @@ void testSampleBuilder() { assertEquals(3, lines.size()); } - @Test public void testWrapSpaces4() { - List actual = LineWrapper.wrapIntoList(" 012345678900123456789001 23456789001234567890 0123456789001234567890", - 35); + List actual = + LineWrapper.wrapIntoList(" 012345678900123456789001 23456789001234567890 0123456789001234567890", 35); assertEquals("012345678900123456789001", actual.get(0)); assertEquals("23456789001234567890", actual.get(1)); assertEquals("0123456789001234567890", actual.get(2)); } @ParameterizedTest(name = "[{index}] {4}") - @CsvSource(delimiterString = ";", useHeadersInDisplayName = false, ignoreLeadingAndTrailingWhitespace = false, value = { - "20;'\n';Here is one line of text that is going to be wrapped after 20 columns;" - + "'Here is one line of\ntext that is going\nto be wrapped after\n20 columns';normal 1", - "7;'\n';word1 word2 word3;" - + "'word1 \nword2 \nword3';strip leading spaces on new line, do not strip trailing;", - "20;
    ;Here is one line of text that is going to be wrapped after 20 columns;" - + "'Here is one line of
    text that is going
    to be wrapped after
    20 columns';unusual newline char", - "30;'\n'; Line with leading spaces;" - + "'Line with leading spaces';line with leading spaces", - "6;'\n';Here is one line;" - + "'Here\nis one\nline';short wrap 1", - "2;'\n';Here is one line;" - + "'He\nre\nis\non\ne\nli\nne';short wrap 2", - "20;'\n';' Here: is one line of text that is going to be wrapped after 20 columns';" - + "'Here: is one line\nof text that is \ngoing to be \nwrapped after 20 \ncolumns';with extra spaces", - "20;'\n';'Here is\tone line of text that is going to be wrapped after 20 columns';" - + "'Here is\tone line of\ntext that is going\nto be wrapped after\n20 columns';with tabs", - "20;'\n';'Here is one line of\ttext that is going to be wrapped after 20 columns';" - + "'Here is one line\nof\ttext that is\ngoing to be wrapped\nafter 20 columns';with tab at wrapColumn", - "30;'\n';flammable/inflammable;" - + "flammable/inflammable;no changes", - "9;'\n';flammable/inflammable;" - + "'flammable\n/inflamma\nble';long word break", - "15;'\n'; ;" - + "'';line of spaces", - }) + @CsvSource( + delimiterString = ";", + useHeadersInDisplayName = false, + ignoreLeadingAndTrailingWhitespace = false, + value = { + "20;'\n';Here is one line of text that is going to be wrapped after 20 columns;" + + "'Here is one line of\ntext that is going\nto be wrapped after\n20 columns';normal 1", + "7;'\n';word1 word2 word3;" + + "'word1 \nword2 \nword3';strip leading spaces on new line, do not strip trailing;", + "20;
    ;Here is one line of text that is going to be wrapped after 20 columns;" + + "'Here is one line of
    text that is going
    to be wrapped after
    20 columns';unusual newline char", + "30;'\n'; Line with leading spaces;" + "'Line with leading spaces';line with leading spaces", + "6;'\n';Here is one line;" + "'Here\nis one\nline';short wrap 1", + "2;'\n';Here is one line;" + "'He\nre\nis\non\ne\nli\nne';short wrap 2", + "20;'\n';' Here: is one line of text that is going to be wrapped after 20 columns';" + + "'Here: is one line\nof text that is \ngoing to be \nwrapped after 20 \ncolumns';with extra spaces", + "20;'\n';'Here is\tone line of text that is going to be wrapped after 20 columns';" + + "'Here is\tone line of\ntext that is going\nto be wrapped after\n20 columns';with tabs", + "20;'\n';'Here is one line of\ttext that is going to be wrapped after 20 columns';" + + "'Here is one line\nof\ttext that is\ngoing to be wrapped\nafter 20 columns';with tab at wrapColumn", + "30;'\n';flammable/inflammable;" + "flammable/inflammable;no changes", + "9;'\n';flammable/inflammable;" + "'flammable\n/inflamma\nble';long word break", + "15;'\n'; ;" + "'';line of spaces", + }) public void testWrap(int wrapLen, String newLineStr, String input, String expected, String message) { assertEquals(expected, LineWrapper.wrap(input, wrapLen, newLineStr), message); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/MurMessageComparatorTest.java b/src/test/java/com/prowidesoftware/swift/utils/MurMessageComparatorTest.java index bcb831516..066190406 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/MurMessageComparatorTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/MurMessageComparatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.prowidesoftware.swift.model.SwiftMessage; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; /** * @sinec 8.0.3 @@ -30,27 +29,28 @@ public class MurMessageComparatorTest { @Test public void test() throws IOException { - SwiftMessage systemMessage = SwiftMessage.parse("1:F01AAAAFRPPZXXX0000000006}{2:O0111702040914BBBBXXXXCXXX00000000001702040914S}{4:{175:0914}{106:170204BNPAFRPPZXXX0000000007}{108:MYREFERENCE12345}{175:0914}{107:170204MGTCBEBBXXXX0000000007}}{5:{CHK:ABCDEF123456}{SYS:}}"); + SwiftMessage systemMessage = SwiftMessage.parse( + "1:F01AAAAFRPPZXXX0000000006}{2:O0111702040914BBBBXXXXCXXX00000000001702040914S}{4:{175:0914}{106:170204BNPAFRPPZXXX0000000007}{108:MYREFERENCE12345}{175:0914}{107:170204MGTCBEBBXXXX0000000007}}{5:{CHK:ABCDEF123456}{SYS:}}"); // no MUR - SwiftMessage mt1 = SwiftMessage.parse("{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{4:\n" + - ":20:14045DOYVLVSCT29\n" + - "-}"); + SwiftMessage mt1 = SwiftMessage.parse( + "{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{4:\n" + ":20:14045DOYVLVSCT29\n" + "-}"); // no MUR - SwiftMessage mt2 = SwiftMessage.parse("{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{119:STP}}{4:\n" + - ":20:14045DOYVLVSCT29\n" + - "-}"); + SwiftMessage mt2 = SwiftMessage.parse("{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{119:STP}}{4:\n" + + ":20:14045DOYVLVSCT29\n" + "-}"); // different MUR - SwiftMessage mt3 = SwiftMessage.parse("{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{108:YSYU39045360FXXX}{119:STP}}{4:\n" + - ":20:14045DOYVLVSCT29\n" + - "-}"); + SwiftMessage mt3 = SwiftMessage.parse( + "{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{108:YSYU39045360FXXX}{119:STP}}{4:\n" + + ":20:14045DOYVLVSCT29\n" + + "-}"); // equal MUR - SwiftMessage mt4 = SwiftMessage.parse("{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{108:MYREFERENCE12345}{119:STP}}{4:\n" + - ":20:14045DOYVLVSCT29\n" + - "-}"); + SwiftMessage mt4 = SwiftMessage.parse( + "{1:F01GEBABEBBC36A7951305337}{2:I103YORKGB22XXXXN}{3:{108:MYREFERENCE12345}{119:STP}}{4:\n" + + ":20:14045DOYVLVSCT29\n" + + "-}"); MurMessageComparator comp = new MurMessageComparator(); assertFalse(0 == comp.compare(systemMessage, mt1)); @@ -58,5 +58,4 @@ public void test() throws IOException { assertFalse(0 == comp.compare(systemMessage, mt3)); assertTrue(0 == comp.compare(systemMessage, mt4)); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/ResolverUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/ResolverUtilsTest.java index dda8d155f..c63169364 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/ResolverUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/ResolverUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.List; +import org.junit.jupiter.api.Test; class ResolverUtilsTest { @@ -45,5 +44,4 @@ public void testResolveCurrency() { assertEquals(1, o.size()); assertEquals("c2", o.get(0)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java index 892e21720..3b3f1a2cc 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,10 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - import java.math.BigDecimal; import java.time.Year; import java.util.Calendar; +import org.junit.jupiter.api.Test; /** * Test for SwiftFormatUtils. @@ -37,27 +36,41 @@ public void testGetNumber() { assertEquals(123, SwiftFormatUtils.getNumber("123").intValue()); assertNotNull(SwiftFormatUtils.getNumber("123,")); - assertEquals(new BigDecimal("123.0"), BigDecimal.valueOf(SwiftFormatUtils.getNumber("123,").doubleValue())); + assertEquals( + new BigDecimal("123.0"), + BigDecimal.valueOf(SwiftFormatUtils.getNumber("123,").doubleValue())); - //this test does not work but this format is not used + // this test does not work but this format is not used assertNotNull(SwiftFormatUtils.getNumber("1,2")); - assertEquals(Double.valueOf(1.2), Double.valueOf(SwiftFormatUtils.getNumber("1,2").doubleValue())); + assertEquals( + Double.valueOf(1.2), + Double.valueOf(SwiftFormatUtils.getNumber("1,2").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,34")); - assertEquals(Double.valueOf(12.34), Double.valueOf(SwiftFormatUtils.getNumber("12,34").doubleValue())); + assertEquals( + Double.valueOf(12.34), + Double.valueOf(SwiftFormatUtils.getNumber("12,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,3456")); - assertEquals(Double.valueOf(12.3456), Double.valueOf(SwiftFormatUtils.getNumber("12,3456").doubleValue())); + assertEquals( + Double.valueOf(12.3456), + Double.valueOf(SwiftFormatUtils.getNumber("12,3456").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("0,")); - assertEquals(Double.valueOf(0), Double.valueOf(SwiftFormatUtils.getNumber("0,").doubleValue())); + assertEquals( + Double.valueOf(0), + Double.valueOf(SwiftFormatUtils.getNumber("0,").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("299000,34")); - assertEquals(Double.valueOf(299000.34), Double.valueOf(SwiftFormatUtils.getNumber("299000,34").doubleValue())); + assertEquals( + Double.valueOf(299000.34), + Double.valueOf(SwiftFormatUtils.getNumber("299000,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber(",34")); - assertEquals(Double.valueOf(0.34), Double.valueOf(SwiftFormatUtils.getNumber(",34").doubleValue())); + assertEquals( + Double.valueOf(0.34), + Double.valueOf(SwiftFormatUtils.getNumber(",34").doubleValue())); } @Test @@ -173,5 +186,4 @@ public void testDecimalsInAmountBigDecimal() { assertEquals(6, SwiftFormatUtils.decimalsInAmount(new BigDecimal("1.000123"))); assertEquals(8, SwiftFormatUtils.decimalsInAmount(new BigDecimal("1.00012300"))); } - } diff --git a/src/test/java/com/prowidesoftware/swift/utils/SwiftMessageComparatorTest.java b/src/test/java/com/prowidesoftware/swift/utils/SwiftMessageComparatorTest.java index 8c68f7d5d..4d1873698 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/SwiftMessageComparatorTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/SwiftMessageComparatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,8 @@ import com.prowidesoftware.swift.model.SwiftBlock2Input; import com.prowidesoftware.swift.model.SwiftBlock2Output; import com.prowidesoftware.swift.model.SwiftMessage; -import org.junit.jupiter.api.Test; - import java.io.IOException; +import org.junit.jupiter.api.Test; /** * Swift message comparator for tests. @@ -273,21 +272,24 @@ public void testFullMessage() throws IOException { public void testB3() throws IOException { SwiftMessageComparator comp = new SwiftMessageComparator(); - SwiftMessage msg1 = SwiftMessage.parse("{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{108:FDF0510141142100}{121:8579f4a4-a547-463e-ae63-e7c6620d59b4}}{4:\n" + - ":20:FDF0510141142100\n" + - ":72:/ACC/ 00940060752415000231\n" + - "-}"); + SwiftMessage msg1 = SwiftMessage.parse( + "{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{108:FDF0510141142100}{121:8579f4a4-a547-463e-ae63-e7c6620d59b4}}{4:\n" + + ":20:FDF0510141142100\n" + + ":72:/ACC/ 00940060752415000231\n" + + "-}"); assertTrue(comp.compare(msg1, msg1) == 0); - SwiftMessage msg2 = SwiftMessage.parse("{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{108:FDF0510141142100}}{4:\n" + - ":20:FDF0510141142100\n" + - ":72:/ACC/ 00940060752415000231\n" + - "-}"); - - SwiftMessage msg3 = SwiftMessage.parse("{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{121:8579f4a4-a547-463e-ae63-e7c6620d59b4}}{4:\n" + - ":20:FDF0510141142100\n" + - ":72:/ACC/ 00940060752415000231\n" + - "-}"); + SwiftMessage msg2 = SwiftMessage.parse( + "{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{108:FDF0510141142100}}{4:\n" + + ":20:FDF0510141142100\n" + + ":72:/ACC/ 00940060752415000231\n" + + "-}"); + + SwiftMessage msg3 = SwiftMessage.parse( + "{1:F01BICFOOYYAXXX8667486276}{2:O1031610051014IRVTUS3NBXXX63382244920510142210N}{3:{121:8579f4a4-a547-463e-ae63-e7c6620d59b4}}{4:\n" + + ":20:FDF0510141142100\n" + + ":72:/ACC/ 00940060752415000231\n" + + "-}"); assertTrue(comp.compare(msg2, msg3) != 0); diff --git a/src/test/java/com/prowidesoftware/swift/utils/TestUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/TestUtilsTest.java index ab66abc5e..e17451ff3 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/TestUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/TestUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 Prowide + * Copyright 2006-2023 Prowide * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,5 +30,4 @@ public void testPatchXpath() { assertEquals("/*[local-name()='Foo']/*[local-name()='Bar']", TestUtils.patch("/Foo/Bar")); assertEquals("/*[local-name()='Foo']/*[local-name()='Bar'][4]", TestUtils.patch("/Foo/Bar[4]")); } - } From e222be1f5f7c24f61e4928148bf87fd57e16370b Mon Sep 17 00:00:00 2001 From: zubri Date: Fri, 4 Aug 2023 19:03:17 -0300 Subject: [PATCH 08/16] release --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e4bc99a90..731b6d91a 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ scmVersion { } } //project.version = "${SRU}-${scmVersion.version}" -project.version = "${SRU}-10.1.1" +project.version = "${SRU}-10.1.2" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' From ce7b218b16265979fa4c54df115c8d8528a6e360 Mon Sep 17 00:00:00 2001 From: zubri Date: Wed, 23 Aug 2023 15:16:19 -0300 Subject: [PATCH 09/16] release --- CHANGELOG.md | 2 +- build.gradle | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0219b8e9b..94dcb622a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Prowide Core - CHANGELOG -#### 10.1.3 - SNAPSHOT +#### 10.1.3 - August 2023 * (PW-1478) Field 44J format fixed to allow multiline #### 10.1.2 - August 2023 diff --git a/build.gradle b/build.gradle index 731b6d91a..037833ddb 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,7 @@ scmVersion { versionSeparator.set('-') } } -//project.version = "${SRU}-${scmVersion.version}" -project.version = "${SRU}-10.1.2" +project.version = "${SRU}-${scmVersion.version}" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' From ca77829348e104c2e2342753391097362041f24a Mon Sep 17 00:00:00 2001 From: zubri Date: Thu, 21 Sep 2023 14:27:55 -0300 Subject: [PATCH 10/16] release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a21fd4e87..b1f0821e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Prowide Core - CHANGELOG -#### 10.1.5 - SNAPSHOT +#### 10.1.5 - September 2023 * Added support for an optional `pw-swift-core.properties` to customize the behavior of the SafeXmlUtils class #### 10.1.4 - September 2023 From 1bafbf4cfda045aa4b9be8093d4fde41a4ba1b82 Mon Sep 17 00:00:00 2001 From: zubri Date: Thu, 26 Oct 2023 10:50:43 -0300 Subject: [PATCH 11/16] Remove deprecation annotation for fields relocated to the Prowide Integrator SCORE library to avoid misleading compiler warnings --- .../java/com/prowidesoftware/swift/model/field/Field11T.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field12H.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field12K.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field12L.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field12R.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field12S.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field13E.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field20E.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field21S.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field21T.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field25F.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field25G.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field27A.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field29D.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field29F.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field29P.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field29S.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field29U.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field31J.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field31K.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field31M.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field31T.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34D.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34K.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34L.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34M.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34S.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34T.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34U.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34V.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34W.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field34X.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field47E.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49D.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49F.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49J.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49K.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49L.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field49Z.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field71E.java | 1 - .../java/com/prowidesoftware/swift/model/field/Field78B.java | 1 - 41 files changed, 41 deletions(-) diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java index 0b94e7f36..5155a850e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field11T.java @@ -57,7 +57,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field11T extends Field implements Serializable, DateContainer, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java index 2da396dc8..b87026a83 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12H.java @@ -52,7 +52,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12H extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java index fb5fc9c17..bb40f2ad8 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12K.java @@ -54,7 +54,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12K extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java index 7027583f5..8884829d3 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12L.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12L extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java index f851a7b77..2d0298f06 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12R.java @@ -52,7 +52,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12R extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java index e9ef0f250..f5afd7b08 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field12S.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field12S extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java index 8ce89687c..771471512 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field13E.java @@ -54,7 +54,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field13E extends Field implements Serializable, DateContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java index d91c5aedb..7f6b6cb94 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field20E.java @@ -52,7 +52,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field20E extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java index 5de8be49c..43ef8c282 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field21S.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field21S extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java index 492a3c7da..7e641f05b 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field21T.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field21T extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java index 7ee212674..83fcc935e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field25F.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field25F extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java b/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java index 7c061ea34..a66b783fb 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field25G.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field25G extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java b/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java index c33c4501a..f744282b9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field27A.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field27A extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java index f6a21b0e1..69cb1528c 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29D.java @@ -54,7 +54,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29D extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java index 548b7e22d..e5e2c5b65 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29F.java @@ -54,7 +54,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29F extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java index 479d3b69e..f5754bc69 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29P.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29P extends Field implements Serializable, BICContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java index 039dcb75f..247bf3b06 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29S.java @@ -52,7 +52,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29S extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java b/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java index ed78071db..2fabcbbcc 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field29U.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field29U extends Field implements Serializable, BICContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java index 641cc6e05..e952be8e0 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31J.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31J extends Field implements Serializable, DateContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java index 64a5dd77a..11a7367f6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31K.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31K extends Field implements Serializable, DateContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java index 7c90e054a..477282174 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31M.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31M extends Field implements Serializable, DateContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java index d5d710e58..ae384e386 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field31T.java @@ -53,7 +53,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field31T extends Field implements Serializable, DateContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java index acb7adec6..5902b87c4 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34D.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34D extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java index 798cb388e..544eaf581 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34K.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34K extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java index e02b5da51..061d2935f 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34L.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34L extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java index 0793f2baa..4b5efe3b9 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34M.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34M extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java index 9020e55f9..6d85ea171 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34S.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34S extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java index f34b2e415..a1f6fe843 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34T.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34T extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java index 463b8f990..c19c50bc2 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34U.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34U extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java index df2c7742d..56978b316 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34V.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34V extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java index a5a74d773..ce34858ab 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34W.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34W extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java b/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java index 947ae289a..f26d1fda5 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field34X.java @@ -55,7 +55,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field34X extends Field implements Serializable, AmountContainer { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java index 9f2b5b17c..20fe2d1dd 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field47E.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field47E extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java index 14d686d54..295fda0ae 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49D.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49D extends Field implements Serializable { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java index b12d1df6a..de99a0006 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49F.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49F extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java index 4d9df2f09..863cf102e 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49J.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49J extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java index 0f3fd59bb..ef5c5ab4a 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49K.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49K extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java index 9c4cf8e70..5aa056ee6 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49L.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49L extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java b/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java index c09af2768..a78235458 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field49Z.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field49Z extends Field implements Serializable, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java b/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java index 4999d1fc9..5b14daf27 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field71E.java @@ -48,7 +48,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field71E extends StructuredNarrativeField implements Serializable, NarrativeContainer, MultiLineField { /** diff --git a/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java b/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java index 0e24f8afe..6643fa320 100644 --- a/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java +++ b/src/main/java/com/prowidesoftware/swift/model/field/Field78B.java @@ -51,7 +51,6 @@ * * @deprecated This field has been moved to the Prowide Integrator since it is only used in SCORE messages, not in the general MT standard */ -@Deprecated @ProwideDeprecated(phase3 = TargetYear.SRU2024) public class Field78B extends Field implements Serializable, MultiLineField { /** From b7cba31273bb0d68a9c7912f4f6c8451688f9ce2 Mon Sep 17 00:00:00 2001 From: zubri Date: Thu, 14 Dec 2023 14:46:17 -0300 Subject: [PATCH 12/16] Update gradle to 8.5 and update all plugins rto latest versions --- build.gradle | 32 +++++++++++++++-------- gradle/wrapper/gradle-wrapper.jar | Bin 60756 -> 61574 bytes gradle/wrapper/gradle-wrapper.properties | 3 ++- gradlew | 12 ++++++--- gradlew.bat | 1 + 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 037833ddb..6a5d02d15 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ buildscript { gradlePluginPortal() } dependencies { - classpath 'ru.vyarus:gradle-quality-plugin:4.7.0' - classpath 'pl.allegro.tech.build:axion-release-plugin:1.14.2' - classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.20.0' + classpath 'ru.vyarus:gradle-quality-plugin:4.9.0' + classpath 'pl.allegro.tech.build:axion-release-plugin:1.15.1' + classpath 'io.github.gradle-nexus:publish-plugin:1.3.0' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.23.3' } } apply plugin: 'pl.allegro.tech.build.axion-release' @@ -69,7 +69,11 @@ dependencies { testImplementation group: 'org.xmlunit', name: 'xmlunit-assertj', version: '2.9.0' } -sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java'] +sourceSets.named('main') { + java { + setSrcDirs(['src/main/java', 'src/generated/java']) + } +} test { useJUnitPlatform() @@ -84,8 +88,8 @@ tasks.withType(Jar) { 'Implementation-Version': project.version, 'Implementation-Vendor': 'www.prowidesoftware.com', 'Built-OS': System.getProperty('os.name'), - 'Source-Compatibility': project.sourceCompatibility, - 'Target-Compatibility': project.targetCompatibility, + 'Source-Compatibility': JavaVersion.VERSION_11, + 'Target-Compatibility': JavaVersion.VERSION_11, 'Built-Date': new Date().format("yyyy-MM-dd"), 'Automatic-Module-Name': 'com.prowidesoftware.core' ) @@ -260,7 +264,7 @@ tasks.register('bundle', Jar) { from ("$buildDir/libs") { include '*.asc' } - archiveName 'bundle.jar' + archiveFileName.set('bundle.jar') } tasks.withType(Test) { @@ -283,9 +287,15 @@ task('testOn17', type: Test) { jacocoTestReport { reports { - xml.enabled true - csv.enabled false - html.enabled false + xml { + required.set(true) + } + csv { + required.set(false) + } + html { + required.set(false) + } } // exclude generated code diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f090a2944b7473328c07c9755baa3196..943f0cbfa754578e88a3dae77fce6e3dea56edbf 100644 GIT binary patch delta 36524 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%0DGK?7GHTj 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 VwlMN}`%er%aGR6olj~j${vQ;P=LY}) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 774fae876..3499ded5c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6c..65dcd68d6 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index f127cfd49..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% From 4aa5bdafac3c3fbbcfcde0db1ee87275a7c279bd Mon Sep 17 00:00:00 2001 From: Sebastian Zubrinic Date: Thu, 23 May 2024 18:41:24 -0300 Subject: [PATCH 13/16] Update CHANGELOG.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d27427be2..209ce4c05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ #### 10.1.12 - November 2023 * (PW-1697) Fixed validation/parse pattern in field 29O * (PW-1697) MT306 changes in field 30I - * Added DistinguishedName with Builder in order to encapsulate the BIC branch name logic + * Added DistinguishedName with Builder to encapsulate the BIC branch name logic #### 10.1.11 - November 2023 * (PW-1697) Fixed validation pattern in fields 14[H,K,L,M,N,O] and 29J From e85e9c7678a18e0903c17361e03d50bd97968bb2 Mon Sep 17 00:00:00 2001 From: zubri Date: Fri, 28 Jun 2024 20:44:17 -0300 Subject: [PATCH 14/16] update publishing plugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6a5d02d15..877831f0c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { dependencies { classpath 'ru.vyarus:gradle-quality-plugin:4.9.0' classpath 'pl.allegro.tech.build:axion-release-plugin:1.15.1' - classpath 'io.github.gradle-nexus:publish-plugin:1.3.0' + classpath 'io.github.gradle-nexus:publish-plugin:2.0.0' classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.23.3' } } From db7d108f6ca6bd259e714b809b23210b9f64cfe3 Mon Sep 17 00:00:00 2001 From: zubri Date: Mon, 30 Sep 2024 19:36:16 -0300 Subject: [PATCH 15/16] compile fix (javax -> jakarta) --- .../prowidesoftware/swift/constraints/IbanValidatorTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java b/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java index 861e51b31..76479631d 100644 --- a/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java +++ b/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java @@ -4,8 +4,8 @@ import com.prowidesoftware.swift.model.IBAN; import com.prowidesoftware.swift.model.IbanValidationResult; -import javax.validation.ClockProvider; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ClockProvider; +import jakarta.validation.ConstraintValidatorContext; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; From 9bd19c9463f9b274afc42e4e878331599f947a4a Mon Sep 17 00:00:00 2001 From: zubri Date: Thu, 10 Oct 2024 13:35:44 -0300 Subject: [PATCH 16/16] release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b34d300d..f2366a5ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Prowide Core - CHANGELOG -#### 10.1.17 - SNAPSHOT +#### 10.1.17 - October 2024 * Added new `FieldEnum` with all the available field names * Code security improvements as per CodeQL recommendations