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

Junit non-REST test example #367

Open
abelsromero opened this issue Nov 30, 2019 · 0 comments
Open

Junit non-REST test example #367

abelsromero opened this issue Nov 30, 2019 · 0 comments

Comments

@abelsromero
Copy link

I am struggling to test a verticle isolated and all documentation and examples found only show how to test rest endpoints.

Something as simple as this, always fails with timeout

    @Rule
    public RunTestOnContext rule = new RunTestOnContext();

    @Rule
    public Timeout timeout = Timeout.seconds(5L);

    @Test
    public void should_run_verticle(TestContext context) {
        // given
        final String address = "hello";
        final String message = "world";

        // when
        final Async async = context.async();

        rule.vertx()
                .eventBus()
                .publish(address, message)
                .consumer(address, event -> {
                    context.assertEquals(message, event.body());
                    System.out.println(event.body());
                    async.complete();
                });

		async.awaitSuccess();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant