/** * Assert the <code>first</code> argument is not equals to the <code>second</code> argument. If the arguments are equals * an assertion error is thrown otherwise the execution continue. * @param first the first object to test * @param second the second object to test * @param message the failure message * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.unit.TestContext assertNotEquals(Object first, Object second, String message) { delegate.assertNotEquals(first, second, message); return this; }
/** * Assert the <code>first</code> argument is not equals to the <code>second</code> argument. If the arguments are equals * an assertion error is thrown otherwise the execution continue. * @param first the first object to test * @param second the second object to test * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.unit.TestContext assertNotEquals(Object first, Object second) { delegate.assertNotEquals(first, second); return this; }
/** * Assert the <code>first</code> argument is not equals to the <code>second</code> argument. If the arguments are equals * an assertion error is thrown otherwise the execution continue. * @param first the first object to test * @param second the second object to test * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.unit.TestContext assertNotEquals(Object first, Object second) { delegate.assertNotEquals(first, second); return this; }
/** * Assert the <code>first</code> argument is not equals to the <code>second</code> argument. If the arguments are equals * an assertion error is thrown otherwise the execution continue. * @param first the first object to test * @param second the second object to test * @param message the failure message * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.unit.TestContext assertNotEquals(Object first, Object second, String message) { delegate.assertNotEquals(first, second, message); return this; }
public static io.vertx.ext.unit.TestContext assertNotEquals(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object first, java.lang.Object second) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.assertNotEquals(io.vertx.core.impl.ConversionHelper.toObject(first), io.vertx.core.impl.ConversionHelper.toObject(second))); return j_receiver; } public static io.vertx.ext.unit.TestContext assertNotEquals(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object first, java.lang.Object second, java.lang.String message) {
public static io.vertx.ext.unit.TestContext assertNotEquals(io.vertx.ext.unit.TestContext j_receiver, java.lang.Object first, java.lang.Object second, java.lang.String message) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.assertNotEquals(io.vertx.core.impl.ConversionHelper.toObject(first), io.vertx.core.impl.ConversionHelper.toObject(second), message)); return j_receiver; } public static <T>io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Object>> asyncAssertSuccess(io.vertx.ext.unit.TestContext j_receiver) {
@Test public void testWrite(TestContext context) throws IOException { startTelnet(context, term -> { term.write("hello_from_server"); }); client.connect("localhost", server.actualPort()); Reader reader = new InputStreamReader(client.getInputStream()); StringBuilder sb = new StringBuilder("hello_from_server"); while (sb.length() > 0) { int c = reader.read(); context.assertNotEquals(-1, c); context.assertEquals(c, (int)sb.charAt(0)); sb.deleteCharAt(0); } }
@Test public void testUnequality(final TestContext context) { final TopicPartition t1 = new TopicPartition("topic1", 0); final TopicPartition t2 = new TopicPartition("topic1", 1); final TopicPartition t3 = new TopicPartition("topic2", 0); final TopicPartition t4 = new TopicPartition("topic2", 1); final JsonObject t5 = new JsonObject(); context.assertNotEquals(t1, t2); context.assertNotEquals(t1.hashCode(), t2.hashCode()); context.assertNotEquals(t3, t4); context.assertNotEquals(t3.hashCode(), t4.hashCode()); context.assertNotEquals(t3, t5); context.assertNotEquals(t3.hashCode(), t5.hashCode()); context.assertFalse(t1.equals(null)); context.assertFalse(t1.equals(t5)); } }
@Test public void shouldRefreshAToken(TestContext should) { final Async test = should.async(); keycloak.authenticate(new JsonObject().put("username", "test-user").put("password", "tiger"), authn -> { should.assertTrue(authn.succeeded()); should.assertNotNull(authn.result()); // generate a access token from the user AccessToken token = (AccessToken) authn.result(); final String origToken = token.opaqueAccessToken(); token.refresh(refresh -> { should.assertTrue(refresh.succeeded()); should.assertNotEquals(origToken, token.opaqueAccessToken()); test.complete(); }); }); }
@Test public void testBilto(TestContext ctx) throws Exception { Async started = ctx.async(); List<GrpcVerticle> verticles = Collections.synchronizedList(new ArrayList<>()); vertx.deployVerticle(() -> { GrpcVerticle verticle = new GrpcVerticle(0); verticles.add(verticle); return verticle; }, new DeploymentOptions().setInstances(2), ctx.asyncAssertSuccess(v -> started.complete())); started.awaitSuccess(10000); ctx.assertEquals(2, verticles.size()); ctx.assertNotEquals(verticles.get(0).server.getPort(), verticles.get(1).server.getPort()); } }
@Test public void testSendMessageWithReplyBacktrack(TestContext context) { // Send a request and get a response NetClient client = vertx.createNetClient(); final Async async = context.async(); client.connect(7000, "localhost", conn -> { context.assertFalse(conn.failed()); NetSocket socket = conn.result(); final FrameParser parser = new FrameParser(parse -> { context.assertTrue(parse.succeeded()); JsonObject frame = parse.result(); context.assertNotEquals("err", frame.getString("type")); context.assertEquals("Hello vert.x", frame.getJsonObject("body").getString("value")); client.close(); async.complete(); }); socket.handler(parser); FrameHelper.sendFrame("send", "hello", "#backtrack", new JsonObject().put("value", "vert.x"), socket); }); }
protected void checkConsistency(TestContext context, Async async, SQLConnection conn, long id1, String name1, long id2, String name2) { conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id1), ar5 -> { ensureSuccess(context, ar5); ResultSet resultSet1 = ar5.result(); context.assertEquals(name1, resultSet1.getResults().get(0).getString(0)); conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id2), ar6 -> { ensureSuccess(context, ar6); ResultSet resultSet2 = ar6.result(); context.assertNotEquals(id1, id2); context.assertEquals(name2, resultSet2.getResults().get(0).getString(0)); async.complete(); }); }); }
protected void checkConsistency(TestContext context, Async async, SQLConnection conn, long id1, String name1, long id2, String name2) { conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id1), ar5 -> { ensureSuccess(context, ar5); ResultSet resultSet1 = ar5.result(); context.assertEquals(name1, resultSet1.getResults().get(0).getString(0)); conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id2), ar6 -> { ensureSuccess(context, ar6); ResultSet resultSet2 = ar6.result(); context.assertNotEquals(id1, id2); context.assertEquals(name2, resultSet2.getResults().get(0).getString(0)); async.complete(); }); }); }
protected void checkConsistency(TestContext context, Async async, SQLConnection conn, long id1, String name1, long id2, String name2) { conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id1), ar5 -> { ensureSuccess(context, ar5); ResultSet resultSet1 = ar5.result(); context.assertEquals(name1, resultSet1.getResults().get(0).getString(0)); conn.queryWithParams("SELECT name FROM test_table WHERE id = ?", new JsonArray().add(id2), ar6 -> { ensureSuccess(context, ar6); ResultSet resultSet2 = ar6.result(); context.assertNotEquals(id1, id2); context.assertEquals(name2, resultSet2.getResults().get(0).getString(0)); async.complete(); }); }); }
@Test public void testCharset(TestContext context) { Async async = context.async(); showEncoding(context, "iso-8859-1", encoding1 -> { showEncoding(context, "utf-8", encoding2 -> { context.assertNotEquals(encoding1, encoding2); async.complete(); }); }); }
@Test public void testCharset(TestContext context) { Async async = context.async(); showEncoding(context, "iso-8859-1", encoding1 -> { showEncoding(context, "utf-8", encoding2 -> { context.assertNotEquals(encoding1, encoding2); async.complete(); }); }); }
@Test public void testCharset(TestContext context) { Async async = context.async(); showEncoding(context, "iso-8859-1", encoding1 -> { showEncoding(context, "utf-8", encoding2 -> { context.assertNotEquals(encoding1, encoding2); async.complete(); }); }); }
@Test public void testNotEqualGetColumnNameRows(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.assertNotEquals("bar",row.getColumnName(0)); async.complete(); })); })); }
@Test public void testPublicExpiration(TestContext ctx) throws Exception { Async latch = ctx.async(); testPublic(ctx, resp1 -> { vertx.setTimer(6000, id -> { client.getNow(8080, "localhost", "/", resp2 -> { ctx.assertEquals(200, resp2.statusCode()); resp2.bodyHandler(buff2 -> { ctx.assertEquals("content", buff2.toString()); ctx.assertEquals(2, hits.get()); ctx.assertNotEquals(resp1.getHeader(HttpHeaders.DATE), resp2.getHeader(HttpHeaders.DATE)); latch.complete(); }); }); }); }); }
@Test public void testPublicInvalidClientMaxAge(TestContext ctx) throws Exception { Async latch = ctx.async(); testPublic(ctx, resp1 -> { vertx.setTimer(1000, id -> { client.get(8080, "localhost", "/", resp2 -> { ctx.assertEquals(200, resp2.statusCode()); resp2.bodyHandler(buff2 -> { ctx.assertEquals("content", buff2.toString()); ctx.assertEquals(2, hits.get()); ctx.assertNotEquals(resp1.getHeader(HttpHeaders.DATE), resp2.getHeader(HttpHeaders.DATE)); latch.complete(); }); }).putHeader(HttpHeaders.CACHE_CONTROL, "max-age=1").end(); }); }); }