我正在尝试读取 .xls 文件以询问其内容。我不断收到 AssertionError。我也想在测试后从目录中删除这个文件。
@Test public void testSpreadsheetCont() 抛出异常 {
FileInputStream fileInputStream = new FileInputStream("C:/var/fedex/pricingbackfillmonitor/data/Backfill Message Monitor.xls");
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
HSSFSheet worksheet = workbook.getSheetAt(0);
HSSFRow row1 = worksheet.getRow(2);
HSSFCell cell1 = row1.getCell(1);
boolean success = false;
if (cell1.getStringCellValue() == "L")
{
success = true;
}else{
success = false;
}
Assert.assertTrue(success);
}