jeudi 4 juin 2015

Test flat file content and format in Java

I have to send a flat file to an external system. A sample file content is given below:

START 20150602
HEADER 100.00USD
PRODUCT TEST1                    50.00USD
PRODUCT TEST2                    50.00USD
FOOTER 002

This file should follow the below guidelines:

First line - starts with START, then space, then today's date in YYYYMMDD
Header line - starts with HEADER, then space, then total amount of first, second, third etc products with 2 decimal points, then currency
First product - starts with PRODUCT, then space, then product name left aligned with total 25 characters, then amount with 2 decimal points, then currency
More products similar to first product, the number of products is dynamic
Footer - starts with FOOTER, then space, then total number of products with 3 digits

This format has been given by the external system vendor in excel.

Can anyone of you suggest a better testing strategy in these case? is there any tools to test the file content and format?

Aucun commentaire:

Enregistrer un commentaire