I have recently started working with @Mockito annotation at Junit Tests.
the reason i started using @Mockito is because using @Autowired for all the service class took very long.
i have more than 50 test that using the same class for exmple: userService
i would like to have this at my super class
@Mock
private UserService userService;
and to set Mocking for all the sub class , all sub class have diffrent method and multiple @Test
Normally what i do is adding this line in the @Test method :
Mockito.when(userService.isValid()).thenReturn(true));
How could i set this Mocking at one place (in super class) and all sub class could know using this Mock ?
Aucun commentaire:
Enregistrer un commentaire