Home » JAVA Programming » Java Basic » Question
  1. How can we simulate if then behavior in Junits?
    1. Mockito.if(..).then(..);
    2. Mockito.when(…).thenReturn(…);
    3. if(..){..} else{..}
    4. if{..} else{..}
    5. None of these
Correct Option: B

Mockito.when(mockList.size()).thenReturn(100); assertEquals(100, mockList.size()); is the usage to implement if and then behavior.



Your comments will be displayed only after manual approval.