// Path: src/main/java/br/com/tecsinapse/dataio/util/SpreadsheetUtil.java
// @UtilityClass
// public final class SpreadsheetUtil {
// 
//     public static int getColumnIndexByColumnName(String columnName) {
//         columnName = getColumnFromCellName(columnName.toUpperCase());
//         int value = 0;
//         for (int i = 0; i < columnName.length(); i++) {
//             int delta = (columnName.charAt(i)) - 64;
//             value = value * 26 + delta;
//         }
//         return value - 1;
//     }
// 
//     private static String getColumnFromCellName(String cellReference) {
//         if (Strings.isNullOrEmpty(cellReference)) {
//             return "";
//         }
// 
//         return cellReference.split("[0-9]*$")[0];
//     }
// 
//     public static String getColumnNameByColumnIndex(int columnIndex) {
//         String s = "";
//         do {
//             s = (char) ('A' + (columnIndex % 26)) + s;
//             columnIndex /= 26;
//         } while (columnIndex-- > 0);
//         return s;
//     }
// 
// }


import java.net.URISyntaxException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.util.SpreadsheetUtil;
/*
 * 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 SpreadsheetUtilTest {

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

        return new Object[][]{
                {"A1", 0},
                {"B", 1},
        };
    }

    @Test(dataProvider = "columnNames")
    public void getColumnIndex(String columnName, int result) {
// Path: src/main/java/br/com/tecsinapse/dataio/util/SpreadsheetUtil.java
// @UtilityClass
// public final class SpreadsheetUtil {
// 
//     public static int getColumnIndexByColumnName(String columnName) {
//         columnName = getColumnFromCellName(columnName.toUpperCase());
//         int value = 0;
//         for (int i = 0; i < columnName.length(); i++) {
//             int delta = (columnName.charAt(i)) - 64;
//             value = value * 26 + delta;
//         }
//         return value - 1;
//     }
// 
//     private static String getColumnFromCellName(String cellReference) {
//         if (Strings.isNullOrEmpty(cellReference)) {
//             return "";
//         }
// 
//         return cellReference.split("[0-9]*$")[0];
//     }
// 
//     public static String getColumnNameByColumnIndex(int columnIndex) {
//         String s = "";
//         do {
//             s = (char) ('A' + (columnIndex % 26)) + s;
//             columnIndex /= 26;
//         } while (columnIndex-- > 0);
//         return s;
//     }
// 
// }


// Path: src/test/java/br/com/tecsinapse/dataio/test/SpreadsheetUtilTest.java
import java.net.URISyntaxException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.util.SpreadsheetUtil;

/*
 * 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 SpreadsheetUtilTest {

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

        return new Object[][]{
                {"A1", 0},
                {"B", 1},
        };
    }

    @Test(dataProvider = "columnNames")
    public void getColumnIndex(String columnName, int result) {
        Assert.assertEquals(SpreadsheetUtil.getColumnIndexByColumnName(columnName), result);