Skip to content

Commit 8265f2e

Browse files
committed
Test "empty" Task behavior
1 parent 4d594ab commit 8265f2e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

scijava-progress/src/test/java/org/scijava/progress/DefaultProgressTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ public void testUpdateWithoutDefinition() {
7070
Assertions.assertTrue(listener.isComplete());
7171
}
7272

73+
/**
74+
* Tests "empty" {@link Task}s.
75+
*/
76+
@Test
77+
public void testEmptyProgress() {
78+
Supplier<Long> progressible = () -> {
79+
Progress.defineTotal(0);
80+
return 0L;
81+
};
82+
// Add the ProgressListener
83+
var listener = new TestSuiteProgressListener(0);
84+
Progress.addListener(progressible, listener);
85+
// Register the Task
86+
Progress.register(progressible);
87+
// Run the Task
88+
progressible.get();
89+
// Complete the Task
90+
Progress.complete();
91+
Assertions.assertTrue(listener.isComplete());
92+
}
93+
7394
/**
7495
* Tests progress listening on a simple task with only one processing stage
7596
* and no dependencies.

0 commit comments

Comments
 (0)