Announcement Announcement Module
No announcement yet.
Support for expressions in @ActiveProfiles annotation Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Support for expressions in @ActiveProfiles annotation

    I have a large suite of tests, all running against a live REST service - these simply send out requests and do various assertions and verifications on the results; the tests are all annotated with:
    @ActiveProfiles({ "mime_json" })
    Which effectively enables the JSON marshaller to be instantiated, which leads to the Accept and Content-Type headers to be application/json.
    That's all good, but would like to be able to configure (set) the active profile dynamically if I want to, such as;
    @ActiveProfiles({ "${mime:mime_json}" })

    So that I can also run all of these tests with mime_xml by setting mime=mime_xml from the outside.
    The only problem is that @ActiveProfile does not support expressions.

    I have tried to do the same with @Qualifier, but that doesn't support expressions either (
    I am aware that I could remove the @ActiveProfile annotations completely and set the active profiles fully from outside, but that would mean that I need to set them for each and every tests, without having a default to fall back on - this would make running the tests harder, as I would need to make sure I always set these profiles, which is not my intention.
    Should I open a JIRA for this? Any other way to achieve the same results?