T (@NotNull final PythonConfigurationFactoryBase factory) { final RunnerAndConfigurationSettingsImpl settings = RunManagerImpl.getInstanceImpl(myFixture.getProject()).getConfigurationTemplate(factory); final RunConfiguration configuration = settings.getConfiguration(); assert myExpectedConfigurationType.isAssignableFrom(configuration.getClass()) : "Wrong configuration created. Wrong factory?"; @SuppressWarnings("unchecked") //Checked one line above final T typedConfig = (T)configuration; return typedConfig; }