expect(future.get()).andReturn(downloadResult).anyTimes();
DownloadHandle downloadHandle = addTestMock(DownloadHandle.class);
expect(downloadHandle.start(isNull(DownloadProgressListener.class))).andReturn(future).anyTimes();
DeploymentHandler deploymentHandler = addTestMock(DeploymentHandler.class);
expect(deploymentHandler.getInstalledVersion()).andReturn(m_version2).anyTimes();
expect(deploymentHandler.getAvailableVersions()).andReturn(m_availableVersions).anyTimes();
expect(deploymentHandler.getDownloadHandle(eq(m_version3), eq(true))).andReturn(downloadHandle).once();
deploymentHandler.install(notNull(InputStream.class));
expectLastCall().once();
m_agentContext = mockAgentContext();
m_agentContext.setHandler(DeploymentHandler.class, deploymentHandler);
replayTestMocks();