forked from jbake-org/jbake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make JBakeConfiguration.addConfiguration() values take precedence
This closes jbake-org#717
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
jbake-core/src/test/java/org/jbake/app/configuration/DefaultJBakeConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.jbake.app.configuration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.File; | ||
import java.util.Properties; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
public class DefaultJBakeConfigurationTest { | ||
|
||
@TempDir | ||
File root; | ||
|
||
private JBakeConfiguration jBakeConfig; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
jBakeConfig = new ConfigUtil().loadConfig(root, null); | ||
} | ||
|
||
@Test | ||
public void testAddConfiguration() { | ||
Properties props = new Properties(); | ||
props.setProperty("version", "overwritten"); // overwrite property from default.properties | ||
props.setProperty("foo", "bar"); | ||
jBakeConfig.addConfiguration(props); | ||
assertEquals("overwritten", jBakeConfig.get("version")); | ||
assertEquals("bar", jBakeConfig.get("foo")); | ||
} | ||
|
||
@Test | ||
public void testSetProperty() { | ||
jBakeConfig.setProperty("version", "overwritten"); // overwrite property from default.properties | ||
jBakeConfig.setProperty("foo", "bar"); | ||
assertEquals("overwritten", jBakeConfig.get("version")); | ||
assertEquals("bar", jBakeConfig.get("foo")); | ||
} | ||
} |