void () { ExtensionPointImpl<@NotNull Integer> extensionPoint = buildExtensionPoint(Integer.class); extensionPoint.registerExtension(4, disposable); extensionPoint.registerExtension(2, disposable); Integer[] extensions = extensionPoint.getExtensions(); assertThat(extensions).containsExactly(4, 2); Arrays.sort(extensions); assertThat(extensions).containsExactly(2, 4); assertThat(extensionPoint.getExtensionList()).containsExactly(4, 2); Function<Integer, String> f = it -> "foo"; assertThat(ExtensionProcessingHelper.INSTANCE.getByGroupingKey(extensionPoint, f.getClass(), "foo", f)).isEqualTo( extensionPoint.getExtensionList()); assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, ExtensionPointImplTest.class, Function.identity(), Function.identity())).isEqualTo(2); Function<Integer, Integer> f2 = (Integer it) -> it * 2; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, f2.getClass(), Function.identity(), f2)).isEqualTo(4); Function<Integer, Integer> filteringKeyMapper = it -> it < 3 ? it : null; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 2, filteringKeyMapper.getClass(), filteringKeyMapper, Function.identity())).isEqualTo(2); assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 4, filteringKeyMapper.getClass(), filteringKeyMapper, Function.identity())).isNull(); Function<@NotNull Integer, @Nullable Integer> f3 = (Integer it) -> (Integer)null; assertThat(ExtensionProcessingHelper.INSTANCE.getByKey(extensionPoint, 4, f3.getClass(), Function.identity(), f3)).isNull(); }