I was running into the same issue in gradle and found that I had to specifically import the test classes to use the "Harness" related classes.
testImplementation "org.apache.flink:flink-streaming-java:${flinkVersion}:tests" // <-- "tests" from this library
testImplementation "org.apache.flink:flink-test-utils:${flinkVersion}"