Commands { public ExitCode listPlugins(final ConfigOptions configOptions) { final CommandlineConfig config = getConfig(configOptions); config.getPlugins().forEach(LOGGER::info); return ExitCode.NO_ERROR; } Commands(final Path allureHome); CommandlineConfig getConfig(final ConfigOptions configOptions); Optional<Path> getConfigFile(final ConfigOptions configOptions); String getConfigFileName(final String profile); ExitCode generate(final Path reportDirectory,
                             final List<Path> resultsDirectories,
                             final boolean clean,
                             final ConfigOptions profile); ExitCode serve(final List<Path> resultsDirectories,
                          final String host,
                          final int port,
                          final ConfigOptions configOptions); ExitCode open(final Path reportDirectory, final String host, final int port); ExitCode listPlugins(final ConfigOptions configOptions);  }
@Test void shouldNotFailWhenListPluginsWithoutConfig(@TempDir final Path home) { final Commands commands = new Commands(home); final ConfigOptions options = mock(ConfigOptions.class); when(options.getProfile()).thenReturn("some-profile"); final ExitCode exitCode = commands.listPlugins(options); assertThat(exitCode) .isEqualTo(ExitCode.NO_ERROR); }
@Test void shouldListPlugins(@TempDir final Path home) throws Exception { createConfig(home, "allure-test.yml"); final ConfigOptions options = mock(ConfigOptions.class); when(options.getProfile()).thenReturn("test"); final Commands commands = new Commands(home); final ExitCode exitCode = commands.listPlugins(options); assertThat(exitCode) .isEqualTo(ExitCode.NO_ERROR); }