io.vertx.ext.unit.TestContext.assertNull()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中io.vertx.ext.unit.TestContext.assertNull()方法的一些代码示例,展示了TestContext.assertNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestContext.assertNull()方法的具体详情如下:
包路径:io.vertx.ext.unit.TestContext
类名称:TestContext
方法名:assertNull

TestContext.assertNull介绍

暂无

代码示例

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Assert the <code>expected</code> argument is <code>null</code>. If the argument is not, an assertion error is thrown
 * otherwise the execution continue.
 * @param expected the argument being asserted to be null
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.unit.TestContext assertNull(Object expected) { 
 delegate.assertNull(expected);
 return this;
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Assert the <code>expected</code> argument is <code>null</code>. If the argument is not, an assertion error is thrown
 * otherwise the execution continue.
 * @param expected the argument being asserted to be null
 * @param message the failure message
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.unit.TestContext assertNull(Object expected, String message) { 
 delegate.assertNull(expected, message);
 return this;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Assert the <code>expected</code> argument is <code>null</code>. If the argument is not, an assertion error is thrown
 * otherwise the execution continue.
 * @param expected the argument being asserted to be null
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.unit.TestContext assertNull(Object expected) { 
 delegate.assertNull(expected);
 return this;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Assert the <code>expected</code> argument is <code>null</code>. If the argument is not, an assertion error is thrown
 * otherwise the execution continue.
 * @param expected the argument being asserted to be null
 * @param message the failure message
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.unit.TestContext assertNull(Object expected, String message) { 
 delegate.assertNull(expected, message);
 return this;
}

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static io.vertx.ext.unit.TestContext assertNull(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object expected, java.lang.String message) {
 io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.assertNull(io.vertx.core.impl.ConversionHelper.toObject(expected),
  message));
 return j_receiver;
}
public static io.vertx.ext.unit.TestContext assertNotNull(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object expected) {

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static io.vertx.ext.unit.TestContext assertNull(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object expected) {
 io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.assertNull(io.vertx.core.impl.ConversionHelper.toObject(expected)));
 return j_receiver;
}
public static io.vertx.ext.unit.TestContext assertNull(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object expected, java.lang.String message) {

代码示例来源:origin: io.vertx/vertx-shell

@Test
public void testDeployWithOptionsAsInvalidJsonString(TestContext context) {
 String cmd = "verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle '{'";
 String result = testDeployCmd(context, cmd);
 String msg =
  "Could not deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle with deployment options";
 context.assertNull(ctx.get());
 context.assertTrue(result.startsWith(msg));
}

代码示例来源:origin: io.vertx/vertx-config-vault

/**
 * Write a secret and verify that it can be read containing a null value.
 */
@Test
public void testWriteAndReadNull(TestContext tc) throws VaultException {
 final String path = "secret/null";
 final String value = null;
 Async async = tc.async();
 client.write(path, new JsonObject().put("value", value), x -> {
  tc.assertTrue(x.succeeded());
  client.read(path, ar -> {
   tc.assertTrue(ar.succeeded());
   tc.assertNull(ar.result().getData().getString("value"));
   async.complete();
  });
 });
}

代码示例来源:origin: eclipse/hono

/**
 * Verifies that the addDevice method returns not implemented.
 *
 * @param ctx The vertx unit test context.
 */
@Test
public void testAddDevice(final TestContext ctx) {
  // GIVEN an empty registry
  final CompleteBaseRegistrationService<ServiceConfigProperties> registrationService = newCompleteRegistrationService();
  registrationService.setRegistrationAssertionFactory(RegistrationAssertionHelperImpl.forSigning(vertx, props));
  // WHEN trying to add a new device
  registrationService.addDevice(Constants.DEFAULT_TENANT, "4711", new JsonObject(), ctx.asyncAssertSuccess(result -> {
    // THEN the response contain a JWT token with an empty result with status code 501.
    ctx.assertEquals(result.getStatus(), HttpURLConnection.HTTP_NOT_IMPLEMENTED);
    ctx.assertNull(result.getPayload());
  }));
}

代码示例来源:origin: eclipse/hono

/**
 * Verifies that the updateDevice method returns not implemented.
 *
 * @param ctx The vertx unit test context.
 */
@Test
public void testUpdateDevice(final TestContext ctx) {
  // GIVEN an empty registry
  final CompleteBaseRegistrationService<ServiceConfigProperties> registrationService = newCompleteRegistrationService();
  registrationService.setRegistrationAssertionFactory(RegistrationAssertionHelperImpl.forSigning(vertx, props));
  // WHEN trying to update a device
  registrationService.updateDevice(Constants.DEFAULT_TENANT, "4711", new JsonObject(), ctx.asyncAssertSuccess(result -> {
    // THEN the response contain a JWT token with an empty result with status code 501.
    ctx.assertEquals(result.getStatus(), HttpURLConnection.HTTP_NOT_IMPLEMENTED);
    ctx.assertNull(result.getPayload());
  }));
}

代码示例来源:origin: reactiverse/reactive-pg-client

@Test
public void testPreventLengthMaxIndexOutOfBoundGetColumnNameRows(TestContext ctx) {
 Async async = ctx.async();
 PgClient.connect(vertx, options, ctx.asyncAssertSuccess(conn -> {
  conn.query("SELECT 2 \"foo\"",
   ctx.asyncAssertSuccess(result -> {
    Row row = result.iterator().next();
    ctx.assertNull(row.getColumnName(1));
    async.complete();
   }));
 }));
}

代码示例来源:origin: reactiverse/reactive-pg-client

@Test
public void testNegativeGetColumnNameRows(TestContext ctx) {
 Async async = ctx.async();
 PgClient.connect(vertx, options, ctx.asyncAssertSuccess(conn -> {
  conn.query("SELECT 2 \"foo\"",
   ctx.asyncAssertSuccess(result -> {
    Row row = result.iterator().next();
    ctx.assertNull(row.getColumnName(-1));
    async.complete();
   }));
 }));
}

代码示例来源:origin: eclipse/hono

/**
 * Verifies that a disabled device's status cannot be asserted.
 * 
 * @param ctx The vertx unit test context.
 */
@Test
public void testAssertDeviceRegistrationFailsForDisabledDevice(final TestContext ctx) {
  // GIVEN a registry that contains a disabled device
  final BaseRegistrationService<ServiceConfigProperties> registrationService = newRegistrationService();
  registrationService.setRegistrationAssertionFactory(RegistrationAssertionHelperImpl.forSigning(vertx, props));
  // WHEN trying to assert the device's registration status
  registrationService.assertRegistration(Constants.DEFAULT_TENANT, "4712", ctx.asyncAssertSuccess(result -> {
    // THEN the response does not contain a JWT token
    ctx.assertEquals(result.getStatus(), HttpURLConnection.HTTP_NOT_FOUND);
    ctx.assertNull(result.getPayload());
  }));
}

代码示例来源:origin: eclipse/hono

/**
 * Verifies that the removeDevice method returns not implemented.
 *
 * @param ctx The vertx unit test context.
 */
@Test
public void testRemoveDevice(final TestContext ctx) {
  // GIVEN an empty registry
  final CompleteBaseRegistrationService<ServiceConfigProperties> registrationService = newCompleteRegistrationService();
  registrationService.setRegistrationAssertionFactory(RegistrationAssertionHelperImpl.forSigning(vertx, props));
  // WHEN trying to remove a device
  registrationService.removeDevice(Constants.DEFAULT_TENANT, "4711", ctx.asyncAssertSuccess(result -> {
    // THEN the response contain a JWT token with an empty result with status code 501.
    ctx.assertEquals(result.getStatus(), HttpURLConnection.HTTP_NOT_IMPLEMENTED);
    ctx.assertNull(result.getPayload());
  }));
}

代码示例来源:origin: apiman/apiman

@Test
public void testExceptionInExecuteBlock(TestContext context) {
  Async async = context.async();
  executeBlockingComponent.executeBlocking(future -> {
    throw new ExampleException("Desroches");
  },
  result -> {
    context.assertFalse(result.isSuccess());
    context.assertTrue(result.isError());
    context.assertTrue(result.getError() instanceof ExampleException);
    context.assertEquals(result.getError().getMessage(), "Desroches");
    context.assertNull(result.getResult());
    async.complete();
  });
}

代码示例来源:origin: apiman/apiman

@Test
public void testFailedExecution(TestContext context) {
  Async async = context.async();
  executeBlockingComponent.executeBlocking(future -> {
    future.fail(new ExampleException("Silhoutte"));
  },
  result -> {
    context.assertFalse(result.isSuccess());
    context.assertTrue(result.isError());
    context.assertTrue(result.getError() instanceof ExampleException);
    context.assertEquals(result.getError().getMessage(), "Silhoutte");
    context.assertNull(result.getResult());
    async.complete();
  });
}

代码示例来源:origin: vietj/vertx-http-proxy

@Test
public void testSuppressIncorrectWarningHeaders(TestContext ctx) {
 Async latch = ctx.async();
 SocketAddress backend = startHttpBackend(ctx, 8081, req -> {
  req.response()
    .putHeader("date", "Tue, 15 Nov 1994 08:12:30 GMT")
    .putHeader("warning", "199 Miscellaneous warning \"Tue, 15 Nov 1994 08:12:31 GMT\"")
   .end();
 });
 startProxy(backend);
 HttpClient client = vertx.createHttpClient();
 client.getNow(8080, "localhost", "/", resp -> {
  ctx.assertNotNull(resp.getHeader("date"));
  ctx.assertNull(resp.getHeader("warning"));
  latch.complete();
 });
}

代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client

@Test
public void testThatTaskNotSubmittedOnVertxEventLoopAreExecutedOnTheEventLoop(TestContext tc) {
 Async async = tc.async();
 final Context context = Vertx.currentContext();
 tc.assertNull(context);
 final Promise.DefaultPromise<String> promise = new Promise.DefaultPromise<>();
 promise.onComplete(ScalaUtils.toFunction1(v -> {
  tc.assertNotNull(Vertx.currentContext());
  async.complete();
 }), VertxEventLoopExecutionContext.create(vertx));
 promise.complete(new Success<>("hello"));
}

代码示例来源:origin: apiman/apiman

@Test
public void testSuccessfulExecution(TestContext context) {
  Async async = context.async();
  executeBlockingComponent.executeBlocking(future -> {
    future.completed("The Farquhar Islands");
  },
  result -> {
    context.assertTrue(result.isSuccess());
    context.assertFalse(result.isError());
    context.assertEquals(result.getResult(), "The Farquhar Islands");
    context.assertNull(result.getError());
    async.complete();
  });
}

代码示例来源:origin: io.vertx/vertx-shell

@Test
public void testSuspendProcess(TestContext context) throws Exception {
 TestTtyConnection conn = new TestTtyConnection(vertx);
 ShellImpl shell = createShell(conn);
 shell.init().readline();
 Async done = context.async();
 Async latch2 = context.async();
 commands.add(CommandBuilder.command("foo").processHandler(process -> {
  Job job = shell.jobController().getJob(1);
  process.suspendHandler(v -> {
   context.assertEquals(ExecStatus.STOPPED, job.status());
   context.assertNull(shell.jobController().foregroundJob());
   done.complete();
  });
  latch2.complete();
 }));
 conn.read("foo\r");
 latch2.awaitSuccess(10000);
 conn.sendEvent(TtyEvent.SUSP);
}

相关文章