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();