From d0f99ed99010e0607d4def470c2db44a6d4c20f3 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 12 Jan 2021 12:25:56 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-46892=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E5=88=87=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E6=9C=89=E6=8F=92=E4=BB=B6=E7=89=88=E6=9C=AC=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E6=97=B6=EF=BC=8C=E8=BF=9C=E7=A8=8B=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E4=BC=9A=E6=B6=88=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 6 ++++-- .../java/com/fr/design/EnvChangeEntranceTest.java | 15 +++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 3e2b30fee2..6de15517ac 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -310,8 +310,10 @@ public class EnvChangeEntrance { String content = PluginErrorRemindHandler.pluginErrorContent(); if (StringUtils.isNotEmpty(content)) { - PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); - dialog.setVisible(true); + SwingUtilities.invokeLater(() -> { + PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); + dialog.setVisible(true); + }); } } diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index 6a78fe0c63..07a1d54f84 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -116,31 +116,22 @@ public class EnvChangeEntranceTest { Workspace workspace = EasyMock.mock(Workspace.class); EasyMock.expect(workspace.isLocal()).andReturn(false).once(); - EasyMock.expect(workspace.isLocal()).andReturn(true).times(2); + EasyMock.expect(workspace.isLocal()).andReturn(true).once(); PowerMock.mockStatic(WorkContext.class); EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); PowerMock.mockStatic(PluginErrorRemindHandler.class); EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); - EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once(); - PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class); - PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once(); - - dialog.setVisible(true); - EasyMock.expectLastCall(); - - EasyMock.replay(workspace, dialog); + EasyMock.replay(workspace); PowerMock.replayAll(); EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); entrance.pluginErrorRemind(); entrance.pluginErrorRemind(); - entrance.pluginErrorRemind(); - - EasyMock.verify(workspace, dialog); + EasyMock.verify(workspace); PowerMock.verifyAll(); } catch (Exception e) { Assert.fail();