I'm using apache Base64.class to verify an incoming base64 document.
I need to stub the Base64.isBase64(String base64Doc) method call.
However, when I use PowerMock it asks me to prepare the method/class for testing using the @PrepareForTest annotation, which is obviously not possible as this is a library.
I can't use Mockito.when() as any method call inside when() must be on a mock, which means the class must be instantiated, which cannot be done on a static class..
The only other solution I can think of is to use a real data object instead of mocking it and include valid/invalid base64 strings. But I don't want to do this.
Aucun commentaire:
Enregistrer un commentaire