2828import static io .frictionlessdata .tableschema .TestHelper .getTestDataDirectory ;
2929
3030class TableBeanIteratorTest {
31- private static Schema employeeSchema = null ;
32- private static Schema employeeSchemaAlternateDateForma = null ;
3331 private static Schema gdpSchema = null ;
3432 private static Table employeeTable = null ;
3533 private static Table employeeTableAlternateDateFormat = null ;
@@ -39,35 +37,17 @@ class TableBeanIteratorTest {
3937 @ BeforeEach
4038 void setUp () throws Exception {
4139 testDataDir = getTestDataDirectory ();
42- File f = new File (getTestDataDirectory (), "schema/population_schema.json" );
43- Schema validPopulationSchema = null ;
44- try (FileInputStream fis = new FileInputStream (f )) {
45- validPopulationSchema = Schema .fromJson (fis , false );
46- }
47-
48-
49- File file = new File ("data/employee_data.csv" );
50- employeeSchema = BeanSchema .infer (EmployeeBean .class );
51- employeeTable = Table .fromSource (file , testDataDir , employeeSchema , TableDataSource .getDefaultCsvFormat ());
52-
53- file = new File ("data/employee_alternate_date_format.csv" );
54- employeeSchemaAlternateDateForma = BeanSchema .infer (EmployeeBeanWithAnnotation .class );
55- employeeTableAlternateDateFormat = Table .fromSource (
56- file ,
57- testDataDir ,
58- employeeSchemaAlternateDateForma ,
59- TableDataSource .getDefaultCsvFormat ());
60-
61- file = new File ("data/gdp.csv" );
62- gdpSchema = BeanSchema .infer (GrossDomesticProductBean .class );
63- gdpTable = Table .fromSource (file , testDataDir , gdpSchema , TableDataSource .getDefaultCsvFormat ());
6440
6541 }
6642
6743
6844 @ Test
6945 @ DisplayName ("Test deserialization of EmployeeBean" )
7046 void testBeanDeserialization () throws Exception {
47+
48+ File file = new File ("data/employee_data.csv" );
49+ employeeTable = Table .fromSource (file , testDataDir , null , TableDataSource .getDefaultCsvFormat ());
50+
7151 List <EmployeeBean > employees = new ArrayList <>();
7252 BeanIterator <EmployeeBean > bit = new BeanIterator <>(employeeTable , EmployeeBean .class , false );
7353 while (bit .hasNext ()) {
@@ -91,11 +71,10 @@ void testBeanDeserialization() throws Exception {
9171 @ DisplayName ("Test deserialization of EmployeeBean with Annotation" )
9272 void testBeanDeserialization2 () throws Exception {
9373 File inFile = new File ("data/employee_full.csv" );
94- employeeSchemaAlternateDateForma = BeanSchema .infer (EmployeeBeanWithAnnotation .class );
95- employeeTableAlternateDateFormat = Table .fromSource (
74+ Table employeeTableAlternateDateFormat = Table .fromSource (
9675 inFile ,
9776 testDataDir ,
98- employeeSchemaAlternateDateForma ,
77+ null ,
9978 TableDataSource .getDefaultCsvFormat ());
10079 List <EmployeeBeanWithAnnotation > employees = new ArrayList <>();
10180 BeanIterator <EmployeeBeanWithAnnotation > bit = new BeanIterator <>(employeeTableAlternateDateFormat , EmployeeBeanWithAnnotation .class , false );
@@ -119,11 +98,14 @@ void testBeanDeserialization2() throws Exception {
11998 /*Assertions.assertEquals(45, info.get("pin"));
12099 Assertions.assertEquals(83.23, info.get("rate"));
121100 Assertions.assertEquals(90, info.get("ssn"));*/
101+ System .out .println (info );
122102 }
123103
124104 @ Test
125105 @ DisplayName ("Test deserialization of big floats (GrossDomesticProductBean)" )
126106 void testBeanDeserialization3 () throws Exception {
107+ File file = new File ("data/gdp.csv" );
108+ gdpTable = Table .fromSource (file , testDataDir , null , TableDataSource .getDefaultCsvFormat ());
127109 List <GrossDomesticProductBean > records = new ArrayList <>();
128110 BeanIterator <GrossDomesticProductBean > bit
129111 = new BeanIterator <>(gdpTable , GrossDomesticProductBean .class , false );
0 commit comments