Skip to content

Commit

Permalink
Fix signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
vtintillier committed Jan 11, 2024
1 parent 5c049a9 commit 1cc987d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* that will be applied to the system to be set before the stubbing is triggered.
*/
public class SystemPropertiesImpl<T extends SystemPropertiesImpl<T>> extends SingularTestResource
implements NameValuePairSetter<SystemPropertiesImpl<T>> {
implements NameValuePairSetter<T> {
private Properties originalProperties;
private Properties properties;

Expand Down Expand Up @@ -70,12 +70,13 @@ public SystemPropertiesImpl(String name, String value, String... nameValues) {
* @since 1.0.0
*/
@Override
public SystemPropertiesImpl<T> set(String name, String value) {
@SuppressWarnings("unchecked")
public T set(String name, String value) {
properties.setProperty(name, value);
if (isActive()) {
System.setProperty(name, value);
}
return this;
return (T) this;
}

/**
Expand All @@ -86,12 +87,13 @@ public SystemPropertiesImpl<T> set(String name, String value) {
* @since 2.1.5
*/
@Override
public SystemPropertiesImpl<T> remove(String name) {
@SuppressWarnings("unchecked")
public T remove(String name) {
propertiesToRemove.add(name);
if (isActive()) {
System.getProperties().remove(name);
}
return this;
return (T) this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import uk.org.webcompere.systemstubs.properties.SystemPropertiesImpl;
import uk.org.webcompere.systemstubs.rules.internal.SystemStubTestRule;

import java.util.Map;
import java.util.Properties;

/**
Expand All @@ -30,12 +29,4 @@ public SystemPropertiesRule(Properties properties) {
public SystemPropertiesRule(String name, String value, String... nameValues) {
super(name, value, nameValues);
}

/**
* {@inheritDoc}
*/
@Override
public SystemPropertiesRule set(Map<Object, Object> properties) {
return (SystemPropertiesRule)super.set(properties);
}
}

0 comments on commit 1cc987d

Please sign in to comment.