I have a Java method with the following statement:
public void someMethod() {
.....
Long firstVal = someService.getSomeObject().getId();
Long secondVal = someService.getSomeObject().getNextFunc().getOtherObject().getId();
.....
}
Now I am trying to test this method and in mock setup I am trying to do like:
@RunWith(MockitoJUnitRunner.class)
public class SomeServiceTest {
@Mock SomeService mockSomeService;
SomeObject someObject = new SomeObject();
@Before
public void setup() {
someObject.setId(123456);
when(mockSomeService.getSomeObject).thenReturn(someObject);
//...
}
//...
}
Now how can I mock for secondVal?
Aucun commentaire:
Enregistrer un commentaire