jeudi 1 septembre 2016

How to mock Class.forName and class.Constructor.newInstance()

i have been trying to mock

clazz = Class.forName("Complete Class path") 
Object obj = clazz.Constructor().getInstance();

I googled it, and found links which informed how to mock the static method using powermock. I tried using those logic to mock the

Class.forName("Complete Class path")

and

Object obj = clazz.Constructor().getInstance() but have been facing errors.

Aucun commentaire:

Enregistrer un commentaire