// Path: src/main/java/br/com/tecsinapse/dataio/importer/Parser.java
// public interface Parser<T> extends Closeable {
// 
//     List<T> parse() throws Exception;
// 
//     void setExporterFormatter(ExporterFormatter exporterFormatter);
// 
//     ExporterFormatter getExporterFormatter();
// 
//     void setHeadersRows(int headersRows);
// 
//     boolean isIgnoreBlankLinesAtEnd();
// 
//     void setIgnoreBlankLinesAtEnd(boolean ignoreBlankLinesAtEnd);
// 
//     List<List<String>> getLines() throws Exception;
// 
//     int getNumberOfSheets();
// 
//     void setSheetNumber(int sheetNumber);
// 
//     void setLastsheet(boolean lastsheet);
// 
//     void setFirstVisibleSheet();
// 
//     int getSheetNumber();
// 
//     void setSheetNumberAsFirstNotHidden();
// 
//     FileType getFileType();
// 
//     void setGroup(Class<?> group);
// }
// 
// Path: src/main/java/br/com/tecsinapse/dataio/type/FileType.java
// @Getter
// @AllArgsConstructor
// public enum FileType {
// 
//     XLS("MS Excel file (.xls)", MIME_XLS, ".xls") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new HSSFWorkbook(inputStream);
//         }
//     },
//     XLSX("MS Excel file (.xlsx)", MIME_XLSX, ".xlsx") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new XSSFWorkbook(inputStream);
//         }
//     },
//     SXLSX("MS Excel file (.xlsx)", MIME_XLSX, ".xlsx") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new SXSSFWorkbook(new XSSFWorkbook(inputStream));
//         }
//     },
//     XLSM("MS Excel file (.xlsm)", MIME_XLSM, ".xlsm") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return XLSX.buildWorkbook(inputStream);
//         }
//     },
//     CSV("CSV file", "text/plain", ".csv"),
//     TXT("Text file", "text/plain", ".txt"),
//     ZIP("Zip file", "application/zip", ".zip");
// 
//     private final String description;
//     private final String mimeType;
//     private final String extension;
// 
//     public static FileType getFileType(String filename) {
//         for (FileType fileType : values()) {
//             if (filename.toLowerCase().endsWith(fileType.getExtension().toLowerCase())) {
//                 return fileType;
//             }
//         }
//         return TXT;
//     }
// 
//     public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//         throw new UnsupportedOperationException(MSG_IGNORED);
//     }
// 
//     public String toFilenameWithExtension(String filename) {
//         if (filename == null || filename.toLowerCase().endsWith(extension.toLowerCase())) {
//             return filename;
//         }
//         return filename + extension;
//     }
// 
//     public String toFilenameWithExtensionAndLocalTimeNow(String filename) {
//         String filenameWithExtension = toFilenameWithExtension(filename);
//         if (filenameWithExtension == null) {
//             return filenameWithExtension;
//         }
//         String now = ExporterDateUtils.formatAsFileDateTime(new Date());
//         String filenameOnly = filenameWithExtension.length() >= extension.length() ? filenameWithExtension.substring(0, filenameWithExtension.length() - extension.length()) : filenameWithExtension;
//         return  filenameOnly + "_" +  now  + extension;
//     }
// 
// }


import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.testng.Assert;
import br.com.tecsinapse.dataio.importer.Parser;
import br.com.tecsinapse.dataio.type.FileType;
/*
 * Tecsinapse Data Input and Output
 *
 * License: GNU Lesser General Public License (LGPL), version 3 or later
 * See the LICENSE file in the root directory or <http://www.gnu.org/licenses/lgpl-3.0.html>.
 */

package br.com.tecsinapse.datasources;




public class FileDataParser<T extends ApplyTest<T>> implements ApplyTest {

