i have started working @mockito
annotation @ junit tests.
the reason started using @mockito
because using @autowired
service class took long.
i have more 50 test using same class exmple: userservice
i have @ super class
@mock private userservice userservice;
and set mocking sub class , sub class have diffrent method , multiple @test
normally adding line in @test
method :
mockito.when(userservice.isvalid()).thenreturn(true));
how set mocking @ 1 place (in super class) , sub class know using mock ?
i solved using annotation
@before – run before @test
and set rules mockito.when(userservice.isvalid()).thenreturn(true));
Comments
Post a Comment