@RunWith(Class1.class)
public class Class1 extends Suite {
....
}
public class ClassRunners {
@RunWith(Runner1.class)
public class Runner1 extends Class1 {
.....
}
@RunWith(Runner2.class)
public class Runner2 extends Class1 {
.....
}
}
In my gradle test task I am trying to include the inner classes. But it does not look like it picks the inner classes:
task sharedServerTests(type: Test, description: 'Run tests') {
include "**/Runner1.class"
include "**/Runner2.class"
}
Initially I had the Runners as separate classes in their own files. That worked perfectly fine, but I wanted to enclose them in a separate class to make the directory cleaner since I have 16 such classes.
Am I missing something? Is this the right way to include an inner class: include “**/Runner2.class”? Is it possible to include the inner classes or do I have to have them as separate files?
I don’t claim to know much about this topic but if you look at the compiled classes they will be something like **/ClassRunners$Runner1.class
Also, its possible/likely that the inner classes need to be declared public static class RunnerN or you won’t be able to create an instance of Runner1 without first creating an instance of ClassRunners
I changed the inner classes to be static. When I look at the compiled classes. It still only shows the ClassRunners.class. Shouldn’t the .class files for the nested classes be generated as well? I don’t know why they do not get generated. The only change is that the compiled class has the following:
public class ClassRunners {
@RunWith(ClassRunners.Runner1.class)
public static class Runner1 extends Class1 {
.....
}
@RunWith(ClassRunners.Runner2.class)
public static class Runner2 extends Class1 {
.....
}
}
I recompiled and tried to do both :
include “**/ClassRunners.Runner2.class”
include “**/ClassRunners\$Runner2.class”
None seem to pick the classes. Does gradle expect a separate class file for each of the classes to be included?
EDIT: I do not see the classes in intellij. But when I tried to find the classes on the terminal, they do exist. But gradle does not seem to recognize these classes.