From 2423b973bbe7096a2139a9c6eb04538c324a4dcb Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 19 Aug 2019 12:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/data/TableDataKitTest.java | 59 +++++++++++++++++++ .../com/fanruan/api/util/StringKitTest.java | 29 +++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/test/java/com/fanruan/api/util/StringKitTest.java diff --git a/src/test/java/com/fanruan/api/data/TableDataKitTest.java b/src/test/java/com/fanruan/api/data/TableDataKitTest.java index 78dd869..7367acc 100644 --- a/src/test/java/com/fanruan/api/data/TableDataKitTest.java +++ b/src/test/java/com/fanruan/api/data/TableDataKitTest.java @@ -1,8 +1,22 @@ package com.fanruan.api.data; import com.fanruan.api.Prepare; +import com.fr.base.AbstractTableData; +import com.fr.base.TableData; +import com.fr.data.TableDataSource; +import com.fr.file.TableDataConfig; +import com.fr.general.data.DataModel; +import com.fr.main.impl.WorkBook; +import com.fr.script.Calculator; +import com.fr.stable.ParameterProvider; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import org.junit.Assert; import org.junit.Test; +import java.util.HashMap; +import java.util.Map; + import static org.junit.Assert.*; /** @@ -14,9 +28,54 @@ public class TableDataKitTest extends Prepare { @Test public void getTableData() { + Map map = new HashMap<>(); + map.put("test", TD); + TableDataConfig.getInstance().setTableDatas(map); + Calculator calculator = Calculator.createCalculator(); + calculator.setAttribute(TableDataSource.KEY, new WorkBook()); + TableData r = TableDataKit.getTableData(calculator, "test"); + Assert.assertEquals(TD, r); } @Test public void testGetTableData() { + Calculator calculator = Calculator.createCalculator(); + WorkBook workBook = new WorkBook(); + workBook.putTableData("test", TD); + calculator.setAttribute(TableDataSource.KEY, workBook); + TableData r = TableDataKit.getTableData(calculator, "test"); + Assert.assertEquals(TD, r); } + + private static final TableData TD = new AbstractTableData() { + @Override + public ParameterProvider[] getParameters(Calculator calculator) { + return new ParameterProvider[0]; + } + + @Override + public DataModel createDataModel(Calculator calculator) { + return null; + } + + @Override + public DataModel createDataModel(Calculator calculator, String s) { + return null; + } + + @Override + public DataModel createDataModel(Calculator calculator, int i) { + return null; + } + + @Override + public void readXML(XMLableReader xmLableReader) { + + } + + @Override + public void writeXML(XMLPrintWriter xmlPrintWriter) { + + } + }; } \ No newline at end of file diff --git a/src/test/java/com/fanruan/api/util/StringKitTest.java b/src/test/java/com/fanruan/api/util/StringKitTest.java new file mode 100644 index 0000000..be66448 --- /dev/null +++ b/src/test/java/com/fanruan/api/util/StringKitTest.java @@ -0,0 +1,29 @@ +package com.fanruan.api.util; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class StringKitTest { + + @Test + public void isEmpty() { + } + + @Test + public void isNotEmpty() { + } + + @Test + public void isBlank() { + } + + @Test + public void isNotBlank() { + } +} \ No newline at end of file