SearchCoverage { public Double getMinWaitAfterCoverageFactor() { return minWaitAfterCoverageFactor; } private  SearchCoverage(Builder builder); Double getMinimum(); Double getMinWaitAfterCoverageFactor(); Double getMaxWaitAfterCoverageFactor();  }
@Test public void requireThatInvalidMinWaitAfterCoverageFactorCanNotBeSet() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMinWaitAfterCoverageFactor(0.5); assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); try { coverage.setMinWaitAfterCoverageFactor(-0.5); fail(); } catch (IllegalArgumentException e) { assertEquals("Expected value in range [0, 1], got -0.5.", e.getMessage()); } assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); try { coverage.setMinWaitAfterCoverageFactor(1.5); fail(); } catch (IllegalArgumentException e) { assertEquals("Expected value in range [0, 1], got 1.5.", e.getMessage()); } assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); }
@Test public void requireThatMinWaitCanNotBeSetLargerThanMaxWait() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMaxWaitAfterCoverageFactor(0.5); coverage.setMinWaitAfterCoverageFactor(0.4); assertEquals(0.4, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); coverage.setMinWaitAfterCoverageFactor(0.5); assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); try { coverage.setMinWaitAfterCoverageFactor(0.6); fail(); } catch (IllegalArgumentException e) { assertEquals("Minimum wait (got 0.6) must be no larger than maximum wait (was 0.5).", e.getMessage()); } assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); }