From c516bf5950604e8a7f5a6cbe6f0ee781144cf4f4 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Mon, 10 Jul 2023 13:40:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-94637=20=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/info/JFormProcessInfoTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java b/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java index be4c9cd7a3..5ed5da4ab8 100644 --- a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java +++ b/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();