Compile time JUnit dependency

I have gradle modules in my build that test with JUnit

test {
    useJUnit()
}

Now, I’d like to create a test module which has a compile time dependency on JUnit (eg a JUnit4ClassRunner). How do I use the same JUnit version as the useJUnit() version?

dependencies {

compile ‘junit:junit:${junitVersion}’ }

‘useJUnit()’ does not imply specific version of JUnit. You can use whatever version you like.