當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。