Browse Source

无 jira 任务, 单元测试

research/10.0
Harrison 5 years ago
parent
commit
33642afad2
  1. 10
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java

10
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java

@ -11,8 +11,7 @@ import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import static org.junit.Assert.*;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
public class AlphaFineHelperTest { public class AlphaFineHelperTest {
@ -25,8 +24,13 @@ public class AlphaFineHelperTest {
PowerMock.mockStatic(GeneralContext.class); PowerMock.mockStatic(GeneralContext.class);
EasyMock.expect(GeneralContext.isChineseEnv()).andReturn(true).times(1).andReturn(false).times(1); EasyMock.expect(GeneralContext.isChineseEnv()).andReturn(true).times(1).andReturn(false).times(1);
AlphaFineConfigManager mockConfig = EasyMock.partialMockBuilder(AlphaFineConfigManager.class).createMock();
Whitebox.setInternalState(mockConfig,"searchOnLine", true);
EasyMock.replay(mockConfig);
DesignerEnvManager manager = EasyMock.mock(DesignerEnvManager.class); DesignerEnvManager manager = EasyMock.mock(DesignerEnvManager.class);
EasyMock.expect(manager.getAlphaFineConfigManager()).andReturn(new AlphaFineConfigManager()).anyTimes(); EasyMock.expect(manager.getAlphaFineConfigManager()).andReturn(mockConfig).anyTimes();
EasyMock.replay(manager); EasyMock.replay(manager);
PowerMock.mockStatic(DesignerEnvManager.class); PowerMock.mockStatic(DesignerEnvManager.class);

Loading…
Cancel
Save