Home / Class/ TotalProgressBarTests Class — spring-boot Architecture

TotalProgressBarTests Class — spring-boot Architecture

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

Entity Profile

Source Code

buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/TotalProgressBarTests.java lines 31–85

class TotalProgressBarTests {

	@Test
	void withPrefixAndBookends() {
		TestPrintStream out = new TestPrintStream();
		TotalProgressBar bar = new TotalProgressBar("prefix:", '#', true, out);
		assertThat(out).hasToString("prefix: [ ");
		bar.accept(new TotalProgressEvent(10));
		assertThat(out).hasToString("prefix: [ #####");
		bar.accept(new TotalProgressEvent(50));
		assertThat(out).hasToString("prefix: [ #########################");
		bar.accept(new TotalProgressEvent(100));
		assertThat(out).hasToString(String.format("prefix: [ ################################################## ]%n"));
	}

	@Test
	void withoutPrefix() {
		TestPrintStream out = new TestPrintStream();
		TotalProgressBar bar = new TotalProgressBar(null, '#', true, out);
		assertThat(out).hasToString("[ ");
		bar.accept(new TotalProgressEvent(10));
		assertThat(out).hasToString("[ #####");
		bar.accept(new TotalProgressEvent(50));
		assertThat(out).hasToString("[ #########################");
		bar.accept(new TotalProgressEvent(100));
		assertThat(out).hasToString(String.format("[ ################################################## ]%n"));
	}

	@Test
	void withoutBookends() {
		TestPrintStream out = new TestPrintStream();
		TotalProgressBar bar = new TotalProgressBar("", '.', false, out);
		assertThat(out).hasToString("");
		bar.accept(new TotalProgressEvent(10));
		assertThat(out).hasToString(".....");
		bar.accept(new TotalProgressEvent(50));
		assertThat(out).hasToString(".........................");
		bar.accept(new TotalProgressEvent(100));
		assertThat(out).hasToString(String.format("..................................................%n"));
	}

	static class TestPrintStream extends PrintStream {

		TestPrintStream() {
			super(new ByteArrayOutputStream());
		}

		@Override
		public String toString() {
			return this.out.toString();
		}

	}

}

Analyze Your Own Codebase

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

Try Supermodel Free