Welcome to your wiki!
This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: [SamplePage].
The wiki uses Markdown syntax.
Below the test class that shows how to take advantage of XLSUnit:
/** * * @author ENNAHDI EL IDRISSI, Mohamed * @since 0.0.1 * */ @Generated(value = "org.junit-tools-1.1.0") public class ExcelComparatorTest { Logger logger = LogManager.getLogger(ExcelComparatorTest.class); @Test public void largeCompareTest() throws Exception { List<String> result; result = excelCompare("SomeXLSFilmReportExample.xlsx", "SomeXLSFilmReportExampleExpected.xlsx"); Assert.assertEquals(result.size(), 0); this.print(result); } @Test public void smallCompareTest() throws Exception { List<String> result; result = excelCompare("SmallSomeXLSFilmReportExample.xlsx", "SmallSomeXLSFilmReportExampleExpected.xlsx"); Assert.assertEquals(result.size(), 0); this.print(result); } @Test public void smallDifferentCompareTest() throws Exception { List<String> result; result = excelCompare("SmallDifferentSomeXLSFilmReportExample.xlsx", "SmallSomeXLSFilmReportExampleExpected.xlsx"); this.print(result); Assert.assertEquals(result.size(), 2); } public List<String> excelCompare(String fileNameActual, String fileNameExpected) throws Exception { long begin = System.nanoTime(); Workbook wbActual = null; Workbook wbExpected = null; try ( InputStream inActual = getClass().getResourceAsStream(fileNameActual); InputStream inExpected = getClass().getResourceAsStream(fileNameExpected) ) { wbActual = new XSSFWorkbook(inActual); wbExpected = new XSSFWorkbook(inExpected); return ExcelComparator.compare(wbActual, wbExpected); } finally { if (wbActual != null) { wbActual.close(); } if (wbExpected != null) { wbExpected.close(); } long end = System.nanoTime(); logger.info("Execution time: {}", TimeUnit.NANOSECONDS.toSeconds(end - begin)); } } /** * Displaying messages. * @param result */ private void print(List<String> result) { for (String message : result) { logger.info(message); } } }
Log in to post a comment.
Below the test class that shows how to take advantage of XLSUnit: