@@ -76,7 +76,7 @@ public void doSetUp() throws CoreException, IOException {
76
76
}
77
77
78
78
@ Test
79
- public void testNavigationHistoryNavigation () {
79
+ public void testNavigationHistoryNavigation () throws PartInitException {
80
80
IIntroPart introPart = PlatformUI .getWorkbench ().getIntroManager ().getIntro ();
81
81
PlatformUI .getWorkbench ().getIntroManager ().closeIntro (introPart );
82
82
@@ -91,39 +91,33 @@ public void testNavigationHistoryNavigation() {
91
91
92
92
openGenericEditor (editorInput );
93
93
94
- if (!processEventsUntil (genericEditorNoSelection , 1000 )) {
95
- fail ("Timeout during navigation." + getStateDetails ());
96
- }
94
+ assertTrue ("Timeout during navigation." + getStateDetails (),
95
+ processEventsUntil (genericEditorNoSelection , 1000 ));
97
96
98
97
selectInGenericEditor (editorInput );
99
98
100
- if (!processEventsUntil (genericEditorSelection , 1000 )) {
101
- fail ("Timeout during navigation." + getStateDetails ());
102
- }
99
+ assertTrue ("Timeout during navigation." + getStateDetails (),
100
+ processEventsUntil (genericEditorSelection , 1000 ));
103
101
104
102
openTextEditor (editorInput );
105
103
106
- if (!processEventsUntil (textEditorNoSelection , 1000 )) {
107
- fail ("Timeout during navigation." + getStateDetails ());
108
- }
104
+ assertTrue ("Timeout during navigation." + getStateDetails (),
105
+ processEventsUntil (textEditorNoSelection , 1000 ));
109
106
110
107
selectInTextEditor (editorInput );
111
108
112
- if (!processEventsUntil (textEditorSelection , 1000 )) {
113
- fail ("Timeout during navigation." + getStateDetails ());
114
- }
109
+ assertTrue ("Timeout during navigation." + getStateDetails (),
110
+ processEventsUntil (textEditorSelection , 1000 ));
115
111
116
112
openGenericEditor (editorInput );
117
113
118
- if (!processEventsUntil (genericEditorSelection , 1000 )) {
119
- fail ("Timeout during navigation." + getStateDetails ());
120
- }
114
+ assertTrue ("Timeout during navigation." + getStateDetails (),
115
+ processEventsUntil (genericEditorSelection , 1000 ));
121
116
122
117
openTextEditor (editorInput );
123
118
124
- if (!processEventsUntil (textEditorSelection , 1000 )) {
125
- fail ("Timeout during navigation." + getStateDetails ());
126
- }
119
+ assertTrue ("Timeout during navigation." + getStateDetails (),
120
+ processEventsUntil (textEditorSelection , 1000 ));
127
121
128
122
// Navigate backward from text editor to editor
129
123
goBackward (EditorTestHelper .getActiveWorkbenchWindow (), genericEditorSelection );
@@ -184,58 +178,38 @@ private Condition currentNavigationHistoryLocationCondition(String editorId, boo
184
178
};
185
179
}
186
180
187
- private void openGenericEditor (IEditorInput editorInput ) {
188
- try {
189
- EditorTestHelper .getActivePage ().openEditor (editorInput , GENERIC_EDITOR_ID , true ,
190
- IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
191
- } catch (PartInitException e ) {
192
- fail ("Should not throw an exception" );
193
- }
181
+ private void openGenericEditor (IEditorInput editorInput ) throws PartInitException {
182
+ EditorTestHelper .getActivePage ().openEditor (editorInput , GENERIC_EDITOR_ID , true ,
183
+ IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
194
184
}
195
185
196
- private void selectInGenericEditor (IEditorInput editorInput ) {
197
- try {
198
- AbstractTextEditor editor = (AbstractTextEditor ) EditorTestHelper .getActivePage ().openEditor (editorInput ,
199
- GENERIC_EDITOR_ID , true , IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
200
- editor .selectAndReveal (10 , 5 );
201
- } catch (PartInitException e ) {
202
- fail ("Should not throw an exception" );
203
- }
186
+ private void selectInGenericEditor (IEditorInput editorInput ) throws PartInitException {
187
+ AbstractTextEditor editor = (AbstractTextEditor ) EditorTestHelper .getActivePage ().openEditor (editorInput ,
188
+ GENERIC_EDITOR_ID , true , IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
189
+ editor .selectAndReveal (10 , 5 );
204
190
}
205
191
206
- private void selectInTextEditor (IEditorInput editorInput ) {
207
- try {
208
- AbstractTextEditor editor = (AbstractTextEditor ) EditorTestHelper .getActivePage ().openEditor (editorInput ,
209
- TEXT_EDITOR_ID , true , IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
210
- editor .selectAndReveal (10 , 5 );
211
- } catch (PartInitException e ) {
212
- fail ("Should not throw an exception" );
213
- }
192
+ private void selectInTextEditor (IEditorInput editorInput ) throws PartInitException {
193
+ AbstractTextEditor editor = (AbstractTextEditor ) EditorTestHelper .getActivePage ().openEditor (editorInput ,
194
+ TEXT_EDITOR_ID , true , IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
195
+ editor .selectAndReveal (10 , 5 );
214
196
}
215
197
216
- private void openTextEditor (IEditorInput editorInput ) {
217
- try {
218
- EditorTestHelper .getActivePage ().openEditor (editorInput , TEXT_EDITOR_ID , true ,
219
- IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
220
- } catch (PartInitException e ) {
221
- fail ("Should not throw an exception" );
222
- }
198
+ private void openTextEditor (IEditorInput editorInput ) throws PartInitException {
199
+ EditorTestHelper .getActivePage ().openEditor (editorInput , TEXT_EDITOR_ID , true ,
200
+ IWorkbenchPage .MATCH_ID | IWorkbenchPage .MATCH_INPUT );
223
201
}
224
202
225
203
private void goForward (IWorkbenchWindow window , Condition condition ) {
226
204
NavigationHistoryAction action = new NavigationHistoryAction (window , true );
227
205
action .run ();
228
- if (!processEventsUntil (condition , 1000 )) {
229
- fail ("Timeout during navigation." );
230
- }
206
+ assertTrue ("Timeout during navigation." , processEventsUntil (condition , 1000 ));
231
207
}
232
208
233
209
private void goBackward (IWorkbenchWindow window , Condition condition ) {
234
210
NavigationHistoryAction action = new NavigationHistoryAction (window , false );
235
211
action .run ();
236
- if (!processEventsUntil (condition , 1000 )) {
237
- fail ("Timeout during navigation." );
238
- }
212
+ assertTrue ("Timeout during navigation." , processEventsUntil (condition , 1000 ));
239
213
}
240
214
241
215
private String getActiveEditorId () {
0 commit comments