### Question:
AbstractTask implements Task<V> { @Override public void setProgressEndpoints(double begin, double end) { if (Double.isNaN(begin) || Double.isNaN(end) || begin < 0.0 || (begin > end)) { throw new IllegalArgumentException( "invalid progress endpoints (begin == " + begin + ", end == " + end + ")"); } if (hasBegun.get()) { throw new IllegalStateException( "endpoints must be set before running the AbstractTask" ); } else { beginProgress = begin; endProgress = end; } }  @Override void addTaskListener(TaskListener l); @Override void removeTaskListener(TaskListener l); @Override void setProgressEndpoints(double begin, double end); double getBeginProgress(); double getEndProgress(); @Override V get(); @Override V get(long timeout, TimeUnit unit); boolean isPaused(); synchronized void pause(); synchronized void play(); void reset(); final void run(); boolean cancel(boolean mayInterruptIfRunning); @Override /** * This version is mandated by the Future<V> interface. */ boolean isCancelled(); boolean isDone(); String getErrorMessage(); Throwable getError(); double getProgress(); boolean isBegun(); boolean isEnded(); final TaskOutcome getTaskOutcome();  }### Answer:
@Test public void testSetProgressEndpoints() throws InterruptedException { System.out.println("setProgressEndpoints"); TestTaskListener l = new TestTaskListener(); AbstractTask instance = new CapitalizeStringTask("a string to capitalize"); instance.setProgressEndpoints(0.25, 0.75); instance.addTaskListener(l); Thread t = new Thread(instance); t.start(); t.join(); assertThat(l.minProgress(), is(0.25)); assertThat(l.maxProgress(), is(0.75)); }
@Test(expected = IllegalArgumentException.class) public void testSetProgressEndpointBeginLessThanZero() { AbstractTask instance = new CapitalizeStringTask("a string to capitalize"); instance.setProgressEndpoints(-0.25, 1.0); }
@Test(expected = IllegalArgumentException.class) public void testSetProgressEndpointEndLessThanBegin() { AbstractTask instance = new CapitalizeStringTask("a string to capitalize"); instance.setProgressEndpoints(0.75, 0.5); }
@Test(expected = IllegalArgumentException.class) public void testSetProgressEndpointsWithNaNs() { AbstractTask instance = new CapitalizeStringTask("a string to capitalize"); instance.setProgressEndpoints(Double.NaN, Double.NaN); }