Buggy code:
@ Incubating public class PlayApplicationPlugin implements Plugin < ProjectInternal > { private static final String DEFAULT_PLAY_VERSION = "2.3.5" ; public static final int DEFAULT_HTTP_PORT = 9000 ; public void apply ( final ProjectInternal project ) { } @ SuppressWarnings ( "UnusedDeclaration" ) @ RuleSource static class Rules { @ Model void playPlatforms ( ManagedSet < PlayPlatformInternal > playPlatforms ) { } @ Mutate void addPlatforms ( ManagedSet < PlayPlatformInternal > platforms ) { } @ Model PlayToolChainInternal playToolChain ( ServiceRegistry serviceRegistry ) { } private void initializePlatform ( PlayPlatformInternal platform , String playVersion , String scalaVersion , String twirlVersion ) { } @ Mutate public void addPlayPlatformsToPlatformContainer ( PlatformContainer platforms , ManagedSet < PlayPlatformInternal > playPlatformInternals ) { } @ ComponentType void register ( ComponentTypeBuilder < PlayApplicationSpec > builder ) { } @ Mutate void createDefaultPlayApp ( CollectionBuilder < PlayApplicationSpec > builder ) { } @ BinaryType void registerApplication ( BinaryTypeBuilder < PlayApplicationBinarySpec > builder ) { } @ Mutate void configureDefaultPlaySources ( ComponentSpecContainer components , final ServiceRegistry serviceRegistry ) { } @ Finalize void failOnMultiplePlayComponents ( ComponentSpecContainer container ) { } @ ComponentBinaries void createBinaries ( CollectionBuilder < PlayApplicationBinarySpec > binaries , final PlayApplicationSpec componentSpec , PlatformContainer platforms , final PlayToolChainInternal playToolChainInternal , final ServiceRegistry serviceRegistry , @ Path ( "buildDir" ) final File buildDir , final ProjectIdentifier projectIdentifier ) { } private List < PlayPlatform > getChosenPlatforms ( PlayApplicationSpec componentSpec , PlatformContainer platforms ) { } @ BinaryTasks void createTwirlCompile ( CollectionBuilder < Task > tasks , final PlayApplicationBinarySpecInternal binary , final ServiceRegistry serviceRegistry , final ProjectIdentifier projectIdentifier , @ Path ( "buildDir" ) final File buildDir ) { } @ BinaryTasks void createRoutesCompile ( CollectionBuilder < Task > tasks , final PlayApplicationBinarySpecInternal binary , final ServiceRegistry serviceRegistry , final ProjectIdentifier projectIdentifier , @ Path ( "buildDir" ) final File buildDir ) { } @ BinaryTasks void createScalaCompile ( CollectionBuilder < Task > tasks , final PlayApplicationBinarySpecInternal binary , ServiceRegistry serviceRegistry , final ProjectIdentifier projectIdentifier , @ Path ( "buildDir" ) final File buildDir ) { } @ BinaryTasks void createJarTask ( CollectionBuilder < Task > tasks , final PlayApplicationBinarySpecInternal binary ) { } @ Mutate void createPlayRunTask ( CollectionBuilder < Task > tasks , BinaryContainer binaryContainer , ServiceRegistry serviceRegistry , final ProjectIdentifier projectIdentifier , @ Path ( "buildDir" ) final File buildDir ) { } @ Mutate void createTestTasks ( CollectionBuilder < Task > tasks , BinaryContainer binaryContainer , ServiceRegistry serviceRegistry , final ProjectIdentifier projectIdentifier , @ Path ( "buildDir" ) final File buildDir ) { final FileResolver fileResolver = serviceRegistry . get ( FileResolver . class ) ; final ConfigurationContainer configurationContainer = serviceRegistry . get ( ConfigurationContainer . class ) ; final DependencyHandler dependencyHandler = serviceRegistry . get ( DependencyHandler . class ) ; final PlayToolChain playToolChain = serviceRegistry . get ( PlayToolChain . class ) ; for ( final PlayApplicationBinarySpec binary : binaryContainer . withType ( PlayApplicationBinarySpec . class ) ) { final PlayPlatform targetPlatform = binary . getTargetPlatform ( ) ; Dependency playTestDependency = dependencyHandler . create ( String . format ( "com.typesafe.play:play-test_%s:%s" , targetPlatform . getScalaMainVersion ( ) , targetPlatform . getPlayVersion ( ) ) ) ; final Configuration testCompileConfiguration = configurationContainer . detachedConfiguration ( playTestDependency ) ; final FileCollection testCompileClasspath = fileResolver . resolveFiles ( binary . getJarFile ( ) ) . plus ( testCompileConfiguration ) ; final String testCompileTaskName = String . format ( "compile%sTests" , StringUtils . capitalize ( binary . getName ( ) ) ) ; final File testSourceDir = fileResolver . resolve ( "test" ) ; final File testClassesDir = new File ( buildDir , String . format ( "testClasses//%s" , binary . getName ( ) ) ) ; tasks . create ( testCompileTaskName , PlatformScalaCompile . class , new Action < PlatformScalaCompile > ( ) { public void execute ( PlatformScalaCompile scalaCompile ) { scalaCompile . dependsOn ( binary . getBuildTask ( ) ) ; scalaCompile . setClasspath ( testCompileClasspath ) ; scalaCompile . setPlatform ( new org . gradle . language . scala . internal . DefaultScalaPlatform ( binary . getTargetPlatform ( ) . getScalaVersion ( ) ) ) ; scalaCompile . setDestinationDir ( testClassesDir ) ; scalaCompile . setSource ( testSourceDir ) ; scalaCompile . setSourceCompatibility ( binary . getTargetPlatform ( ) . getJavaVersion ( ) . getMajorVersion ( ) ) ; scalaCompile . setTargetCompatibility ( binary . getTargetPlatform ( ) . getJavaVersion ( ) . getMajorVersion ( ) ) ; IncrementalCompileOptions incrementalOptions = scalaCompile . getScalaCompileOptions ( ) . getIncrementalOptions ( ) ; incrementalOptions . setAnalysisFile ( new File ( buildDir , String . format ( "tmp//scala//compilerAnalysis//%s.analysis" , testCompileTaskName ) ) ) ; scalaCompile . getScalaCompileOptions ( ) . setFork ( true ) ; scalaCompile . getScalaCompileOptions ( ) . setUseAnt ( false ) ; } } ) ; String testTaskName = String . format ( "test%s" , StringUtils . capitalize ( binary . getName ( ) ) ) ; tasks . create ( testTaskName , Test . class , new Action < Test > ( ) { public void execute ( Test test ) { test . setTestClassesDir ( testClassesDir ) ; test . setBinResultsDir ( new File ( buildDir , String . format ( "tmp//testResults//%s" , test . getName ( ) ) ) ) ; test . getReports ( ) . getJunitXml ( ) . setDestination ( new File ( buildDir , String . format ( "reports//test//%s//junit" , binary . getName ( ) ) ) ) ; test . getReports ( ) . getHtml ( ) . setDestination ( new File ( buildDir , String . format ( "reports//test//%s" , binary . getName ( ) ) ) ) ; test . dependsOn ( testCompileTaskName ) ; test . setTestSrcDirs ( Arrays . asList ( testSourceDir ) ) ; test . setWorkingDir ( projectIdentifier . getProjectDir ( ) ) ; <START_BUG> test . setClasspath ( testCompileClasspath ) ; <END_BUG> } } ) ; } } } }

Fix:
test . setClasspath ( testCompileClasspath . plus ( fileResolver . resolveFiles ( testClassesDir ) ) ) ;