Mocking Static methods since 3.4

72 views
Skip to first unread message

Karthik K

unread,
Sep 15, 2020, 4:02:40 AM9/15/20
to mockito
Hey All,

I understand that mockio has a feature to mock static method since 3.4 and I believe we can do it with out using PockerMock but how about mocking static void methods?


How would I use doNothing on static method that returns void ?

MockedStatic<S3Utils> mockStatic = Mockito.mockStatic(S3Utils.class);
Mockito.doNothing().when(mockStatic.validateS3Path(location); --> this doesnt work


Tim van der Lippe

unread,
Sep 15, 2020, 6:08:34 AM9/15/20
to mockito
This is tracked at https://github.com/mockito/mockito/issues/2027 and looking for a contributor to make the required changes.

Op di 15 sep. 2020 om 09:02 schreef Karthik K <kar...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "mockito" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mockito+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mockito/cfab36c4-a8d5-4c61-a5a1-4d36b81dd292n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages