Browse Source
* commit '47540321b5829aa21eb03177b32625842a00b626': 补充单元测试 REPORT-19857 英文版alphafine显示问题 1. 把判断国际化的过程和 点击配置页面才能更新 的逻辑解耦。放到启动的时候做。 2. 配置不依赖于 searchOnline 而是判断中英文。feature/big-screen
Harrison
5 years ago
5 changed files with 86 additions and 11 deletions
@ -0,0 +1,46 @@
|
||||
package com.fr.design.mainframe.alphafine; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; |
||||
import com.fr.general.GeneralContext; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import static org.junit.Assert.*; |
||||
|
||||
@RunWith(PowerMockRunner.class) |
||||
public class AlphaFineHelperTest { |
||||
|
||||
@Test |
||||
@PrepareForTest({GeneralContext.class, DesignerEnvManager.class}) |
||||
@SuppressStaticInitializationFor("com.fr.design.mainframe.alphafine.AlphaFineHelper") |
||||
public void testSwitchConfig4Locale() throws Exception { |
||||
|
||||
PowerMock.mockStatic(GeneralContext.class); |
||||
EasyMock.expect(GeneralContext.isChineseEnv()).andReturn(true).times(1).andReturn(false).times(1); |
||||
|
||||
DesignerEnvManager manager = EasyMock.mock(DesignerEnvManager.class); |
||||
EasyMock.expect(manager.getAlphaFineConfigManager()).andReturn(new AlphaFineConfigManager()).anyTimes(); |
||||
EasyMock.replay(manager); |
||||
|
||||
PowerMock.mockStatic(DesignerEnvManager.class); |
||||
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); |
||||
|
||||
PowerMock.replayAll(); |
||||
|
||||
AlphaFineHelper.switchConfig4Locale(); |
||||
AlphaFineConfigManager config = manager.getAlphaFineConfigManager(); |
||||
Assert.assertEquals(true, config.isSearchOnLine()); |
||||
|
||||
AlphaFineHelper.switchConfig4Locale(); |
||||
Assert.assertEquals(false, config.isSearchOnLine()); |
||||
|
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue