An example of how to reads a CSV file, validate the input data, and output the data to standard output. It performs validation on fields like id, name, birthday, gender, and phone number based on specific rules. The validated data is output along with error messages for invalid data. The header of the CSV file is excluded from validation.
There are only two classes in this project.
Main.java - The main class that contains the logic for reading the CSV file.
Validation.java - The class that provides validation logic for the fields in a CSV file.
Unit Test: ValidationTest.java
SAMPLE FILE INPUT: writers.csv
id,name,birthday,gender,phone-number
1,Liam,02/1994/29,male,09011112222
2,Austin,1994/10/10,female,08033334444
3,,1989/01/23,female,0355556666
CONSOLE OUTPUT:
id,name,birthday,gender,phone-number
1,Liam,Error format,male,09011112222
2,Austin,1994/10/10,female,08033334444
3,Error required,1989/01/23,female,0355556666
VALIDATION DETAILS:
