use of net.bzzt.swift.mt940.parser.Mt940Parser in project jgnash by ccavanaugh.
the class Mt940Test method testMt940Rabobank.
/**
* Test parsing an (anonimized) mt940 file as produced by the Rabobank
* online bank
*
* @throws ParseException thrown if a parse exception occurs while reading the file
* @throws IOException thrown if an IO exception occurs while reading the file
*/
@Test
public void testMt940Rabobank() throws IOException, ParseException {
int nTransactions = 6;
Mt940Parser parser = new Mt940Parser();
InputStream inputStream = this.getClass().getResourceAsStream("/rabobank.swi");
try (LineNumberReader reader = new LineNumberReader(new InputStreamReader(inputStream))) {
Mt940File file = parser.parse(reader);
assertEquals(nTransactions, file.getEntries().size());
ImportBank<ImportTransaction> bank = Mt940Exporter.convert(file);
assertEquals(nTransactions, bank.getTransactions().size());
}
}
use of net.bzzt.swift.mt940.parser.Mt940Parser in project jgnash by ccavanaugh.
the class Mt940Test method testMt940.
/**
* Rudimentary test for mt940 importing: creates a parser, parses a given
* mt940 file and checks that indeed, 18 transactions have been generated.
*
* Then, converts the parsed file to an ImportBank and verifies that there's
* still 18 transactions.
*
* @throws Exception
* throws assert exception
*/
@Test
public void testMt940() throws Exception {
int nTransactions = 18;
Mt940Parser parser = new Mt940Parser();
InputStream inputStream = this.getClass().getResourceAsStream("/bank1.STA");
try (LineNumberReader reader = new LineNumberReader(new InputStreamReader(inputStream))) {
Mt940File file = parser.parse(reader);
assertEquals(nTransactions, file.getEntries().size());
ImportBank<ImportTransaction> bank = Mt940Exporter.convert(file);
assertEquals(nTransactions, bank.getTransactions().size());
}
}
Aggregations