I am currently testing a method that receives an object and checks to see if this object is an instance of a class that is stored as an instance variable. Not a problem yet.
But in the test I have to use mocks, and one of these mocks is the object that is passed to this method. And now it's getting complicated. Let's look at the code (I summarized the code in this test):
Class<AdapterEvent> clazz = AdapterEvent.class; AdapterEvent adapterEvent = Mockito.mock(AdapterEvent.class); Assert.assertTrue(adapterEvent.getClass().equals(clazz)); Assert.assertTrue(adapterEvent.getClass().isAssignableFrom(clazz));
Well, this test actually fails. Does anyone know why? Does anyone have an idea how I can solve this problem while still using the layout, as in the test? Is there any other way to compare objects with a specific class.
Thank you for help.
Best wishes
Gerardo
instanceof mockito mocking
Gerardo
source share