io.vertx.docgen.Source Java Examples

The following examples show how to use io.vertx.docgen.Source. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Examples.java    From vertx-unit with Apache License 2.0 6 votes vote down vote up
@Source(translate = false)
public static void asyncAssertSuccess_02(Vertx vertx, TestContext context) {
  AtomicBoolean started = new AtomicBoolean();
  Async async = context.async();
  vertx.deployVerticle(new AbstractVerticle() {
    public void start() throws Exception {
      started.set(true);
    }
  }, ar -> {
    if (ar.succeeded()) {
      context.assertTrue(started.get());
      async.complete();
    } else {
      context.fail(ar.cause());
    }
  });

  // Can be replaced by

  vertx.deployVerticle("my.verticle", context.asyncAssertSuccess(id -> {
    context.assertTrue(started.get());
  }));
}
 
Example #2
Source File: Examples.java    From vertx-unit with Apache License 2.0 6 votes vote down vote up
@Source(translate = false)
public static void asyncAssertSuccess_03(Vertx vertx, TestContext context) {
  Async async = context.async();
  vertx.deployVerticle("my.verticle", ar1 -> {
    if (ar1.succeeded()) {
      vertx.deployVerticle("my.otherverticle", ar2 -> {
        if (ar2.succeeded()) {
          async.complete();
        } else {
          context.fail(ar2.cause());
        }
      });
    } else {
      context.fail(ar1.cause());
    }
  });

  // Can be replaced by

  vertx.deployVerticle("my.verticle", context.asyncAssertSuccess(id ->
          vertx.deployVerticle("my_otherverticle", context.asyncAssertSuccess())
  ));
}
 
Example #3
Source File: Examples.java    From vertx-unit with Apache License 2.0 6 votes vote down vote up
@Source(translate = false)
public static void asyncAssertFailure_02(Vertx vertx, TestContext context) {
  Async async = context.async();
  vertx.deployVerticle("my.verticle", ar -> {
    if (ar.succeeded()) {
      context.fail();
    } else {
      context.assertTrue(ar.cause() instanceof IllegalArgumentException);
      async.complete();
    }
  });

  // Can be replaced by

  vertx.deployVerticle("my.verticle", context.asyncAssertFailure(cause -> {
    context.assertTrue(cause instanceof IllegalArgumentException);
  }));
}
 
Example #4
Source File: Examples.java    From vertx-unit with Apache License 2.0 5 votes vote down vote up
@Source(translate = false)
public static void asyncAssertSuccess_01(Vertx vertx, TestContext context) {
  Async async = context.async();
  vertx.deployVerticle("my.verticle", ar -> {
    if (ar.succeeded()) {
      async.complete();
    } else {
      context.fail(ar.cause());
    }
  });

  // Can be replaced by

  vertx.deployVerticle("my.verticle", context.asyncAssertSuccess());
}
 
Example #5
Source File: Examples.java    From vertx-unit with Apache License 2.0 5 votes vote down vote up
@Source(translate = false)
public static void asyncAssertFailure_01(Vertx vertx, TestContext context) {
  Async async = context.async();
  vertx.deployVerticle("my.verticle", ar -> {
    if (ar.succeeded()) {
      context.fail();
    } else {
      async.complete();
    }
  });

  // Can be replaced by

  vertx.deployVerticle("my.verticle", context.asyncAssertFailure());
}
 
Example #6
Source File: TheExample.java    From vertx-docgen with Apache License 2.0 4 votes vote down vote up
@Source
public void someMethod() {
  int a = 0;
}