forked from quarkusio/quarkus
-
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.
Merge pull request quarkusio#38655 from wiebeck/38602-multiple-testco…
…nfigproperties-on-methods Allow for multiple TestConfigProperty annotations on methods
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
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
20 changes: 20 additions & 0 deletions
20
...rk/junit5-component/src/test/java/io/quarkus/test/component/beans/MultiPropComponent.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,20 @@ | ||
package io.quarkus.test.component.beans; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@ApplicationScoped | ||
public class MultiPropComponent { | ||
|
||
@ConfigProperty(name = "foo") | ||
String foo; | ||
|
||
@ConfigProperty(name = "bar") | ||
String bar; | ||
|
||
public String getFooBar() { | ||
return foo + bar; | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...a/io/quarkus/test/component/declarative/MultipleConfigPropertiesDeclaredOnMethodTest.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,26 @@ | ||
package io.quarkus.test.component.declarative; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.component.QuarkusComponentTest; | ||
import io.quarkus.test.component.TestConfigProperty; | ||
import io.quarkus.test.component.beans.MultiPropComponent; | ||
|
||
@QuarkusComponentTest | ||
public class MultipleConfigPropertiesDeclaredOnMethodTest { | ||
|
||
@Inject | ||
MultiPropComponent component; | ||
|
||
@TestConfigProperty(key = "foo", value = "BAR") | ||
@TestConfigProperty(key = "bar", value = "BAZ") | ||
@Test | ||
public void testPing() { | ||
assertEquals("BARBAZ", component.getFooBar()); | ||
} | ||
|
||
} |