Software Development

Find out if an object is a mock or spy in Mockito

The need for it

[wp_ad_camp_5]

Finding out if an object is a mock or spy in Mockito may not (or never) be part of your usual automated unit tests but in some cases (advanced usage of JUnit/Mockito) you may need to determine its type.

Is Mock or Spy?

Below is a sample code to determine if an object is mock or spy in Mockito.

Download the Codes

https://github.com/Turreta/mockito-spy-or-mock-example

[wp_ad_camp_1]

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like