When to use @RunWith and when @ExtendWith

前端 未结 3 1202
抹茶落季
抹茶落季 2020-12-28 12:53

My team and I have been working on a bunch of microservices using Spring boot. Since the services went through JUnit and Spring Boot upgrades (We\'re using now Spring Boot

3条回答
  •  梦毁少年i
    2020-12-28 13:09

    If you are using Junit version < 5, so you have to use @RunWith(SpringRunner.class) or @RunWith(MockitoJUnitRunner.class) etc.

    If you are using Junit version = 5, so you have to use @ExtendWith(SpringExtension.class) or @ExtendWith(MockitoExtension.class) etc.

    1. SpringRunner
    2. MockitoJUnitRunner
    3. SpringExtension
    4. MockitoExtension

提交回复
热议问题