0

The PaxExam documentation says the following:

The test class may contain one or more methods annotated by @Configuration, returning a list of options for configuring the test container.

If there is more than one configuration method, each test method is run for each configuration.

The documentation says nothing about the following two situations (last is really more important):

  • What if two or more of those methods return options setting the same property? Is there an ordering defined? Which one takes precedence?
  • What if there is a @Configuration method in the base class, and also in the subclass? Will duplicate settings in the subclass override the settings in the base class?

I know I could just do it and see what happens, but I need guarantees, not guesses.

Community
  • 1
  • 1
David M. Karr
  • 14,317
  • 20
  • 94
  • 199
  • After thinking more about what this documentation actually says, I guess it's pretty clear. Once I actually understood the last sentence, it became pretty clear. – David M. Karr Oct 26 '16 at 17:36
  • I thought I'd add an answer but since you have figured it out, perhaps you should answer your own question. That would be helpful to those who will find the question in the future. – Milen Dyankov Nov 29 '16 at 17:06

1 Answers1

0

If I had clearly read the last sentence of that documentation excerpt, I wouldn't have had to ask this question. It seemed "logical" to me that each @Configuration method would have been executed for each test method, but the truth is that multiple @Configuration methods (whether in current class or base class) effectively create a "matrix test", such that each test method is run individually with each @Configuration method, which would test the method with different configurations.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199