We have a spring application that runs in one of a few ways, depending on a specific property, which has to be one of a small set of values. When the application starts up, this property gets passed to a factory, which then builds slightly different bean implementations depending on it.
I'd like to write an integration test for the functionality this controls to ensure it works when the property is set to various values; so it needs to run one test with the property set to 1, one test with the property set to 2, etc. Each test needs to set the property as required, and then reload the configuration so that everything is reconfigured correctly.
Getting the context and manually refreshing it in each test seems simple enough, but how can I inject these different properties in the tests at runtime to control this? Is there any better way of organising this sort of configuration?