@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(); }