Skip to content
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

Support removal of environment variables and system properties #75

Merged
merged 1 commit into from
Nov 12, 2023

Conversation

ashleyfrieze
Copy link
Member

A fix for #71 - this allows remove to be called on EnvironmentVariables and SystemProperties to request that any existing property/variable is completely removed from the map when stubbing is active. This is better than using set()

@ashleyfrieze ashleyfrieze merged commit b59e27b into main Nov 12, 2023
1 of 2 checks passed
@ashleyfrieze ashleyfrieze deleted the delete-settings branch November 12, 2023 16:06
Comment on lines +394 to +396
SystemProperties someProperties = new SystemProperties()
.remove("property1")
.remove("property2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ashleyfrieze

this does not compile due to the introduction of SystemPropertiesImpl.

Also this PR breaks backward compatibility. This was working before but no longer does:

class SomeTest {
    @SystemStub
    private static SystemProperties systemProperties = new MySystemProperties().set("property", "value");
}

class MySystemProperties extends SystemProperties {

    public MySystemProperties() {
        super("key1", "value1");
        this.set("key2", "value2");
    }
}

Created #80 for this.

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