-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
testsuite/extra/src/test/java/io/smallrye/config/test/collections/KotlinCollectionsBean.kt
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,20 @@ | ||
package io.smallrye.config.test.collections | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty | ||
import javax.enterprise.context.Dependent | ||
import javax.inject.Inject | ||
|
||
@Dependent | ||
class KotlinCollectionsBean { | ||
@Inject | ||
@ConfigProperty(name = "property.list") | ||
lateinit var typeList: List<MyType> | ||
|
||
@Inject | ||
@ConfigProperty(name = "property.single") | ||
lateinit var singleType: MyType | ||
} | ||
|
||
class MyType(val value: String) { | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...te/extra/src/test/java/io/smallrye/config/test/collections/KotlinCollectionsBeanTest.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,38 @@ | ||
package io.smallrye.config.test.collections; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.testng.Arquillian; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.testng.annotations.Test; | ||
|
||
public class KotlinCollectionsBeanTest extends Arquillian { | ||
@Deployment | ||
public static WebArchive deploy() { | ||
return ShrinkWrap | ||
.create(WebArchive.class) | ||
.addClasses(CollectionBean.class) | ||
.addClasses(KotlinCollectionsBean.class, KotlinCollectionsBeanTest.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") | ||
.addAsResource(new StringAsset("property.list=1,2,3\n" + | ||
"property.single=1234\n"), | ||
"META-INF/microprofile-config.properties"); | ||
} | ||
|
||
@Inject | ||
KotlinCollectionsBean kotlinCollectionsBean; | ||
|
||
@Test | ||
public void kotlinCollections() { | ||
assertEquals(kotlinCollectionsBean.typeList.get(0).getValue(), "1"); | ||
assertEquals(kotlinCollectionsBean.typeList.get(1).getValue(), "2"); | ||
assertEquals(kotlinCollectionsBean.typeList.get(2).getValue(), "3"); | ||
assertEquals(kotlinCollectionsBean.singleType.getValue(), "1234"); | ||
} | ||
} |