Error in gradle7 testcompile compilation [How to Solve]

Could not find method testCompile() for arguments [{group=junit, name=junit, version=4.12}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I’m using gradle 7.1 and I’m importing an older version of the project
The new version changes the testCompile to testImplementation

Read More: