@Test public void testInstallOnly() throws Exception { final FitNesse fitNesse = mock(FitNesse.class); context.withParameter(ConfigurationParameter.INSTALL_ONLY, "true"); // Avoid doing a real update... context.withParameter(ConfigurationParameter.OMITTING_UPDATES, "true"); context = spy(context); doAnswer(fitNesseContextWith(fitNesse)).when(context).makeFitNesseContext(); new FitNesseMain().launchFitNesse(context); verify(fitNesse, never()).start(); }
@Test public void commandArgCallsExecuteSingleCommand() throws Exception { context.withParameter(ConfigurationParameter.OMITTING_UPDATES, "true"); context.withParameter(ConfigurationParameter.COMMAND, "command"); FitNesse fitNesse = mock(FitNesse.class); when(fitNesse.start()).thenReturn(true); context = spy(context); doAnswer(fitNesseContextWith(fitNesse)).when(context).makeFitNesseContext(); int exitCode = new FitNesseMain().launchFitNesse(context); assertThat(exitCode, is(0)); verify(fitNesse, never()).start(); verify(fitNesse, times(1)).executeSingleCommand("command", System.out); verify(fitNesse, times(1)).stop(); }
@Before public void setUp() throws Exception { context = ContextConfigurator.systemDefaults() .withRootPath(".") .withRootDirectoryName("testFitnesseRoot") .withPort(80); }
@Test public void testDirCreations() throws IOException, PluginException { FitNesse fitnesse = context.makeFitNesseContext().fitNesse; fitnesse.start(); try { assertTrue(new File("testFitnesseRoot").exists()); assertTrue(new File("testFitnesseRoot/files").exists()); } finally { fitnesse.stop(); } }