本文整理了Java中com.englishtown.promises.Promise.yield()
方法的一些代码示例,展示了Promise.yield()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Promise.yield()
方法的具体详情如下:
包路径:com.englishtown.promises.Promise
类名称:Promise
方法名:yield
[英]Shortcut for .then(function() { return value; })
[中]捷径。然后(函数(){return value;})
代码示例来源:origin: ef-labs/when.java
/**
* {@inheritDoc}
*/
@Override
public Promise<T> tap(Function<T, Thenable<T>> onFulfilledSideEffect) {
return this.then(onFulfilledSideEffect).yield(this);
}
代码示例来源:origin: ef-labs/when.java
@Test
public void testPromise_yield_should_return_a_promise() {
assertNotNull(when.defer().getPromise().yield(null));
}
代码示例来源:origin: ef-labs/when.java
@Test
public void testPromise_yield_should_reject_with_the_reason_of_a_rejected_promise() {
when.resolve(other)
.yield(when.reject(sentinelEx))
.then(
fail.onFulfilled,
(reason) -> {
assertEquals(sentinelEx, reason);
return null;
}
)
.ensure(done::fulfill);
done.assertFulfilled();
}
代码示例来源:origin: ef-labs/when.java
@Test
public void testPromise_yield_should_fulfill_with_value_of_a_fulfilled_promise() {
when.resolve(other)
.yield(resolved(sentinel))
.then(
(value) -> {
assertEquals(sentinel, value);
return null;
}
)
.ensure(done::fulfill);
done.assertFulfilled();
}
内容来源于网络,如有侵权,请联系作者删除!