### Question:
ProgressHandler { public void postIndeterminate() { postValue(-1.0); } ProgressHandler(AbstractTask<?> t,
            double begin,
            double end,
            int steps);  ProgressHandler(AbstractTask<?> t, int steps);  ProgressHandler(final AbstractTask<?> task,
        final double begin, 
        final double end);  ProgressHandler(AbstractTask<?> t); void setMinProgressIncrement(final double minInc); void setMinTimeIncrement(final long ms); void postMessage(final String msg); void postFraction(final double fraction); void postStep(); void postSteps(final int steps); void postEnd(); void postIndeterminate(); void subsection(final double fraction); void subsection(final double fraction, final int steps); void subsection(final int steps); void subsection(); void postBegin(); double getCurrentProgress(); static final double DEFAULT_START_VALUE; static final double DEFAULT_END_VALUE; static final double DEFAULT_MIN_PROGRESS_INC; static final long DEFAULT_MIN_TIME_INC; }### Answer:
@Test public void testPostIndeterminate() throws InterruptedException { final int loops = 10; Task<Void> task = new AbstractTask<Void> () { @Override protected Void doTask() throws Exception { ProgressHandler ph = new ProgressHandler(this, 0.0, 1.0); ph.postBegin(); for (int i=0; i<loops; i++) { ph.postIndeterminate(); } ph.postEnd(); return null; } @Override public String taskName() { return "testPostIndeterminate() task"; } }; final AtomicInteger numIndeterminates = new AtomicInteger(); task.addTaskListener(new TaskAdapter() { @Override public void taskProgress(TaskEvent evt) { if (evt.getProgress() == -1.0) { numIndeterminates.incrementAndGet(); } } }); Thread t = new Thread(task); t.start(); t.join(); assertThat(numIndeterminates.get(), is(equalTo(1))); }