/** * Tests the {@link TaskMonitor#monitor(Task)} and * {@link TaskMonitor#finish(Task)} implementation to fire corresponding * events during task monitoring for property {@code progressDescription}. */ public void testProgressDescriptionMonitoring() throws Exception { assert this.getTaskMonitor() != null; final Task task = new Task(); final TestTaskListener listener = new TestTaskListener( task ); final TestMessage progressDescription = new TestMessage(); task.setDescription( new TestMessage() ); task.setProgressDescription( progressDescription ); this.getTaskEventSource().addTaskListener( listener ); task.setIndeterminate( true ); this.getTaskMonitor().monitor( task ); for ( int i = 2; i > 0; i-- ) { Thread.currentThread().sleep( 1000 ); progressDescription.setText( Integer.toString( i ) ); } this.getTaskMonitor().finish( task ); Assert.assertTrue( listener.getStartTime() > 0 ); Assert.assertTrue( listener.getEndTime() > 0 ); Assert.assertTrue( listener.getChangedState() ); }