diff --git a/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java b/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java index c57976a9..58660c90 100644 --- a/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java +++ b/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java @@ -4,22 +4,32 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.fastjson.JSON; + import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.event.AnalysisEventListener; -import com.alibaba.fastjson.JSON; - /** * @author Jiaju Zhuang */ -public class ListHeadDataListener extends AnalysisEventListener> { +public class ListHeadDataListener implements ReadListener> { private static final Logger LOGGER = LoggerFactory.getLogger(NoHeadData.class); List> list = new ArrayList>(); + @Override + public void invokeHead(Map> headMap, AnalysisContext context) { + Assert.assertNotNull(context.readRowHolder().getRowIndex()); + headMap.forEach((key, value) -> { + Assert.assertEquals(value.getRowIndex(), context.readRowHolder().getRowIndex()); + Assert.assertEquals(value.getColumnIndex(), key); + }); + } + @Override public void invoke(Map data, AnalysisContext context) { list.add(data);