cookercucumber_parser.flatFileParser.PlainParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cooker-maven-plugin Show documentation
Show all versions of cooker-maven-plugin Show documentation
Derives smallest Feature File, Allows Data from Excel(xls and xlsx) and Also provides a clear and
concise reporting
package cookercucumber_parser.flatFileParser;
import common.fileFactory.FileUtility;
import org.apache.commons.io.FilenameUtils;
import java.io.IOException;
/**
* @author Manjunath Prabhakar (Manjunath-PC)
* @created 23/09/2020
* @project cookercucumber-maven-plugin
*/
public class PlainParser {
/**
* Read the Plain File and Convert that into Examples Format for Scenario Outline
* Author : Manjunath Prabhakar ([email protected])
*
* @param filePath Folder Path Only
* @param fileName FileName with Extension (txt)
* @return Txt Data in Examples Format
* @throws IOException If Any
*/
public static String readPlain(String filePath, String fileName) throws Exception {
if (!FilenameUtils.getExtension(fileName).equalsIgnoreCase("txt")) {
throw new Exception("Invalid Extension. Accepted(txt)");
}
return "Examples:\n" + FileUtility.readAndGetFileContent(filePath + "\\" + fileName);
}
}