Home / Class/ CommandRunnerIntegrationTests Class — spring-boot Architecture

CommandRunnerIntegrationTests Class — spring-boot Architecture

Architecture documentation for the CommandRunnerIntegrationTests class in CommandRunnerIntegrationTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

cli/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerIntegrationTests.java lines 33–76

class CommandRunnerIntegrationTests {

	@BeforeEach
	void clearDebug() {
		System.clearProperty("debug");
	}

	@Test
	void debugEnabledAndArgumentRemovedWhenNotAnApplicationArgument() {
		CommandRunner runner = new CommandRunner("spring");
		ArgHandlingCommand command = new ArgHandlingCommand();
		runner.addCommand(command);
		runner.runAndHandleErrors("args", "samples/app.groovy", "--debug");
		assertThat(command.args).containsExactly("samples/app.groovy");
		assertThat(System.getProperty("debug")).isEqualTo("true");
	}

	@Test
	void debugNotEnabledAndArgumentRetainedWhenAnApplicationArgument() {
		CommandRunner runner = new CommandRunner("spring");
		ArgHandlingCommand command = new ArgHandlingCommand();
		runner.addCommand(command);
		runner.runAndHandleErrors("args", "samples/app.groovy", "--", "--debug");
		assertThat(command.args).containsExactly("samples/app.groovy", "--", "--debug");
		assertThat(System.getProperty("debug")).isNull();
	}

	static class ArgHandlingCommand extends AbstractCommand {

		private String @Nullable [] args;

		ArgHandlingCommand() {
			super("args", "");
		}

		@Override
		public ExitStatus run(String... args) throws Exception {
			this.args = args;
			return ExitStatus.OK;
		}

	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free