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

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

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

TestContext.put介绍

暂无

代码示例

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

/**
 * Put some data in the context.
 * <p>
 * This can be used to share data between different tests and before/after phases.
 * @param key the key of the data
 * @param value the data
 * @return the previous object when it exists
 */
public <T> T put(String key, Object value) { 
 T ret = (T) delegate.put(key, value);
 return ret;
}

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

/**
 * Put some data in the context.
 * <p>
 * This can be used to share data between different tests and before/after phases.
 * @param key the key of the data
 * @param value the data
 * @return the previous object when it exists
 */
public <T> T put(String key, Object value) { 
 T ret = (T) delegate.put(key, value);
 return ret;
}

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

public static <T>java.lang.Object put(io.vertx.ext.unit.TestContext j_receiver, java.lang.String key, java.lang.Object value) {
 return io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.put(key,
  io.vertx.core.impl.ConversionHelper.toObject(value)));
}
public static <T>java.lang.Object remove(io.vertx.ext.unit.TestContext j_receiver, java.lang.String key) {

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

@Before
public void before(TestContext context) {
 beforeMethodCount = context.get("count");
 context.put("count", count++);
}
@Test

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

@AfterClass
 public static void afterClass(TestContext context) {
  afterClassCount = context.get("count");
  context.put("count", count++);
 }
}

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

@Test
public void testMethod(TestContext context) {
 testMethodCount = context.get("count");
 context.put("count", count++);
}
@After

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

@BeforeClass
public static void beforeClass(TestContext context) {
 beforeClassCount = context.get("count");
 context.put("count", count++);
}
@Before

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

@After
public void after(TestContext context) {
 afterMethodCount = context.get("count");
 context.put("count", count++);
}
@AfterClass

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

before.add(value);
 context.put("value", -10);
}).beforeEach(context -> {
 Integer value = context.get("value");
 beforeEach.add(value);
 context.put("value", count.getAndIncrement());
}).test("my_test0", context -> {
 int value = context.get("value");
 test0.set(value);
 context.put("value", value * 2);
}).test("my_test1", context -> {
 int value = context.get("value");
 test1.set(context.get("value"));
 context.put("value", value * 2);
}).afterEach(context -> {
 int value = context.get("value");

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

@Test
public void testAttributesOperations() throws Exception {
 TestSuite suite = TestSuite.create("my_suite").test("my_test", context -> {
  context.assertEquals(null, context.get("value"));
  context.assertEquals(null, context.put("value", 4));
  context.assertEquals(4, context.get("value"));
  context.assertEquals(4, context.put("value", 5));
  context.assertEquals(5, context.get("value"));
  context.assertEquals(5, context.remove("value"));
  context.assertEquals(null, context.get("value"));
 });
 TestReporter reporter = new TestReporter();
 run(suite, reporter);
 reporter.await();
 assertEquals(0, reporter.exceptions.size());
 assertEquals(1, reporter.results.size());
 assertEquals("my_test", reporter.results.get(0).name());
 assertFalse(reporter.results.get(0).failed());
}

相关文章