void (final String path, final String... results) { UIUtil.invokeAndWaitIfNeeded(() -> { try { myFixture.addClass("package org.testng.annotations; public @interface DataProvider {}"); myFixture.addClass("package org.testng.annotations; public @interface Test {}"); myFixture.testCompletionVariants(path + "provider.java", results); } catch (Exception e) { throw new RuntimeException(e); } }); }