I need to mock creation of two objects
Holder<MyClass1> h1 = new Holder<>();
Holder<MyClass2> h2 = new Holder<>();
I use Mockito and PowerMock
Holder<MyClass1> mock1 = PowerMockito.spy(new Holder<MyClass1>());
Holder<MyClass2> mock2 = PowerMockito.spy(new Holder<MyClass2>());
PowerMockito.whenNew(Holder.class).withNoArguments().thenReturn(mock1);
How can I specify generic type to mock two different objects? I need 2 mock for my test. Thank you.
Aucun commentaire:
Enregistrer un commentaire