I know that one of the rules for the easy mock is that it can not inject into static and final fields.
However,
if I have a code like:
public final class SomeClass
{
private static final AccessInternet accInternet = AccessInternetFactory.getimplmentation();
public static void startSomeWork()
{
final Customer cust = new CurrentCustomerDetails().getCurrent();
...
}
}
So, without re-writing the code itself, can I write unit test for such class? Is there a way I can mock the Customer and inject it into startSomeWork()?
Using EasyMock and jUnit.
Thank you
Aucun commentaire:
Enregistrer un commentaire