### Question:
ProgressHandler { public void setMinTimeIncrement(final long ms) { minTimeInc = ms; } 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 testSetMinTimeIncrement() throws InterruptedException { TestTask testTask = new TestTask(0.0, 1.0, 10); testTask.setTotalTimeToDoTask(100L, TimeUnit.MILLISECONDS); testTask.getProgressHandler().setMinTimeIncrement(25L); testTask.getProgressHandler().setMinProgressIncrement(5.0); final AtomicReference<Long> lastProgressReceived = new AtomicReference<>(); final List<Long> timeBetweenPosts = new ArrayList<>(); testTask.addTaskListener(new TaskAdapter() { @Override public void taskProgress(TaskEvent evt) { long now = System.currentTimeMillis(); Long lastTimeReceived = lastProgressReceived.getAndSet(now); if (lastTimeReceived != null) { Long timeBetween = now - lastTimeReceived; timeBetweenPosts.add(timeBetween); } } }); Thread t = new Thread(testTask); t.start(); t.join(); for (int i=0; i<timeBetweenPosts.size()-1; i++) { long ms = timeBetweenPosts.get(i); assertTrue("timeBetweenPosts(" + i + ") is too small: " + ms, ms >= 25L); } }