It occurs encoding error while gradle junit testing

it occurs encoding error in junit testing, but I have done under setting in build.gradle:
tasks.withType(JavaCompile) {
options.encoding = ‘UTF-8’
and jvm_options in gradle.bat:
set DEFAULT_JVM_OPTS="-Dfile.encoding=UTF-8"

I have checked that the java code compiling is correct, but the test java code compiling is error.
how can I resove this problem? thanks.