Mx2MessageTest.java 1.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
package com.brilliance;

import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.exception.SwiftException;
import org.junit.Test;

import java.io.File;
import java.nio.file.Files;

public class Mx2MessageTest {
    public void test(String source, String localCode) {
        try {
            File file = new File(Mx2MessageTest.class.getResource("/swiftXml/" + source).toURI().getPath());
            String xml = new String(Files.readAllBytes(file.toPath()));
            System.out.println(SwiftTransfer.mx2Message(xml, localCode));
        } catch (Exception e) {
            throw new SwiftException("Test", e);
        }
    }

    @Test
    public void testCamt029001() {
        test("MxCamt02900109_196.xml", "US");
    }

    @Test
    public void testCamt054001() {test("camt05400108_900.xml", "CN");}

    @Test
    public void testCamt056001() {
        test("MxCamt05600108_192.xml", "CN");
    }

    @Test
    public void testCamt057001() {
        test("MxCamt05700106.xml", "CN");
    }

    @Test
    public void testCamt060001() {
        test("MxCamt06000105.xml", "CN");
    }

    @Test
    public void testPacs008001() {
        test("MxPacs00800108.xml", "CN");
    }

    @Test
    public void testCamt052001() {
        test("MXcamt05200108.xml", "CN");
    }

    @Test
    public void testCamt053001() {
        test("MxCamt05300108_940.xml", "CN");
    }

    @Test
    public void testPacs002001() {
        test("MxPacs00200110_199.xml", "CN");
    }

    @Test
65
    public void testPacs009001() {test("Pacs00900108.xml", "US");}
66 67 68 69 70 71

    @Test
    public void testPacs004001() {
        test("MxPacs00900108_COV.xml", "CN");
    }
}