Skip to content

Commit

Permalink
Illustrate with a better example of @AddConfigBlock
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos committed Jun 3, 2024
1 parent d29cc19 commit 966a5fa
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ void testConfiguredGreeting(WebTarget webTarget) {
validate(webTarget, "/greet", "Unite World!");
}

@Test
@AddConfigBlock("app.greeting=Unite")
void testConfiguredBlockGreeting(WebTarget webTarget) {
validate(webTarget, "/greet", "Unite World!");
}

private void validate(WebTarget webTarget,
String path,
String expected) {
Expand All @@ -111,6 +105,28 @@ private void validate(WebTarget webTarget,
assertThat(message, is("Message in JSON"));
}
}

@HelidonTest
@AddConfigBlock("""
some.key1=some.value1
some.key2=some.value2
""")
class AddConfigBlockTest {

@Inject
@ConfigProperty(name = "some.key1")
private String value1;

@Inject
@ConfigProperty(name = "some.key2")
private String value2;

@Test
void testValue() {
assertThat(value1, is("some.value1"));
assertThat(value2, is("some.value2"));
}
}
// end::snippet_3[]
}

Expand Down

0 comments on commit 966a5fa

Please sign in to comment.