Can't use inner classes for JUnit Categories

I am unable to use inner classes as categories. I’m not sure if this is a known or expected limitation. At first blush it looks like a classpath issue, but let me tell ya, I spent a looong time trying to debug this one.

Please see the example project here: https://github.com/UnquietCode/GradleJUnitCategories

Whether support is added or not, a note in the Gradle docs under “Java Plugin -> Test grouping” would much appreciated. Thanks all!

---- EDIT : it seems that using the ‘Outer$Inner’ notation does work, which is an acceptable workaround. A note in the docs would suffice to steer people in the right direction.

I think the problem is how you are declaring it

test {
 useJUnit {
  includeCategories 'com.test.TestCategory.CategoryA'
 }
}

You’ll probably have to use the reflective name:

test {
 useJUnit {
  includeCategories 'com.test.TestCategory$CategoryA'
 }
}

The Outer$Inner works.

task functionalTest ( type:Test, dependsOn: “test”) {

useJUnit {

includeCategories = [‘TestCategories$Functional’] as Set

} }