// Path: src/main/java/br/com/tecsinapse/dataio/importer/Importer.java
// public class Importer<T> implements Closeable {
// 
//     public static final int DEFAULT_START_ROW = 1;
//     private final Class<?> group;
//     private Class<T> clazz;
//     private File file;
//     private InputStream inputStream;
//     private String filename;
//     private Charset charset;
//     private Parser<T> parser;
//     private int headersRows = DEFAULT_START_ROW;
//     private boolean isLastSheet;
// 
//     public Importer(Class<T> clazz, Charset charset, File file) {
//         this(clazz, charset, Default.class);
//         this.file = file;
//     }
// 
//     public Importer(Class<T> clazz, Charset charset, InputStream inputStream, String filename) {
//         this(clazz, inputStream, filename);
//         this.charset = charset;
//     }
// 
//     public Importer(Class<T> clazz, File file) {
//         this(clazz, file, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, File file, Class<?> group) {
//         this(clazz, group);
//         this.file = file;
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename) {
//         this(clazz, inputStream, filename, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, Class<?> group) {
//         this(clazz, inputStream, filename, false, group);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, boolean isLastSheet) {
//         this(clazz, inputStream, filename, isLastSheet, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, boolean isLastSheet, Class<?> group) {
//         this(clazz, inputStream, filename, DEFAULT_START_ROW, isLastSheet, group);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, int afterLine, boolean isLastSheet) {
//         this(clazz, inputStream, filename, afterLine, isLastSheet, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, int afterLine, boolean isLastSheet, Class<?> group) {
//         this(clazz, group);
//         this.inputStream = inputStream;
//         this.filename = filename;
//         this.headersRows = afterLine;
//         this.isLastSheet = isLastSheet;
//     }
// 
//     private Importer(Class<T> clazz, Class<?> group) {
//         this(clazz, Charset.defaultCharset(), group);
//     }
// 
//     private Importer(Class<T> clazz, Charset charset, Class<?> group) {
//         this.clazz = clazz;
//         this.charset = charset;
//         this.group = group;
//     }
// 
//     private void beforeParser() throws IOException {
//         doBeforeParser();
//     }
// 
//     private void doBeforeParser() throws IOException {
//         FileType fileType = getFileType();
//         if (fileType == FileType.XLSX || fileType == FileType.XLS) {
//             if (file != null) {
//                 parser = new SpreadsheetParser<>(clazz, file);
//                 parser.setGroup(group);
//                 parser.setHeadersRows(headersRows);
//                 parser.setLastsheet(isLastSheet);
//                 return;
//             }
//             if (inputStream != null) {
//                 parser = new SpreadsheetParser<>(clazz, inputStream, fileType);
//                 parser.setGroup(group);
//                 parser.setHeadersRows(headersRows);
//                 parser.setLastsheet(isLastSheet);
//                 return;
//             }
//         }
//         if (file != null) {
//             parser = new CsvParser<>(clazz, file, charset, headersRows, group);
//             return;
//         }
//         if (inputStream != null) {
//             parser = new CsvParser<>(clazz, inputStream, charset, headersRows, group);
//         }
//     }
// 
//     public FileType getFileType() {
//         if (this.file == null && Strings.isNullOrEmpty(this.filename)) {
//             throw new IllegalStateException("File is null and filename is null");
//         }
//         String name = this.filename;
//         if (file != null) {
//             name = file.getName();
//         }
//         return FileType.getFileType(name);
//     }
// 
//     public void setAfterLine(int afterLine) {
//         this.headersRows = afterLine;
//     }
// 
//     public void setCharset(Charset charset) {
//         this.charset = charset;
//     }
// 
//     public List<T> parse() throws Exception {
//         beforeParser();
//         return parser.parse();
//     }
// 
//     public int getNumberOfSheets() {
//         return parser.getNumberOfSheets();
//     }
// 
//     @Override
//     public void close() throws IOException {
//         parser.close();
//     }
// 
// }


import java.io.File;
import java.net.URISyntaxException;
import java.util.List;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.importer.Importer;
/*
 * 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.dataio.test;




public class ImporterTestNumeric {

    @DataProvider(name = "arquivos")
    public Object[][] getExcel() throws URISyntaxException {

        return new Object[][]{
                {getFile("excel-numeric.xlsx"), "FakePojoNumeric{value1='1323.45', value2='2433.56', value3='2014.0', value4='665.0', value5='4345.0'}FakePojoNumeric{value1='0.5', value2='4354.0', value3='null', value4='34.56', value5='454'}"},
        };
    }

    private File getFile(String name) throws URISyntaxException {
        return new File(getClass().getResource("/files/" + name).toURI());
    }

    @Test(dataProvider = "arquivos")
    public void test(File file, String result) throws Exception {
// Path: src/main/java/br/com/tecsinapse/dataio/importer/Importer.java
// public class Importer<T> implements Closeable {
// 
//     public static final int DEFAULT_START_ROW = 1;
//     private final Class<?> group;
//     private Class<T> clazz;
//     private File file;
//     private InputStream inputStream;
//     private String filename;
//     private Charset charset;
//     private Parser<T> parser;
//     private int headersRows = DEFAULT_START_ROW;
//     private boolean isLastSheet;
// 
//     public Importer(Class<T> clazz, Charset charset, File file) {
//         this(clazz, charset, Default.class);
//         this.file = file;
//     }
// 
//     public Importer(Class<T> clazz, Charset charset, InputStream inputStream, String filename) {
//         this(clazz, inputStream, filename);
//         this.charset = charset;
//     }
// 
//     public Importer(Class<T> clazz, File file) {
//         this(clazz, file, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, File file, Class<?> group) {
//         this(clazz, group);
//         this.file = file;
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename) {
//         this(clazz, inputStream, filename, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, Class<?> group) {
//         this(clazz, inputStream, filename, false, group);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, boolean isLastSheet) {
//         this(clazz, inputStream, filename, isLastSheet, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, boolean isLastSheet, Class<?> group) {
//         this(clazz, inputStream, filename, DEFAULT_START_ROW, isLastSheet, group);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, int afterLine, boolean isLastSheet) {
//         this(clazz, inputStream, filename, afterLine, isLastSheet, Default.class);
//     }
// 
//     public Importer(Class<T> clazz, InputStream inputStream, String filename, int afterLine, boolean isLastSheet, Class<?> group) {
//         this(clazz, group);
//         this.inputStream = inputStream;
//         this.filename = filename;
//         this.headersRows = afterLine;
//         this.isLastSheet = isLastSheet;
//     }
// 
//     private Importer(Class<T> clazz, Class<?> group) {
//         this(clazz, Charset.defaultCharset(), group);
//     }
// 
//     private Importer(Class<T> clazz, Charset charset, Class<?> group) {
//         this.clazz = clazz;
//         this.charset = charset;
//         this.group = group;
//     }
// 
//     private void beforeParser() throws IOException {
//         doBeforeParser();
//     }
// 
//     private void doBeforeParser() throws IOException {
//         FileType fileType = getFileType();
//         if (fileType == FileType.XLSX || fileType == FileType.XLS) {
//             if (file != null) {
//                 parser = new SpreadsheetParser<>(clazz, file);
//                 parser.setGroup(group);
//                 parser.setHeadersRows(headersRows);
//                 parser.setLastsheet(isLastSheet);
//                 return;
//             }
//             if (inputStream != null) {
//                 parser = new SpreadsheetParser<>(clazz, inputStream, fileType);
//                 parser.setGroup(group);
//                 parser.setHeadersRows(headersRows);
//                 parser.setLastsheet(isLastSheet);
//                 return;
//             }
//         }
//         if (file != null) {
//             parser = new CsvParser<>(clazz, file, charset, headersRows, group);
//             return;
//         }
//         if (inputStream != null) {
//             parser = new CsvParser<>(clazz, inputStream, charset, headersRows, group);
//         }
//     }
// 
//     public FileType getFileType() {
//         if (this.file == null && Strings.isNullOrEmpty(this.filename)) {
//             throw new IllegalStateException("File is null and filename is null");
//         }
//         String name = this.filename;
//         if (file != null) {
//             name = file.getName();
//         }
//         return FileType.getFileType(name);
//     }
// 
//     public void setAfterLine(int afterLine) {
//         this.headersRows = afterLine;
//     }
// 
//     public void setCharset(Charset charset) {
//         this.charset = charset;
//     }
// 
//     public List<T> parse() throws Exception {
//         beforeParser();
//         return parser.parse();
//     }
// 
//     public int getNumberOfSheets() {
//         return parser.getNumberOfSheets();
//     }
// 
//     @Override
//     public void close() throws IOException {
//         parser.close();
//     }
// 
// }


// Path: src/test/java/br/com/tecsinapse/dataio/test/ImporterTestNumeric.java
import java.io.File;
import java.net.URISyntaxException;
import java.util.List;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.importer.Importer;

/*
 * 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.dataio.test;




public class ImporterTestNumeric {

    @DataProvider(name = "arquivos")
    public Object[][] getExcel() throws URISyntaxException {

        return new Object[][]{
                {getFile("excel-numeric.xlsx"), "FakePojoNumeric{value1='1323.45', value2='2433.56', value3='2014.0', value4='665.0', value5='4345.0'}FakePojoNumeric{value1='0.5', value2='4354.0', value3='null', value4='34.56', value5='454'}"},
        };
    }

    private File getFile(String name) throws URISyntaxException {
        return new File(getClass().getResource("/files/" + name).toURI());
    }

    @Test(dataProvider = "arquivos")
    public void test(File file, String result) throws Exception {
        List<FakePojoNumeric> pojos = new Importer<FakePojoNumeric>(FakePojoNumeric.class, file).parse();