So I understand that in Mockito @InjectMocks will inject anything that it can with the annotation of @Mock, but how to handle this scenario?
@Mock
private MockObject1 mockObject1;
@Mock
private MockObject2 mockObject2;
@InjectMocks
private SystemUnderTest systemUnderTest = new SystemUnderTest();
Imagine that MockObject2 has an attribute that is of type MockObject1, and SystemUnderTest has an attribute of type MockObject2. I would like to have mockObject1 injected into mockObject2, and mockObject2 injected into systemUnderTest.
Is this possible with annotations?
Not possible at the moment. Interesting feature, though.
Cheers!
--
Szczepan Faber
Principal engineer@gradleware
Lead@mockito
Imagine that MockObject2 has an attribute that is of type MockObject1, and SystemUnderTest has an attribute of type MockObject2. I would like to have mockObject1 injected into mockObject2, and mockObject2 injected into systemUnderTest.
Cheers!
> --
> You received this message because you are subscribed to the Google Groups
> "mockito" group.
> To post to this group, send email to moc...@googlegroups.com.
> To unsubscribe from this group, send email to
> mockito+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mockito?hl=en.
>
--
@Mock
private MockObject1 mockObject1;
@InjectMocks @Spy
private RealObject realObject = new RealObject();
@InjectMocks
private SystemUnderTest systemUnderTest = new SystemUnderTest();
--
You received this message because you are subscribed to the Google Groups "mockito" group.