I have two classes.
@WebMvcTest(
controllers = [Child1Controller::class]
excludeFilters = [ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
classes = [SomeAdvice::class]
)],
)
class Child1Test
@WebMvcTest(
controllers = [Child2Controller::class]
excludeFilters = [ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
classes = [SomeAdvice::class]
)],
)
class Child2Test
In this way, I want to refactor @webMvcTest annotation by commonizing the content of excludeFilter because it is too long.
So i'd refactor like this..
here is after parent and child classes.
@WebMvcTest(
excludeFilters = [ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
classes = [SomeAdvice::class]
)],
)
open class Parent
@WebMvcTest(controllers = [Child1Controller::class])
class Child1Test: Parent()
@WebMvcTest(controllers = [Child2Controller::class])
class Child2Test: Parent()
In example case, it will be override by child spec because it is redefine. How can I solve this issue?