forked from smallrye/smallrye-config
-
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.
Move ConfigMapping classes to integrate with SmallRyeConfig.
- Loading branch information
Showing
16 changed files
with
62 additions
and
0 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
implementation/src/test/java/io/smallrye/config/mapper/ConfigMappingTest.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,35 @@ | ||
package io.smallrye.config.mapper; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.smallrye.config.KeyValuesConfigSource; | ||
import io.smallrye.config.SmallRyeConfig; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
public class ConfigMappingTest { | ||
@Test | ||
void configMapping() { | ||
final SmallRyeConfig config = buildConfig("server.host", "localhost", "server.port", "8080"); | ||
final ConfigsInterface configProperties = config.getConfigProperties(ConfigsInterface.class, "server"); | ||
//assertEquals("localhost", configProperties.getHost()); | ||
assertEquals("localhost", configProperties.host()); | ||
//assertEquals(8080, configProperties.getPort()); | ||
assertEquals(8080, configProperties.port()); | ||
} | ||
|
||
interface ConfigsInterface { | ||
String host(); | ||
|
||
int port(); | ||
} | ||
|
||
private static SmallRyeConfig buildConfig(String... keyValues) { | ||
return new SmallRyeConfigBuilder() | ||
.addDefaultSources() | ||
.addDefaultInterceptors() | ||
.withSources(KeyValuesConfigSource.config(keyValues)) | ||
.build(); | ||
} | ||
} |