void () { ExtensionsAreaImpl extensionsArea = new ExtensionsAreaImpl(new ExtensionPointImplTest.MyComponentManager()); extensionsArea.registerExtensionPoint("ep1", TestExtensionClassOne.class.getName(), ExtensionPoint.Kind.BEAN_CLASS, false); registerExtension(extensionsArea, "", "<extension point=\"ep1\" id=\"_7\" order=\"LAST\"><text>7</text></extension>"); registerExtension(extensionsArea, "", "<extension point=\"ep1\" id=\"fst\" order=\"FIRST\"><text>1</text></extension>"); registerExtension(extensionsArea, "", "<extension point=\"ep1\" id=\"id\"><text>3</text></extension>"); ExtensionPoint<TestExtensionClassOne> extensionPoint = extensionsArea.getExtensionPoint("ep1"); TestExtensionClassOne[] extensions = extensionPoint.getExtensions(); assertEquals(3, extensions.length); assertEquals("1", extensions[0].getText()); assertEquals("3", extensions[1].getText()); assertEquals("7", extensions[2].getText()); TestExtensionClassOne extension = new TestExtensionClassOne("xxx"); Disposable disposable2 = Disposer.newDisposable(); extensionPoint.registerExtension(extension, disposable2); Disposer.dispose(disposable2); //noinspection UnusedAssignment disposable2 = null; registerExtension(extensionsArea, "", "<extension point=\"ep1\" order=\"BEFORE id\"><text>2</text></extension>"); registerExtension(extensionsArea, "", "<extension point=\"ep1\" order=\"AFTER id\"><text>4</text></extension>"); registerExtension(extensionsArea, "", "<extension point=\"ep1\" order=\"last, after _7\"><text>8</text></extension>"); registerExtension(extensionsArea, "", "<extension point=\"ep1\" order=\"after:id, before _7, after fst\"><text>5</text></extension>"); extensionPoint.registerExtension(new TestExtensionClassOne("6"), disposable); extensions = extensionPoint.getExtensions(); assertEquals(8, extensions.length); assertEquals("1", extensions[0].getText()); assertEquals("2", extensions[1].getText()); assertEquals("3", extensions[2].getText()); assertTrue("4".equals(extensions[3].getText()) || "5".equals(extensions[3].getText()) ); assertTrue("4".equals(extensions[4].getText()) || "5".equals(extensions[4].getText()) ); assertEquals("6", extensions[5].getText()); assertEquals("7", extensions[6].getText()); assertEquals("8", extensions[7].getText()); }