mercredi 16 novembre 2016

How to exclude package from a context using @WebMvcTest

I want to test application slices, but there is a package I want to exclude, since it is not related to those tests at all.

I am trying to exclude the package this way:

@RunWith(SpringRunner.class)
@WebMvcTest(controllers = MyController.class,
        excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.foo.bar")})
public class MyControllerTest {
    // ... list of test methods goes here ...
}

Classes from this package are included in a context anyway. How to fix it?

Aucun commentaire:

Enregistrer un commentaire