Skip to content

4.x: io.helidon.microprofile.testing.AddConfig* do not require a reset #10575

@romain-grecourt

Description

@romain-grecourt

Environment Details

  • Helidon Version:
  • Helidon SE or Helidon MP
  • JDK version:
  • OS:

Problem Description

The javadoc of the @io.helidon.microprofile.testing.AddConfig* annotations states that they imply a dedicated CDI container. However that behavior is effectively not implemented.

Steps to reproduce

@HelidonTest
class Aest {

    @Inject
    @ConfigProperty(name = "bar", defaultValue = "not-bar")
    String bar;

    @Test
    @AddConfig(key="bar", value="bar1")
    public void test1() {
        assertThat(bar, is("bar1"));
    }
}

Workaround

The @Configuration annotation can be used to trigger a dedicated CDI container.

@HelidonTest
class Test {

    @Inject
    @ConfigProperty(name = "bar", defaultValue = "not-bar")
    String bar;

    @Test
    @Configuration
    @AddConfig(key="bar", value="bar1")
    public void test1() {
        assertThat(bar, is("bar1"));
    }
}

Metadata

Metadata

Labels

4.xVersion 4.xMPP3bugSomething isn't workingtesting

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions