java - mocking a class that has a private constructor? -


i need mock java class has private constructor , static create method.

what typical solution in kind of situation.

with or without framework.

you can use powermock mock static methods https://code.google.com/p/powermock/wiki/mockitousage, mock static create method , return whatever want. it's easier if static method returns interface rather class can return own mock implementation of it.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -