Ok, I noticed i can fix this in the following way:
task integTest2(type: Test) {
useTestNG()
testClassesDir = project.sourceSets.special.output.classesDir
classpath = classpath.plus(files(testClassesDir))
testSrcDirs += project.sourceSets.special.java.srcDirs.toList()
}
This works, but looks quite... stupid. Why do I need to tell the test task, that directory with classes to test should be on the classpath? "Please test classes that are in that directory. Oh, by the way, to load them, try looking in the directory in which they are". Am I doing something wrong?