You cannot mock java.lang.Class
with PowerMockito or any other mocking framework which relies on runtime byte code modification.
Reason for this is that those classes are already loaded when the mockito agent is manipulating (instrumenting) the classes that should be mocked.
Why don't you instead mock your MysqlConnection
class? There you could spy on your MysqlConnect
method and return a mocked connection instead.