This question already has an answer here:
- How to mock a final class with mockito 9 answers
Recently while unit testing I got to know the limitation that I can't mock final classes. It feels weird because the class under test uses these final classes and these final classes are part of some external API.
Why this limitation exists and how to get around of this limitation?
@Inject
public RemoteClient(DfpSession dfpSession, DfpServices dfpServices) {
this.dfpSession = dfpSession;
this.dfpServices = dfpServices;
}
above, DfpServices is a final class.
PS: I am using Guice to inject the final class in my class under test.
Aucun commentaire:
Enregistrer un commentaire