Browse Source

单元测试

pull/1/head
richie 5 years ago
parent
commit
2423b973bb
  1. 59
      src/test/java/com/fanruan/api/data/TableDataKitTest.java
  2. 29
      src/test/java/com/fanruan/api/util/StringKitTest.java

59
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<String, TableData> 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) {
}
};
}

29
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() {
}
}
Loading…
Cancel
Save