forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for AliasConfigSource. IQSS#7457
- Loading branch information
1 parent
ebf83e2
commit e1cb339
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/test/java/edu/harvard/iq/dataverse/settings/source/AliasConfigSourceTest.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 edu.harvard.iq.dataverse.settings.source; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
import java.util.Properties; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class AliasConfigSourceTest { | ||
|
||
AliasConfigSource source = new AliasConfigSource(); | ||
|
||
@Test | ||
void getValue() { | ||
// given | ||
System.setProperty("dataverse.hello.foobar", "test"); | ||
Properties aliases = new Properties(); | ||
aliases.setProperty("dataverse.goodbye.foobar", "dataverse.hello.foobar"); | ||
|
||
// when | ||
source.importAliases(aliases); | ||
|
||
// then | ||
assertEquals("test", source.getValue("dataverse.goodbye.foobar")); | ||
} | ||
|
||
@Test | ||
void readImportTestAliasesFromFile() throws IOException { | ||
// given | ||
System.setProperty("dataverse.old.example", "test"); | ||
String filePath = "test-microprofile-aliases.properties"; | ||
|
||
// when | ||
Properties aliases = source.readAliases(filePath); | ||
source.importAliases(aliases); | ||
|
||
// then | ||
assertEquals("test", source.getValue("dataverse.new.example")); | ||
} | ||
} |
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 @@ | ||
dataverse.new.example=dataverse.old.example |