Skip to content

Commit

Permalink
property override fix karatelabs#2474
Browse files Browse the repository at this point in the history
  • Loading branch information
dvargas46 committed Feb 16, 2024
1 parent 9087fdc commit c156764
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion karate-core/src/main/java/com/intuit/karate/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public T systemProperty(String key, String value) {
if (systemProperties == null) {
systemProperties = new HashMap();
}
System.setProperty(key, value);
systemProperties.put(key, value);
return (T) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ void testSystemPropertiesSetOnRunner() {
builder.resolveAll();
String propertyValue = builder.systemProperties.get(TEST_PROP);
assertEquals(propertyValue, "setOnRunner");
String jvmValue = System.getProperty(TEST_PROP);
assertEquals(jvmValue, null);
}

@Test
Expand All @@ -30,6 +32,8 @@ void testSystemPropertiesSetOnJVM() {
builder.resolveAll();
String propertyValue = builder.systemProperties.get(TEST_PROP);
assertEquals(propertyValue, "setOnJVM");
String jvmValue = System.getProperty(TEST_PROP);
assertEquals(jvmValue, "setOnJVM");
}

@Test
Expand All @@ -38,9 +42,9 @@ void testPrecedenceOfSystemPropertiesSetOnRunnerAndJVM() {
Builder<?> builder = Runner.builder().systemProperty(TEST_PROP, "setOnRunner");
builder.resolveAll();
String propertyValue = builder.systemProperties.get(TEST_PROP);
assertEquals(propertyValue, "setOnRunner");
assertEquals(propertyValue, "setOnJVM");
String jvmValue = System.getProperty(TEST_PROP);
assertEquals(jvmValue, "setOnRunner");
assertEquals(jvmValue, "setOnJVM");
}

}

0 comments on commit c156764

Please sign in to comment.