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

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -