Skip to content

Commit

Permalink
GH-39 test case WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
zubri committed Jan 13, 2022
1 parent 1c93ab4 commit 8f820c1
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
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);
}

}

0 comments on commit 8f820c1

Please sign in to comment.