Browse Source

REPORT-94637 单元测试修复

newui
Bruce.Deng 1 year ago
parent
commit
c516bf5950
  1. 40
      designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java

40
designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.template.info;
import com.fr.base.background.ColorBackground;
import com.fr.base.svg.IconUtils;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.form.main.Form;
import com.fr.form.ui.CardSwitchButton;
@ -20,15 +22,53 @@ import com.fr.json.JSONArray;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.worksheet.FormElementCase;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
/**
* Created by kerry on 2020-05-08
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({Toolkit.class, IconUtils.class})
@PowerMockIgnore({"javax.management.*"})
public class JFormProcessInfoTest {
@Before
public void setUp() throws Exception {
PowerMock.mockStatic(Toolkit.class);
PowerMock.mockStatic(IconUtils.class);
EasyMock.expect(Toolkit.i18nText(EasyMock.anyString())).andReturn("ignore").anyTimes();
EasyMock.expect(IconUtils.readIcon(EasyMock.anyString())).andReturn(new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
// do nothing
}
@Override
public int getIconWidth() {
return 0;
}
@Override
public int getIconHeight() {
return 0;
}
}).anyTimes();
PowerMock.replayAll();
}
@Test
public void testHasTestECReport() {
Form form = new Form();

Loading…
Cancel
Save