Browse Source

测试

feature/big-screen
Maksim 5 years ago
parent
commit
b9e13fbef3
  1. 54
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

54
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -6,6 +6,7 @@ import com.fr.design.write.submit.CheckServiceDialog;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock; import org.powermock.api.easymock.PowerMock;
@ -23,30 +24,35 @@ public class EnvChangeEntranceTest {
@Test @Test
public void showServiceDialog() throws Exception { public void showServiceDialog() throws Exception {
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); try {
DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class); DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class);
String remoteBranch = "Build#persist-2020.02.15.01.01.12.12";
EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo); String remoteBranch = "Build#persist-2020.02.15.01.01.12.12";
EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote); EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo);
EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null); EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote);
EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null);
FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class);
EasyMock.expect(request.getServiceList()).andReturn(null); FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class);
EasyMock.expect(request.getServiceList()).andReturn(null);
PowerMock.expectNew(FunctionalHttpRequest.class,connectionInfo).andReturn(request).anyTimes();
EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes();
EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch);
CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class);
PowerMock.expectNew(CheckServiceDialog.class,EasyMock.anyObject(),EasyMock.anyObject(),EasyMock.anyObject(),EasyMock.anyObject()).andReturn(dialog); CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class);
PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject()).andReturn(dialog);
EasyMock.replay(request);
EasyMock.replay(selectedEnv); EasyMock.replay(request);
EasyMock.replay(connectionInfo); EasyMock.replay(selectedEnv);
PowerMock.replayAll(); EasyMock.replay(connectionInfo);
PowerMock.replayAll();
entrance.showServiceDialog(selectedEnv);
entrance.showServiceDialog(selectedEnv);
Assert.assertTrue(true);
}catch (Exception e){
Assert.assertTrue(false);
}
} }
} }
Loading…
Cancel
Save