插件开发工具库,推荐依赖该工具库。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

5 years ago
package com.fanruan.api.data;
import com.fanruan.api.Prepare;
5 years ago
import com.fr.base.TableData;
5 years ago
import com.fr.config.Configuration;
5 years ago
import com.fr.data.TableDataSource;
import com.fr.file.TableDataConfig;
import com.fr.main.impl.WorkBook;
import com.fr.script.Calculator;
5 years ago
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
5 years ago
import org.junit.Assert;
5 years ago
import org.junit.Test;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-15
*/
public class TableDataKitTest extends Prepare {
@Test
public void getTableData() {
5 years ago
TestTD td = new TestTD();
Configurations.update(new Worker() {
@Override
public void run() {
TableDataConfig.getInstance().addTableData("first", td);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{TableDataConfig.class};
}
});
5 years ago
Calculator calculator = Calculator.createCalculator();
calculator.setAttribute(TableDataSource.KEY, new WorkBook());
5 years ago
TableData r = TableDataKit.getTableData(calculator, "first");
Assert.assertEquals(td, r);
5 years ago
}
@Test
public void testGetTableData() {
5 years ago
TestTD td = new TestTD();
5 years ago
Calculator calculator = Calculator.createCalculator();
WorkBook workBook = new WorkBook();
5 years ago
workBook.putTableData("test", td);
5 years ago
calculator.setAttribute(TableDataSource.KEY, workBook);
TableData r = TableDataKit.getTableData(calculator, "test");
5 years ago
Assert.assertEquals(td, r);
5 years ago
}
5 years ago
5 years ago
}