-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic Config convert and tests
- Loading branch information
1 parent
870fed6
commit 1d128bf
Showing
2 changed files
with
86 additions
and
21 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
50 changes: 50 additions & 0 deletions
50
microprofile/config/src/test/java/io/helidon/microprofile/config/MpConfigConvertTest.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,50 @@ | ||
/* | ||
<<<<<<< HEAD | ||
* Copyright (c) 2013 Oracle and/or its affiliates. | ||
======= | ||
* Copyright (c) 2023 Oracle and/or its affiliates. | ||
>>>>>>> 53788d2db4 (Refactor tests) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.helidon.microprofile.config; | ||
|
||
import io.helidon.config.mp.MpConfig; | ||
import io.helidon.microprofile.tests.junit5.AddConfig; | ||
import io.helidon.microprofile.tests.junit5.HelidonTest; | ||
import jakarta.inject.Inject; | ||
import org.eclipse.microprofile.config.Config; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/** | ||
* Test for correct handling of other implementations of {@link Config}. | ||
* | ||
* @see "https://github.com/helidon-io/helidon/issues/6668" | ||
*/ | ||
@HelidonTest | ||
@AddConfig(key = "key", value = "value") | ||
public class MpConfigConvertTest { | ||
|
||
@Inject | ||
private Config mpConfig; | ||
|
||
//No exceptions should occur. | ||
@Test | ||
void testConvertToHelidonConfig() { | ||
io.helidon.config.Config helidonConfig = MpConfig.toHelidonConfig(mpConfig); | ||
assertThat(helidonConfig.get("key").asString().get(), is("value")); | ||
} | ||
} |