本文整理了Java中io.vertx.ext.unit.TestContext.assertTrue()
方法的一些代码示例,展示了TestContext.assertTrue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestContext.assertTrue()
方法的具体详情如下:
包路径:io.vertx.ext.unit.TestContext
类名称:TestContext
方法名:assertTrue
暂无
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Assert the specified <code>condition</code> is <code>true</code>. If the condition is <code>false</code>, an assertion error is thrown
* otherwise the execution continue.
* @param condition the condition to assert
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.unit.TestContext assertTrue(boolean condition) {
delegate.assertTrue(condition);
return this;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Assert the specified <code>condition</code> is <code>true</code>. If the condition is <code>false</code>, an assertion error is thrown
* otherwise the execution continue.
* @param condition the condition to assert
* @param message the failure message
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.unit.TestContext assertTrue(boolean condition, String message) {
delegate.assertTrue(condition, message);
return this;
}
代码示例来源:origin: reactiverse/reactive-pg-client
private static <T> void compare(TestContext ctx, T expected, T actual) {
if (expected != null && expected.getClass().isArray()) {
ctx.assertNotNull(actual);
ctx.assertTrue(actual.getClass().isArray());
List expectedList = Arrays.asList((Object[]) expected);
List actualList = Arrays.asList((Object[]) actual);
ctx.assertEquals(expectedList, actualList);
} else {
ctx.assertEquals(expected, actual);
}
}
代码示例来源:origin: io.vertx/vertx-shell
@Override
public void complete(String value, boolean terminal) {
context.assertTrue(terminal);
context.assertEquals("oo", value);
async.complete();
}
});
代码示例来源:origin: io.vertx/vertx-shell
@Override
public void complete(String value, boolean terminal) {
context.assertTrue(terminal);
context.assertEquals("", value);
async.complete();
}
});
代码示例来源:origin: io.vertx/vertx-consul-client
private void tryClient(TestContext tc, ConsulClient client, String expectedExceptionMessageSubstring) {
client.agentInfo(tc.asyncAssertFailure(t -> {
tc.assertTrue(t.getMessage().contains(expectedExceptionMessageSubstring));
ctx.closeClient(client);
}));
}
}
代码示例来源:origin: io.vertx/vertx-config-consul
@Test
public void getEmptyConfig(TestContext tc) {
Async async = tc.async();
createRetriever();
retriever.getConfig(json -> {
tc.assertTrue(json.succeeded());
tc.assertTrue(json.result().isEmpty());
async.complete();
});
}
代码示例来源:origin: io.vertx/vertx-mqtt
@Test
public void connected(TestContext context) {
try {
MemoryPersistence persistence = new MemoryPersistence();
MqttClient client = new MqttClient(String.format("tcp://%s:%d", MQTT_SERVER_HOST, MQTT_SERVER_PORT), "12345", persistence);
client.connect();
context.assertTrue(client.isConnected() && this.endpoint.isConnected());
} catch (MqttException e) {
context.assertTrue(false);
e.printStackTrace();
}
}
代码示例来源:origin: eclipse/hono
/**
* Verifies that the provider fails to authenticate a device when not
* running on a vert.x Context.
*
* @param ctx The vert.x test context.
*/
@Test
public void testAuthenticateRequiresVertxContext(final TestContext ctx) {
provider.authenticate(deviceCredentials, null, ctx.asyncAssertFailure(e -> {
ctx.assertTrue(e instanceof IllegalStateException);
}));
}
代码示例来源:origin: io.vertx/vertx-web-templ-pebble
@Test
public void noLocaleShouldUseDefaultLocale(TestContext should) {
final Async test = should.async();
Locale.setDefault(Locale.US);
final TemplateEngine engine = PebbleTemplateEngine.create(vertx);
engine.render(new JsonObject(), "src/test/filesystemtemplates/test-pebble-template-i18n.peb", render2 -> {
should.assertTrue(render2.succeeded());
should.assertEquals("Hi", render2.result().toString());
test.complete();
});
test.await();
}
代码示例来源:origin: io.vertx/vertx-web-templ-freemarker
@Test
public void testNoSuchTemplate(TestContext should) {
final Async test = should.async();
TemplateEngine engine = FreeMarkerTemplateEngine.create(vertx);
engine.render(new JsonObject(), "not-found", render -> {
should.assertTrue(render.failed());
test.complete();
});
test.await();
}
代码示例来源:origin: io.vertx/vertx-web-client
@Override
public void start() throws Exception {
vertx.eventBus().consumer("test", m -> {
client.get(host, uri).send(ar -> {
testContext.assertTrue(ar.succeeded());
async.countDown();
});
});
}
};
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeployWithOptionsAsJsonConfig(TestContext context) {
String cmd =
"verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle '{\"config\":{\"ok\":true}}'";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(1, ctx.get().getInstanceCount());
context.assertNotNull(ctx.get().config());
context.assertTrue(ctx.get().config().containsKey("ok"));
context.assertEquals(true, ctx.get().config().getBoolean("ok"));
}
代码示例来源:origin: io.vertx/vertx-consul-client
private void createKV(TestContext tc, String key, String value, Handler<Long> resultHandler) {
ctx.writeClient().putValue(key, value, tc.asyncAssertSuccess(b -> {
tc.assertTrue(b);
ctx.readClient().getValue(key, tc.asyncAssertSuccess(pair -> {
resultHandler.handle(pair.getModifyIndex());
}));
}));
}
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testEOF(TestContext context) throws Exception {
TestTtyConnection conn = new TestTtyConnection(vertx);
ShellImpl shell = createShell(conn);
shell.init().readline();
conn.read("\u0004");
context.assertTrue(conn.getCloseLatch().await(2, TimeUnit.SECONDS));
}
代码示例来源:origin: de.braintags/netrelay
@Test
public void testProcessor(TestContext context) throws Exception {
try {
Async async = context.async();
DemoProcessor.async = async;
context.assertEquals(DEMO_PROPERTY, demoProperty, "init does not seem to be handled");
async.await(WAITTIME);
context.assertTrue(eventProcessed, "the event wasn't processed");
} catch (Exception e) {
context.fail(e);
}
}
代码示例来源:origin: io.vertx/vertx-consul-client
@Test
public void closedConnection(TestContext tc) {
BrokenHttpServer brokenConsul = new BrokenHttpServer(vertx);
ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(brokenConsul.port()));
client.agentInfo(tc.asyncAssertFailure(t -> {
ctx.closeClient(client);
brokenConsul.close();
tc.assertTrue(t.getMessage().contains("Connection was closed"));
}));
}
代码示例来源:origin: io.vertx/vertx-consul-client
@Test
public void timeout(TestContext tc) {
SlowHttpServer slowConsul = new SlowHttpServer(vertx, 10000);
ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(slowConsul.port()).setTimeout(1000));
client.agentInfo(tc.asyncAssertFailure(t -> {
ctx.closeClient(client);
slowConsul.close();
tc.assertTrue(t.getMessage().contains("The timeout period of 1000ms"));
}));
}
代码示例来源:origin: reactiverse/reactive-pg-client
@Test
public void testTLSTrustAll(TestContext ctx) {
Async async = ctx.async();
PgClient.connect(vertx, new PgConnectOptions(options).setSslMode(SslMode.REQUIRE).setTrustAll(true), ctx.asyncAssertSuccess(conn -> {
ctx.assertTrue(conn.isSSL());
async.complete();
}));
}
代码示例来源:origin: reactiverse/reactive-pg-client
@Test
public void testSslModePrefer(TestContext ctx) {
Async async = ctx.async();
PgConnectOptions options = new PgConnectOptions(TLSTest.options)
.setSslMode(SslMode.PREFER)
.setTrustAll(true);
PgClient.connect(vertx, new PgConnectOptions(options), ctx.asyncAssertSuccess(conn -> {
ctx.assertTrue(conn.isSSL());
async.complete();
}));
}
内容来源于网络,如有侵权,请联系作者删除!