Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP Testing #2353

Merged
merged 6 commits into from Sep 16, 2020
Merged

MP Testing #2353

merged 6 commits into from Sep 16, 2020

Conversation

tomas-langer
Copy link
Member

@tomas-langer tomas-langer commented Sep 13, 2020

Signed-off-by: Tomas Langer tomas.langer@oracle.com

Resolves #2364

Support for MP testing allowing the following:

@HelidonTest
class TestAutoDiscovery {
    @Inject
    @ConfigProperty(name="app.greeting")
    private String greeting;

    @Test
    void testGreeting() {
        assertThat(greeting, is("TestHello"));
    }
}

Or for more complex tests:

@HelidonTest
@DisableDiscovery
@AddBean(MyBean.class)
@AddExtension(ConfigCdiExtension.class)
@AddConfig(key = "app.greeting", value = "TestHello")
class TestNoDiscovery {
    @Inject
    private MyBean myBean;

    @Test
    void testGreeting() {
        assertThat(myBean, notNullValue());
        assertThat(myBean.greeting(), is("TestHello"));
    }
}

@tomas-langer tomas-langer added enhancement New feature or request 2.x Issues for 2.x version branch labels Sep 13, 2020
@tomas-langer tomas-langer self-assigned this Sep 13, 2020
@tomas-langer tomas-langer marked this pull request as draft September 13, 2020 22:27
@tomas-langer tomas-langer marked this pull request as ready for review September 13, 2020 22:27
spericas
spericas previously approved these changes Sep 14, 2020
Copy link
Member

@spericas spericas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
 * per test method CDI container.
 * custom config sources

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
Method parameter is only checked when running in per-method mode.

Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
danielkec
danielkec previously approved these changes Sep 16, 2020
Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
@tomas-langer tomas-langer merged commit d6bfedf into helidon-io:master Sep 16, 2020
@tomas-langer tomas-langer deleted the mp-testing branch September 16, 2020 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues for 2.x version branch enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration with JUnit for Helidon MP
3 participants