帆软报表设计器源代码。
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.
 
 
 
 

94 lines
3.9 KiB

package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
public class ModelTest {
@Test
public void documentModelTest() {
DocumentModel documentModel = new DocumentModel("name", "content", 1);
Assert.assertEquals("name", documentModel.getName());
Assert.assertEquals("content", documentModel.getContent());
Assert.assertEquals(1, documentModel.getDocumentId());
Assert.assertEquals(AlphaFineCloudConstants.getDocumentDocUrl() + documentModel.getDocumentId() + ".html", documentModel.getDocumentUrl());
Assert.assertEquals(AlphaFineCloudConstants.getDocumentInformationUrl() + documentModel.getDocumentId(), documentModel.getInformationUrl());
Assert.assertEquals(documentModel.getStoreInformation(), documentModel.getInformationUrl());
Assert.assertEquals(CellType.DOCUMENT, documentModel.getType());
Assert.assertEquals(true, documentModel.hasAction());
Assert.assertEquals(true, documentModel.isNeedToSendToServer());
documentModel.setDescription("test");
Assert.assertEquals("test", documentModel.getDescription());
DocumentModel another = new DocumentModel("another", "another", 1);
documentModel.doAction();
Assert.assertTrue(another.equals(documentModel));
Assert.assertNotNull(documentModel.modelToJson());
}
@Test
public void bottomModelTest() {
BottomModel bottomModel = new BottomModel();
Assert.assertEquals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Internet_Forum"), bottomModel.getGoToWeb());
Assert.assertEquals(CellType.BOTTOM, bottomModel.getType());
try {
Assert.assertEquals(JSONObject.EMPTY, bottomModel.modelToJson());
} catch (JSONException e) {
e.printStackTrace();
}
Assert.assertEquals(true, bottomModel.hasAction());
bottomModel.doAction();
}
@Test
public void fileModelTest() {
FileModel fileModel = new FileModel("name", "test\\\\");
Assert.assertEquals(CellType.FILE, fileModel.getType());
Assert.assertNotNull(fileModel.modelToJson());
FileModel anotherFileModel = new FileModel("anotherFileModel", "test\\\\");
Assert.assertTrue(anotherFileModel.equals(fileModel));
}
@Test
public void moreModelTest() {
MoreModel moreModel = new MoreModel("name");
Assert.assertTrue(!moreModel.hasAction());
Assert.assertTrue(!moreModel.isNeedToSendToServer());
Assert.assertEquals(CellType.MORE, moreModel.getType());
}
@Test
public void noResultModelTest() {
NoResultModel noResultModel = new NoResultModel("test");
Assert.assertTrue(!noResultModel.hasAction());
Assert.assertTrue(!noResultModel.isNeedToSendToServer());
Assert.assertEquals(CellType.NO_RESULT, noResultModel.getType());
}
@Test
public void pluginModelTest() {
PluginModel pluginModel = new PluginModel("name", "content", "url", "version", "jartime", "link", "pluginId", CellType.PLUGIN, 10000, 1);
Assert.assertTrue(pluginModel.hasAction());
Assert.assertTrue(pluginModel.isNeedToSendToServer());
Assert.assertEquals(CellType.PLUGIN, pluginModel.getType());
Assert.assertNotNull(pluginModel.modelToJson());
}
@Test
public void robotModelTest(){
RobotModel robotModel = new RobotModel("title","content");
Assert.assertTrue(robotModel.hasAction());
Assert.assertTrue(robotModel.isNeedToSendToServer());
Assert.assertEquals(CellType.ROBOT, robotModel.getType());
try {
Assert.assertNotNull(robotModel.modelToJson());
} catch (JSONException e) {
e.printStackTrace();
}
}
}