1 package com.atlassian.plugin.main;
2
3 import com.atlassian.plugin.PluginController;
4 import com.mockobjects.dynamic.C;
5 import com.mockobjects.dynamic.Mock;
6 import org.junit.Test;
7
8 import static org.junit.Assert.assertFalse;
9 import static org.junit.Assert.assertTrue;
10
11 public class TestHotDeployer {
12
13 @Test
14 public void testRun() throws InterruptedException {
15 Mock mockController = new Mock(PluginController.class);
16 mockController.expectAndReturn("scanForNewPlugins", C.ANY_ARGS, 0);
17
18 HotDeployer deployer = new HotDeployer((PluginController) mockController.proxy(), 1000);
19 assertFalse(deployer.isRunning());
20 deployer.start();
21 Thread.sleep(500);
22 assertTrue(deployer.isRunning());
23 mockController.verify();
24 deployer.stop();
25 assertFalse(deployer.isRunning());
26 }
27 }