void (ConfigurationFromContext configuration, @NotNull ConfigurationContext context, @NotNull Runnable startRunnable) { JavaTestEntity testEntity = TestNgKotlinTestFrameworkProvider.getInstance() .getJavaTestEntity(configuration.getSourceElement(), true); if (testEntity == null) { super.onFirstRun(configuration, context, startRunnable); return; } final PsiNamedElement lightElement = testEntity.getTestMethod() != null ? testEntity.getTestMethod() : testEntity.getTestClass(); ConfigurationFromContext delegate = new ConfigurationFromContext() { @Override public @NotNull RunnerAndConfigurationSettings getConfigurationSettings() { return configuration.getConfigurationSettings(); } @Override public void setConfigurationSettings(RunnerAndConfigurationSettings configurationSettings) { configuration.setConfigurationSettings(configurationSettings); } @Override public @NotNull PsiElement getSourceElement() { return lightElement; } }; new AbstractInClassConfigurationProducer<TestNGConfiguration>() { @Override public @NotNull ConfigurationFactory getConfigurationFactory() { return TestNGConfigurationType.getInstance(); } }.onFirstRun(delegate, context, startRunnable); }