Skip to content

Commit 84a0699

Browse files
committed
Streamline [JST]PipelineTest
1 parent 2d8e3e7 commit 84a0699

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/PipelineTest.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,20 @@ public PipelineTest() {
4040
@Test
4141
public void testNavigatorResourceJava() throws Exception {
4242

43+
String[] exts = { COMMON_NAVIGATOR_RESOURCE_EXT, COMMON_NAVIGATOR_JAVA_EXT };
4344
assertEquals(
4445
"There should be no visible extensions for the pipeline viewer.",
4546
0, _contentService.getVisibleExtensionIds().length);
4647

47-
_contentService.bindExtensions(new String[] {
48-
COMMON_NAVIGATOR_RESOURCE_EXT, COMMON_NAVIGATOR_JAVA_EXT },
49-
false);
48+
_contentService.bindExtensions(exts, false);
5049

5150
// Note this test will fail showing only one if the JDT stuff
5251
// is not included in the executing bundles (which it normally is)
5352
assertEquals(
5453
"There should be two visible extensions for the pipeline viewer.",
5554
2, _contentService.getVisibleExtensionIds().length);
5655

57-
_contentService.getActivationService().activateExtensions(
58-
new String[] { COMMON_NAVIGATOR_RESOURCE_EXT,
59-
COMMON_NAVIGATOR_JAVA_EXT }, true);
56+
_contentService.getActivationService().activateExtensions(exts, true);
6057

6158
refreshViewer();
6259

@@ -100,8 +97,7 @@ public void testNavigatorResourceJava() throws Exception {
10097

10198
boolean found = false;
10299
for (int i = 0; i < rootItems.length && !found; i++) {
103-
if (rootItems[i].getData() instanceof IProject) {
104-
IProject newProjectFromTree = (IProject) rootItems[i].getData();
100+
if (rootItems[i].getData() instanceof IProject newProjectFromTree) {
105101
if (newProject.equals(newProjectFromTree))
106102
found = true;
107103
}
@@ -112,12 +108,9 @@ public void testNavigatorResourceJava() throws Exception {
112108
// Make sure problems in bad extension points are reported well
113109
@Test
114110
public void testInterceptAddThrow() throws Exception {
115-
_contentService.bindExtensions(new String[] {
116-
COMMON_NAVIGATOR_RESOURCE_EXT, TEST_CONTENT_RESOURCE_OVERRIDE},
117-
false);
118-
_contentService.getActivationService().activateExtensions(
119-
new String[] { COMMON_NAVIGATOR_RESOURCE_EXT,
120-
TEST_CONTENT_RESOURCE_OVERRIDE }, true);
111+
String[] exts = { COMMON_NAVIGATOR_RESOURCE_EXT, TEST_CONTENT_RESOURCE_OVERRIDE };
112+
_contentService.bindExtensions(exts, false);
113+
_contentService.getActivationService().activateExtensions(exts, true);
121114

122115
refreshViewer();
123116

@@ -137,12 +130,9 @@ public void testInterceptAddThrow() throws Exception {
137130

138131
private void testHasNoChildrenOverride(boolean hasChildren) throws Exception {
139132
TestContentProviderNoChildren._hasChildrenTrue = hasChildren;
140-
_contentService.bindExtensions(new String[] {
141-
COMMON_NAVIGATOR_RESOURCE_EXT, TEST_CONTENT_NO_CHILDREN},
142-
false);
143-
_contentService.getActivationService().activateExtensions(
144-
new String[] { COMMON_NAVIGATOR_RESOURCE_EXT,
145-
TEST_CONTENT_NO_CHILDREN }, true);
133+
String[] exts = { COMMON_NAVIGATOR_RESOURCE_EXT, TEST_CONTENT_NO_CHILDREN };
134+
_contentService.bindExtensions(exts, false);
135+
_contentService.getActivationService().activateExtensions(exts, true);
146136

147137
refreshViewer();
148138

tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/jst/JstPipelineTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,15 @@ public void setUp() {
5858
*/
5959
@Test
6060
public void testJstPipeline() throws Exception {
61-
62-
_contentService.bindExtensions(
63-
new String[] { COMMON_NAVIGATOR_RESOURCE_EXT, COMMON_NAVIGATOR_JAVA_EXT, TEST_CONTENT_JST }, false);
61+
String[] exts = { COMMON_NAVIGATOR_RESOURCE_EXT, COMMON_NAVIGATOR_JAVA_EXT, TEST_CONTENT_JST };
62+
_contentService.bindExtensions(exts, false);
6463

6564
// Note this test will fail showing only one if the JDT stuff
6665
// is not included in the executing bundles (which it normally is)
6766
assertEquals("There should be 3 visible extensions for the pipeline viewer.", 3,
6867
_contentService.getVisibleExtensionIds().length);
6968

70-
_contentService.getActivationService().activateExtensions(
71-
new String[] { COMMON_NAVIGATOR_RESOURCE_EXT, COMMON_NAVIGATOR_JAVA_EXT, TEST_CONTENT_JST }, true);
69+
_contentService.getActivationService().activateExtensions(exts, true);
7270

7371
refreshViewer();
7472

0 commit comments

Comments
 (0)