Skip to content

fix: ensure EnvironmentVariables.clear properly removes variables - #89

Open
arimu1 wants to merge 1 commit into
stefanbirkner:masterfrom
arimu1:fix-86-env-vars-clear
Open

fix: ensure EnvironmentVariables.clear properly removes variables#89
arimu1 wants to merge 1 commit into
stefanbirkner:masterfrom
arimu1:fix-86-env-vars-clear

Conversation

@arimu1

@arimu1 arimu1 commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • Keep the internal EnvironmentVariables buffer in sync when set() / clear() are called during test execution.
  • Previously, changes made while a test was running only updated the live environment map. Buffered values from rule configuration (or earlier calls) were left unchanged, so clear() could appear to have no effect when another test had already run and the next test copied stale buffer entries back into the environment.
  • Add regression tests covering @Before setup plus clear() across multiple tests in a class.

Fixes #86

Test plan

  • mvn test
  • Added EnvironmentVariablesClearAcrossTestsTest with scenarios for clearing variables set in @Before and ensuring cleared variables are not restored from the buffer in subsequent tests

Always update the internal buffer when set/clear is called, including
while a test statement is executing. Previously, changes made during
a test only modified the live environment map, so a later clear() did
not override buffered values from rule configuration and the variable
could reappear when the next test started.

Fixes stefanbirkner#86
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.

EnvironmentVariables clear() does not work properly

1 participant