Skip to content

Conversation

@ServerlessApplicationRun

…roperties

This commit significantly improves the test coverage for the com.taobao.profile.utils.Utilities and
com.taobao.profile.config.ConfigureProperties classes.

For Utilities.repleseVariables:

  • Added tests for VariableNotFoundException when a variable is not found.
  • Added tests for IllegalArgumentException when source or context is null.
  • Added tests for inputs containing no variables.
  • Added tests for various malformed or nested variable expressions (e.g., ${incomplete}, missing_brace}, ${var${inner_key}}) to assert the actual current behavior of the substitution logic. This includes cases where keys are parsed as key} and where string reconstruction leads to malformed output for certain nested patterns.

For ConfigureProperties:

  • Added tests for getProperty(key) to ensure a RuntimeException is thrown if a property's value contains an unresolvable variable.
  • Added tests for getProperty(key, defaultValue) to ensure:
    • The default value is returned if the key is absent.
    • A RuntimeException is thrown if the key is present but its value contains an unresolvable variable (confirming the default value is not returned in this scenario).

Additionally, the Java version in pom.xml was updated from 1.6 to 1.8 to enable successful compilation and execution of the tests.

…roperties

This commit significantly improves the test coverage for the
`com.taobao.profile.utils.Utilities` and
`com.taobao.profile.config.ConfigureProperties` classes.

For `Utilities.repleseVariables`:
- Added tests for `VariableNotFoundException` when a variable is not found.
- Added tests for `IllegalArgumentException` when source or context is null.
- Added tests for inputs containing no variables.
- Added tests for various malformed or nested variable expressions (e.g.,
  `${incomplete}`, `missing_brace}`, `${var${inner_key}}`) to assert the
  actual current behavior of the substitution logic. This includes cases
  where keys are parsed as `key}` and where string reconstruction
  leads to malformed output for certain nested patterns.

For `ConfigureProperties`:
- Added tests for `getProperty(key)` to ensure a `RuntimeException` is
  thrown if a property's value contains an unresolvable variable.
- Added tests for `getProperty(key, defaultValue)` to ensure:
  - The default value is returned if the key is absent.
  - A `RuntimeException` is thrown if the key is present but its value
    contains an unresolvable variable (confirming the default value is
    not returned in this scenario).

Additionally, the Java version in `pom.xml` was updated from 1.6 to 1.8
to enable successful compilation and execution of the tests.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants