Skip to content

Commit

Permalink
Allow for multiple TestConfigProperty annotations on methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wiebeck committed Feb 7, 2024
1 parent 59e1c2d commit 35e3539
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
String value();

@Retention(RUNTIME)
@Target(TYPE)
@Target({ TYPE, METHOD })
@interface TestConfigProperties {

TestConfigProperty[] value();
Expand Down
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;
}

}
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());
}

}

0 comments on commit 35e3539

Please sign in to comment.