Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-39 test case (WIP) #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ project(':iso20022-core') {
testImplementation group: 'org.xmlunit', name: 'xmlunit-assertj', version: '2.8.3'
testImplementation project(':model-acmt-mx')
testImplementation project(':model-acmt-types')
testImplementation project(':model-admi-mx')
testImplementation project(':model-admi-types')
testImplementation project(':model-camt-mx')
testImplementation project(':model-camt-types')
testImplementation project(':model-catm-mx')
Expand Down
109 changes: 109 additions & 0 deletions iso20022-core/src/test/java/com/prowidesoftware/issues/Issue39.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package com.prowidesoftware.issues;

import com.prowidesoftware.swift.model.mx.MxAdmi00700101;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* https://github.com/prowide/prowide-iso20022/issues/39
*/
public class Issue39 {

private String xmlWithSplmtryData = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
"<Body>\n" +
" <AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.01\">\n" +
" <Fr>\n" +
" <FIId>\n" +
" <FinInstnId>\n" +
" <BICFI>XXXXXXXXXXX</BICFI>\n" +
" </FinInstnId>\n" +
" </FIId>\n" +
" </Fr>\n" +
" <To>\n" +
" <FIId>\n" +
" <FinInstnId>\n" +
" <BICFI>XXXXXXXXXXX</BICFI>\n" +
" </FinInstnId>\n" +
" </FIId>\n" +
" </To>\n" +
" <BizMsgIdr>XXXXXXX</BizMsgIdr>\n" +
" <MsgDefIdr>admi.007.001.01</MsgDefIdr>\n" +
" <CreDt>2022-01-11T15:02:09Z</CreDt>\n" +
" </AppHdr>\n" +
" <Document xmlns=\"urn:iso:std:iso:20022:tech:xsd:admi.007.001.01\">\n" +
" <RctAck>\n" +
" <MsgId>\n" +
" <MsgId>XXXXXXX</MsgId>\n" +
" </MsgId>\n" +
" <Rpt>\n" +
" <RltdRef>\n" +
" <Ref>XXXXXX</Ref>\n" +
" </RltdRef>\n" +
" <ReqHdlg>\n" +
" <StsCd>ACKT</StsCd>\n" +
" <Desc>CR50</Desc>\n" +
" </ReqHdlg>\n" +
" </Rpt>\n" +
" <SplmtryData>\n" +
" <Envlp>\n" +
// this is Any (lax)
" <FromBOData>TOTO</FromBOData>\n" +
" </Envlp>\n" +
" </SplmtryData>\n" +
" </RctAck>\n" +
" </Document>\n" +
"</Body>";

private String xmlWithoutSplmtryData = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
"<Body>\n" +
" <AppHdr xmlns=\"urn:iso:std:iso:20022:tech:xsd:head.001.001.01\">\n" +
" <Fr>\n" +
" <FIId>\n" +
" <FinInstnId>\n" +
" <BICFI>XXXXXXXXXXX</BICFI>\n" +
" </FinInstnId>\n" +
" </FIId>\n" +
" </Fr>\n" +
" <To>\n" +
" <FIId>\n" +
" <FinInstnId>\n" +
" <BICFI>XXXXXXXXXXX</BICFI>\n" +
" </FinInstnId>\n" +
" </FIId>\n" +
" </To>\n" +
" <BizMsgIdr>XXXXXXX</BizMsgIdr>\n" +
" <MsgDefIdr>admi.007.001.01</MsgDefIdr>\n" +
" <CreDt>2022-01-11T15:02:09Z</CreDt>\n" +
" </AppHdr>\n" +
" <Document xmlns=\"urn:iso:std:iso:20022:tech:xsd:admi.007.001.01\">\n" +
" <RctAck>\n" +
" <MsgId>\n" +
" <MsgId>XXXXXXX</MsgId>\n" +
" </MsgId>\n" +
" <Rpt>\n" +
" <RltdRef>\n" +
" <Ref>XXXXXX</Ref>\n" +
" </RltdRef>\n" +
" <ReqHdlg>\n" +
" <StsCd>ACKT</StsCd>\n" +
" <Desc>CR50</Desc>\n" +
" </ReqHdlg>\n" +
" </Rpt>\n" +
" </RctAck>\n" +
" </Document>\n" +
"</Body>";

@Test
public void testParseWithSplmtryData() {
MxAdmi00700101 mx = MxAdmi00700101.parse(xmlWithSplmtryData);
assertNotNull(mx);
}

@Test
public void testParseWithoutSplmtryData() {
MxAdmi00700101 mx = MxAdmi00700101.parse(xmlWithoutSplmtryData);
assertNotNull(mx);
}

}