No need for the download task and custom config, you can just do
dependencies {
testRuntime 'org.junit.platform:junit-platform-console:1.0.0-SNAPSHOT'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.0-SNAPSHOT'
}
...
classpath = project.sourceSets.test.runtimeClasspath