Skip to content

Commit a022116

Browse files
Christopher-HermannBeckerWdf
authored andcommitted
StickyScrollingHandlerTest: Improve expectation to the throttler
The calls to the lines provider should be throttled. Expect at least one call and at most 3 calls. Fixes: #2190
1 parent 859c687 commit a022116

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/org.eclipse.ui.editors.tests/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingHandlerTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
import static org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH;
2121
import static org.junit.Assert.assertEquals;
2222
import static org.junit.Assert.assertTrue;
23+
import static org.mockito.Mockito.atLeastOnce;
24+
import static org.mockito.Mockito.atMost;
2325
import static org.mockito.Mockito.mock;
24-
import static org.mockito.Mockito.times;
2526
import static org.mockito.Mockito.verify;
2627
import static org.mockito.Mockito.when;
2728

@@ -159,8 +160,10 @@ public void testThrottledExecution() throws InterruptedException {
159160

160161
waitInUi(300);
161162

162-
// Call to lines provider should be throttled
163-
verify(linesProvider, times(2)).getStickyLines(sourceViewer, stickyLinesProperties);
163+
// Call to lines provider should be throttled, at least one and at most
164+
// 3 calls expected
165+
verify(linesProvider, atMost(3)).getStickyLines(sourceViewer, stickyLinesProperties);
166+
verify(linesProvider, atLeastOnce()).getStickyLines(sourceViewer, stickyLinesProperties);
164167
}
165168

166169
private void waitInUi(int ms) throws InterruptedException {

0 commit comments

Comments
 (0)