Skip to content

Support text blocks for inlined properties in @TestPropertySource #31053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sbrannen opened this issue Aug 15, 2023 · 0 comments
Closed

Support text blocks for inlined properties in @TestPropertySource #31053

sbrannen opened this issue Aug 15, 2023 · 0 comments
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

Multiple inlined properties can currently only be supplied as an array of strings:

@TestPropertySource(properties = {
    "key1 = value1",
    "key2 = value2"
})

It would be nice to be able to use a single text block (or multiple text blocks):

@TestPropertySource(properties = """
    key1 = value1
    key2 = value2
    """
)

However, TestPropertySourceUtils.convertInlinedPropertiesToMap(String...) currently throws an exception if a single String contains more than one key-value pair.

That check made sense when we expected users to supply one key-value pair per string in an array, but that restriction no longer makes sense when text blocks are taken into consideration.

We should therefore remove that restriction and allow users to supply inlined properties as a text block.

@sbrannen sbrannen added in: test Issues in the test module type: enhancement A general enhancement labels Aug 15, 2023
@sbrannen sbrannen added this to the 6.1.0-M4 milestone Aug 15, 2023
@sbrannen sbrannen self-assigned this Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant