01: // Copyright © 2006-2007 ASERT. Released under the Canoo Webtest license.
02: package com.canoo.webtest.plugins.exceltest;
03:
04: import com.canoo.webtest.steps.Step;
05: import org.apache.poi.hssf.usermodel.HSSFCell;
06:
07: /**
08: * Test class for {@link ExcelVerifyCellValue}.<p>
09: *
10: * @author Rob Nielsen
11: */
12: public class ExcelVerifyCellValueTest extends BaseExcelStepTestCase {
13: protected Step createStep() {
14: return new ExcelVerifyCellValue();
15: }
16:
17: public void testWrong() {
18: final ExcelVerifyCellValue step = (ExcelVerifyCellValue) getStep();
19: step.setText("xxx");
20: step.setCell("B10");
21: assertFailOnExecute(
22: step,
23: "wrong",
24: "Wrong cell value found for cell B10. Expected value \"xxx\" but got \"This is a very long string of text that can be searched for.\"");
25: }
26:
27: public void testError() throws Exception {
28: final ExcelVerifyCellValue step = (ExcelVerifyCellValue) getStep();
29: step.setCell("B2");
30: step.setText("Error Code 42");
31: step.getExcelCell().setCellErrorValue((byte) 42);
32: step.getExcelCell().setCellType(HSSFCell.CELL_TYPE_ERROR);
33: executeStep(step);
34: }
35:
36: }
|