Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

classname for JUnit configuration doesn't work #92

Open
vitgorbunov opened this issue Oct 24, 2019 · 1 comment · May be fixed by #138
Open

classname for JUnit configuration doesn't work #92

vitgorbunov opened this issue Oct 24, 2019 · 1 comment · May be fixed by #138

Comments

@vitgorbunov
Copy link

Here is script example
I specify foo.Test in className, but in generated configuration class is empty

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.7"
  }
}

apply plugin: "org.jetbrains.gradle.plugin.idea-ext"

import org.jetbrains.gradle.ext.*

idea.project.settings {
  runConfigurations {
    "Simulation"(JUnit) {
        className = 'foo.Test'
    }
  }
}
@SquidDev
Copy link

This map entry should be "class" instead of "className" (see JUnitRunConfigurationImporter):

I'm working around this by subclassing JUnit to add the correct entry:

open class JUnitExt @Inject constructor(nameParam: String) : JUnit(nameParam) {
    override fun toMap(): MutableMap<String, *> {
        val map = HashMap(super.toMap())
        map["class"] = className
        return map
    }
}

ideaProject.settings.runConfigurations {
    registerFactory(JUnitExt::class.java) { name -> project.objects.newInstance(JUnitExt::class.java, name) }
}

@SquidDev SquidDev linked a pull request Jan 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants