private String validExtension(String dataPath) throws TechnicalException {
        final Set<String> extensions = new HashSet<>();
        for (final File file : new File(dataPath).listFiles()) {
            if (FilenameUtils.getBaseName(file.getName()).equals(scenarioName) && FilenameUtils.getExtension(file.getName()).startsWith("xls")) {
                extensions.add(FilenameUtils.getExtension(file.getName()));
            }
        }
        if (extensions.size() != 1) {
            throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_EXPECTED_EXCEL_EXTENTION_ERROR));
        }
        return extensions.iterator().next();
    }
private String validExtension ( String dataPath ) throws TechnicalException { final Set < String > extensions = new HashSet < > ( ) ; for ( final File file : new File ( dataPath ) . listFiles ( ) ) { if ( FilenameUtils . getBaseName ( file . getName ( ) ) . equals ( scenarioName ) && FilenameUtils . getExtension ( file . getName ( ) ) . startsWith ( "xls" ) ) { extensions . add ( FilenameUtils . getExtension ( file . getName ( ) ) ) ; } } if ( extensions . size ( ) != 1 ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_EXPECTED_EXCEL_EXTENTION_ERROR ) ) ; } return extensions . iterator ( ) . next ( ) ; }
Valid Excel extension: xls, xlsx, or xlsm.

@param dataPath
path of all files from input/output folder
@return unique extension if right
@throws TechnicalException
If you are using Excel as a dataProvider, you must choose one of the following formats: xls, xlsx, or xlsm.