当前位置: 首页>>代码示例>>Java>>正文


Java TestContext.assertEquals方法代码示例

本文整理汇总了Java中io.vertx.ext.unit.TestContext.assertEquals方法的典型用法代码示例。如果您正苦于以下问题:Java TestContext.assertEquals方法的具体用法?Java TestContext.assertEquals怎么用?Java TestContext.assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.unit.TestContext的用法示例。


在下文中一共展示了TestContext.assertEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testParams

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testParams(TestContext context) {
    MultiMap params = request.params();
    context.assertEquals(2, params.size());
    context.assertEquals("1", params.get("p1"));
    context.assertEquals("2", params.get("p2"));
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:8,代码来源:HttpServerRequestImplTest.java

示例2: testProduce1

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testProduce1(final TestContext context) throws NoSuchMethodException {
    final Method method = Media.class.getDeclaredMethod("sayH");
    final Set<MediaType> types = MediaResolver.produces(method);
    context.assertEquals(1, types.size());
    context.assertTrue(types.contains(MediaType.WILDCARD_TYPE));
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:8,代码来源:MediaResolverTc.java

示例3: test_vertxCallbackAsyncTest

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void test_vertxCallbackAsyncTest(TestContext context) {
	Async async = context.async();
	
	context.assertTrue(vertx.getOrCreateContext().isEventLoopContext());
	long threadId = Thread.currentThread().getId();
	
	AsyncDataFetcher<String> asyncDataFetcher = (env, handler) -> {
		context.assertTrue(vertx.getOrCreateContext().isEventLoopContext());
		context.assertEquals(threadId, Thread.currentThread().getId());
		
		vertx.<String> executeBlocking(fut -> {
			context.assertNotEquals(threadId, Thread.currentThread().getId());
			fut.complete("world");
		}, handler);
	};
	
	GraphQLObjectType query = GraphQLObjectType.newObject()
	        .name("query")
	        .field(GraphQLFieldDefinition.newFieldDefinition()
	                .name("hello")
	                .type(Scalars.GraphQLString)
	                .dataFetcher(asyncDataFetcher))
	        .build(); 
	
	GraphQLSchema schema = GraphQLSchema.newSchema()
			.query(query)
			.build();
	
	AsyncGraphQLExec asyncGraphQL = AsyncGraphQLExec.create(schema);
	Future<JsonObject> queryResult = asyncGraphQL.executeQuery("query { hello }", null, null, null);
	queryResult.setHandler(res -> {
		context.assertTrue(vertx.getOrCreateContext().isEventLoopContext());
       	context.assertEquals(threadId, Thread.currentThread().getId());
		async.complete();
	});
}
 
开发者ID:tibor-kocsis,项目名称:vertx-graphql-utils,代码行数:38,代码来源:VertxThreadTest.java

示例4: testMethod1

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testMethod1(final TestContext context)
        throws NoSuchMethodException {
    final Method method = RMethod1.class.getDeclaredMethod("sayHell");
    final HttpMethod httpMethod = MethodResolver.resolve(method);
    context.assertEquals(HttpMethod.GET, httpMethod);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:8,代码来源:MethodResolverTc.java

示例5: testEnd

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testEnd(TestContext context) {
    String data = "End the response";
    int dataLength = data.length();
    response.end(data);

    JsonObject output = readOuput();
    context.assertEquals(Integer.toString(dataLength), output.getJsonObject("headers").getString("Content-Length"));
    context.assertEquals(data, new String(output.getBinary("body")));
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:11,代码来源:HttpServerResponseImplTest.java

示例6: testAnnos

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testAnnos(final TestContext context) {
    final ConcurrentMap<String, Annotation> clazzes = Anno.get(AnnoOne.class);
    for (final String item : clazzes.keySet()) {
        System.out.println("key=" + item + ",value=" + clazzes.get(item));
    }
    context.assertEquals(2, clazzes.size());
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:9,代码来源:AnnoTc.java

示例7: testMd1

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testMd1(final TestContext context) {
    final Set<String> pathes = parseMethod(Method1.class);
    final Set<String> expected = new TreeSet<String>() {
        {
            add("/api/test");
        }
    };
    context.assertEquals(expected, pathes);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:11,代码来源:PathResolverTc.java

示例8: async_behavior

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test /*(timeout=5000)*/  // <8>
public void async_behavior(TestContext context) { // <1>
  Vertx vertx = Vertx.vertx();  // <2>
  context.assertEquals("foo", "foo");  // <3>
  Async a1 = context.async();   // <4>
  Async a2 = context.async(3);  // <5>
  vertx.setTimer(100, n -> a1.complete());  // <6>
  vertx.setPeriodic(100, n -> a2.countDown());  // <7>
}
 
开发者ID:vert-x3,项目名称:vertx-guide-for-java-devs,代码行数:10,代码来源:WikiDatabaseVerticleTest.java

示例9: testHandleDataRequestPath

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testHandleDataRequestPath(TestContext context) {
    request = new HttpServerRequestImpl(localHost, localPort, requestPath, response);
    request.bodyHandler(buffer -> {
        context.assertEquals("request line 1\nrequest line 2\nrequest line 3", buffer.toString());
    });
    request.handleData();
    request.handleEnd();
    context.assertEquals("/path1", request.path());
    context.assertEquals("", request.query());
    context.assertTrue(request.headers().isEmpty());
    context.assertEquals("http://localhost:8888/path1", request.absoluteURI());
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:14,代码来源:HttpServerRequestImplTest.java

示例10: testHandleDataRequestPathMultiple

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testHandleDataRequestPathMultiple(TestContext context) {
    request = new HttpServerRequestImpl(localHost, localPort, requestPathMultiple, response);
    request.bodyHandler(buffer -> {
        context.assertEquals("", buffer.toString());
    });
    request.handleData();
    request.handleEnd();
    context.assertEquals("/path1/path2/path3", request.path());
    context.assertEquals("http://localhost:8888/path1/path2/path3", request.absoluteURI());
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:12,代码来源:HttpServerRequestImplTest.java

示例11: testBytesWritten

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testBytesWritten(TestContext context) {
    String data = "Some response data";
    int dataLength = data.length();
    response.end(data);
    JsonObject output = readOuput();
    context.assertEquals((long) dataLength, response.bytesWritten());
    context.assertEquals(Integer.toString(dataLength), output.getJsonObject("headers").getString("Content-Length"));
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:10,代码来源:HttpServerResponseImplTest.java

示例12: testMd3

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testMd3(final TestContext context) {
    final Set<String> pathes = parseMethod(Method3.class);
    final Set<String> expected = new TreeSet<String>() {
        {
            add("/api/test/:name");
            add("/api/test/:id");
        }
    };
    context.assertEquals(expected, pathes);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:12,代码来源:PathResolverTc.java

示例13: verifyMissHandler

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
private Handler<HttpClientResponse> verifyMissHandler(TestContext context, Async f) {
	return r -> {
		context.assertEquals(404,  r.statusCode(), "Should have received an error for incorrect type");
		f.complete();
	};
}
 
开发者ID:GreenfieldTech,项目名称:irked,代码行数:7,代码来源:TestConsumes.java

示例14: testHandler

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testHandler(TestContext context) {
    context.assertEquals(request, request.handler(ar -> {
    }));
}
 
开发者ID:noseka1,项目名称:vertx-aws-lambda,代码行数:6,代码来源:HttpServerRequestImplTest.java

示例15: testRt1

import io.vertx.ext.unit.TestContext; //导入方法依赖的package包/类
@Test
public void testRt1(final TestContext context) {
    context.assertEquals("/api", parseRoot(Root1.class));
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:5,代码来源:PathResolverTc.java


注:本文中的io.vertx.ext.unit.TestContext.assertEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。