@Test public void testLaunchJettyServerWhenAlreadyRunningDoesntLaunchAgain() { Server jetty = createMock(Server.class); String preconfigurationUrl = "http://foo:8080"; expect(jetty.getState()).andReturn(Server.STARTED); replay(jetty); StartJettyIfNotAlreadyRunning starter = new StartJettyIfNotAlreadyRunning(jetty, preconfigurationUrl); starter.start(); assertEquals(starter.get(), URI.create(preconfigurationUrl)); verify(jetty); }
@Test public void testLoadStartsJettyServer() throws Exception { Server jetty = createMock(Server.class); String preconfigurationUrl = "http://foo:8080"; expect(jetty.getState()).andReturn(Server.STARTED); replay(jetty); StartJettyIfNotAlreadyRunning starter = new StartJettyIfNotAlreadyRunning(preconfigurationUrl, jetty); IsoSpec isoSpec = IsoSpec.builder() .sourcePath("/tmp/myisos/ubuntu.iso") .installationScript("install") .build(); assertEquals(starter.load(isoSpec), URI.create(preconfigurationUrl)); verify(jetty); }