RenameHandler (MapDataContext context, Class<? extends RenameHandler> handlerClass) { RenameHandlerRegistry registry = RenameHandlerRegistry.getInstance(); Ref<Boolean> selectorWasUsed = Ref.create(false); registry.setRenameHandlerSelectorInTests(all -> { selectorWasUsed.set(true); return ContainerUtil.findInstance(all, handlerClass); }, getTestRootDisposable()); RenameHandler renameHandler = registry.getRenameHandler(context); assertTrue(selectorWasUsed.get()); return renameHandler; }