    private final Map<Integer, List<T>> sheets = new HashMap<>();
    private List<T> currentSheet;
    private final File file;
// Path: src/main/java/br/com/tecsinapse/dataio/importer/Parser.java
// public interface Parser<T> extends Closeable {
// 
//     List<T> parse() throws Exception;
// 
//     void setExporterFormatter(ExporterFormatter exporterFormatter);
// 
//     ExporterFormatter getExporterFormatter();
// 
//     void setHeadersRows(int headersRows);
// 
//     boolean isIgnoreBlankLinesAtEnd();
// 
//     void setIgnoreBlankLinesAtEnd(boolean ignoreBlankLinesAtEnd);
// 
//     List<List<String>> getLines() throws Exception;
// 
//     int getNumberOfSheets();
// 
//     void setSheetNumber(int sheetNumber);
// 
//     void setLastsheet(boolean lastsheet);
// 
//     void setFirstVisibleSheet();
// 
//     int getSheetNumber();
// 
//     void setSheetNumberAsFirstNotHidden();
// 
//     FileType getFileType();
// 
//     void setGroup(Class<?> group);
// }
// 
// Path: src/main/java/br/com/tecsinapse/dataio/type/FileType.java
// @Getter
// @AllArgsConstructor
// public enum FileType {
// 
//     XLS("MS Excel file (.xls)", MIME_XLS, ".xls") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new HSSFWorkbook(inputStream);
//         }
//     },
//     XLSX("MS Excel file (.xlsx)", MIME_XLSX, ".xlsx") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new XSSFWorkbook(inputStream);
//         }
//     },
//     SXLSX("MS Excel file (.xlsx)", MIME_XLSX, ".xlsx") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return new SXSSFWorkbook(new XSSFWorkbook(inputStream));
//         }
//     },
//     XLSM("MS Excel file (.xlsm)", MIME_XLSM, ".xlsm") {
//         @Override
//         public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//             return XLSX.buildWorkbook(inputStream);
//         }
//     },
//     CSV("CSV file", "text/plain", ".csv"),
//     TXT("Text file", "text/plain", ".txt"),
//     ZIP("Zip file", "application/zip", ".zip");
// 
//     private final String description;
//     private final String mimeType;
//     private final String extension;
// 
//     public static FileType getFileType(String filename) {
//         for (FileType fileType : values()) {
//             if (filename.toLowerCase().endsWith(fileType.getExtension().toLowerCase())) {
//                 return fileType;
//             }
//         }
//         return TXT;
//     }
// 
//     public Workbook buildWorkbook(InputStream inputStream) throws IOException {
//         throw new UnsupportedOperationException(MSG_IGNORED);
//     }
// 
//     public String toFilenameWithExtension(String filename) {
//         if (filename == null || filename.toLowerCase().endsWith(extension.toLowerCase())) {
//             return filename;
//         }
//         return filename + extension;
//     }
// 
//     public String toFilenameWithExtensionAndLocalTimeNow(String filename) {
//         String filenameWithExtension = toFilenameWithExtension(filename);
//         if (filenameWithExtension == null) {
//             return filenameWithExtension;
//         }
//         String now = ExporterDateUtils.formatAsFileDateTime(new Date());
//         String filenameOnly = filenameWithExtension.length() >= extension.length() ? filenameWithExtension.substring(0, filenameWithExtension.length() - extension.length()) : filenameWithExtension;
//         return  filenameOnly + "_" +  now  + extension;
//     }
// 
// }


// Path: src/test/java/br/com/tecsinapse/datasources/FileDataParser.java
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.testng.Assert;
import br.com.tecsinapse.dataio.importer.Parser;
import br.com.tecsinapse.dataio.type.FileType;

/*
 * Tecsinapse Data Input and Output
 *
 * License: GNU Lesser General Public License (LGPL), version 3 or later
 * See the LICENSE file in the root directory or <http://www.gnu.org/licenses/lgpl-3.0.html>.
 */

package br.com.tecsinapse.datasources;




public class FileDataParser<T extends ApplyTest<T>> implements ApplyTest {

    private final Map<Integer, List<T>> sheets = new HashMap<>();
    private List<T> currentSheet;
    private final File file;
    private Parser<T> parser;