### Question:
PercentageComponent implements StatusBarComponent { public void progress(double percentage) { this.percentage.set(percentage); }  void progress(double percentage); @Override String render();  }### Answer:
@Test public void doesPrintProgressInAppropriateFormat() { StatusBar.enable(); percentageComponent.progress(0.0); progressUpdateCall.get().run(); percentageComponent.progress(0.675); statusBar.finish(); String result = getResultWithNewLinesInsteadOfCR(); assertThat(result, containsString("67.5%")); }
@Test public void doesLimitProgressTo100Percent() { StatusBar.enable(); percentageComponent.progress(-0.7); progressUpdateCall.get().run(); percentageComponent.progress(1.5); statusBar.finish(); String result = getResultWithNewLinesInsteadOfCR(); String[] lines = result.split("\n"); assertThat(lines[1], containsString("0.0%")); assertThat(lines[2], containsString("100.0%")); }