@@ -125,18 +125,19 @@ public void testCompletionUsingViewerSelection() throws Exception {
125125 editor .selectAndReveal (0 , 3 );
126126 this .completionShell = openConentAssist ();
127127 final Table completionProposalList = findCompletionSelectionControl (completionShell );
128- waitForProposalRelatedCondition ("Proposal list did not contain expected item: ABC" , completionProposalList ,
128+ waitForProposalRelatedCondition ("Proposal list did not contain expected item ' ABC' " , completionProposalList ,
129129 () -> Arrays .stream (completionProposalList .getItems ()).map (TableItem ::getText ).anyMatch ("ABC" ::equals ), 5_000 );
130130 }
131131
132- private static void waitForProposalRelatedCondition (String errorMessage , Table completionProposalList , BooleanSupplier condition , int timeoutInMsec ) {
133- assertTrue ( errorMessage , new DisplayHelper () {
132+ private static void waitForProposalRelatedCondition (String expectedListContentDescription , Table completionProposalList , BooleanSupplier condition , int timeoutInMsec ) {
133+ boolean result = new DisplayHelper () {
134134 @ Override
135135 protected boolean condition () {
136136 assertFalse ("Completion proposal list was unexpectedly disposed" , completionProposalList .isDisposed ());
137137 return condition .getAsBoolean ();
138138 }
139- }.waitForCondition (completionProposalList .getDisplay (), timeoutInMsec ));
139+ }.waitForCondition (completionProposalList .getDisplay (), timeoutInMsec );
140+ assertTrue (expectedListContentDescription + " but contained: " + Arrays .toString (completionProposalList .getItems ()), result );
140141 }
141142
142143 @ Test
@@ -177,7 +178,7 @@ private Shell openConentAssist(boolean expectShell) {
177178 */
178179 private void checkCompletionContent (final Table completionProposalList ) {
179180 // should be instantaneous, but happens to go asynchronous on CI so let's allow a wait
180- waitForProposalRelatedCondition ("Proposal list did not show two initial items" , completionProposalList ,
181+ waitForProposalRelatedCondition ("Proposal list should show two initial items" , completionProposalList ,
181182 () -> completionProposalList .getItemCount () == 2 , 200 );
182183 assertTrue ("Missing computing info entry" , isComputingInfoEntry (completionProposalList .getItem (0 )));
183184 assertTrue ("Missing computing info entry in proposal list" , isComputingInfoEntry (completionProposalList .getItem (0 )));
@@ -186,16 +187,17 @@ private void checkCompletionContent(final Table completionProposalList) {
186187 assertThat ("Unexpected initial proposal item" ,
187188 BarContentAssistProcessor .PROPOSAL , endsWith (initialProposalString ));
188189 completionProposalList .setSelection (initialProposalItem );
190+
191+ LongRunningBarContentAssistProcessor .finishComputation ();
189192 // asynchronous
190- waitForProposalRelatedCondition ("Proposal list did not show two items after finishing computing" , completionProposalList ,
191- () -> !isComputingInfoEntry (completionProposalList .getItem (0 )) && completionProposalList .getItemCount () == 2 ,
192- LongRunningBarContentAssistProcessor .DELAY + 200 );
193+ waitForProposalRelatedCondition ("Proposal list should contain two items" , completionProposalList ,
194+ () -> !isComputingInfoEntry (completionProposalList .getItem (0 )) && completionProposalList .getItemCount () == 2 , 5000 );
193195 final TableItem firstCompletionProposalItem = completionProposalList .getItem (0 );
194196 final TableItem secondCompletionProposalItem = completionProposalList .getItem (1 );
195197 String firstCompletionProposalText = ((ICompletionProposal )firstCompletionProposalItem .getData ()).getDisplayString ();
196- String secondCOmpletionProposalText = ((ICompletionProposal )secondCompletionProposalItem .getData ()).getDisplayString ();
198+ String secondCompletionProposalText = ((ICompletionProposal )secondCompletionProposalItem .getData ()).getDisplayString ();
197199 assertThat ("Unexpected first proposal item" , BarContentAssistProcessor .PROPOSAL , endsWith (firstCompletionProposalText ));
198- assertThat ("Unexpected second proposal item" , LongRunningBarContentAssistProcessor .PROPOSAL , endsWith (secondCOmpletionProposalText ));
200+ assertThat ("Unexpected second proposal item" , LongRunningBarContentAssistProcessor .PROPOSAL , endsWith (secondCompletionProposalText ));
199201 String selectedProposalString = ((ICompletionProposal )completionProposalList .getSelection ()[0 ].getData ()).getDisplayString ();
200202 assertEquals ("Addition of completion proposal should keep selection" , initialProposalString , selectedProposalString );
201203 }
@@ -221,7 +223,7 @@ public void testCompletionFreeze_bug521484() throws Exception {
221223 this .completionShell =openConentAssist ();
222224 final Table completionProposalList = findCompletionSelectionControl (this .completionShell );
223225 // should be instantaneous, but happens to go asynchronous on CI so let's allow a wait
224- waitForProposalRelatedCondition ("Proposal list did not show two items" , completionProposalList ,
226+ waitForProposalRelatedCondition ("Proposal list should show two items" , completionProposalList ,
225227 () -> completionProposalList .getItemCount () == 2 , 200 );
226228 assertTrue ("Missing computing info entry" , isComputingInfoEntry (completionProposalList .getItem (0 )));
227229 // Some processors are long running, moving cursor can cause freeze (bug 521484)
@@ -230,7 +232,7 @@ public void testCompletionFreeze_bug521484() throws Exception {
230232 emulatePressLeftArrowKey ();
231233 DisplayHelper .sleep (editor .getSite ().getShell ().getDisplay (), 200 ); //give time to process events
232234 long processingDuration = System .currentTimeMillis () - timestamp ;
233- assertTrue ("UI Thread frozen for " + processingDuration + "ms" , processingDuration < LongRunningBarContentAssistProcessor .DELAY );
235+ assertTrue ("UI Thread frozen for " + processingDuration + "ms" , processingDuration < LongRunningBarContentAssistProcessor .TIMEOUT_MSEC );
234236 }
235237
236238 @ Test
0 commit comments