【发布时间】:2017-04-20 06:27:25
【问题描述】:
为什么我不能成功测试这个案例?
@Test
public void test_Should_be_0() throws Exception {
HSSFCell cell = new HSSFWorkbook().createSheet().createRow(0).createCell(0);
cell.setCellValue(0);
assertTrue(cell == 0);
感谢您的帮助。
【问题讨论】:
-
它是如何编译的,您尝试将引用与
0进行比较,这无法确定。 -
@NicolasFilotto:谢谢你的快速回复,但是当我写 cell.setCellValue(0);我没有把值放在单元格中吗?
-
是的,但这不是您实际测试的内容,请查看我的答案了解更多详情
-
Apache POI 附带了大量的单元测试,为什么不look at some of those and learn from them?
标签: java maven junit apache-poi testcase