本文整理汇总了Java中org.threeten.bp.Instant.plusSeconds方法的典型用法代码示例。如果您正苦于以下问题:Java Instant.plusSeconds方法的具体用法?Java Instant.plusSeconds怎么用?Java Instant.plusSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.Instant
的用法示例。
在下文中一共展示了Instant.plusSeconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: data_timeBounds
import org.threeten.bp.Instant; //导入方法依赖的package包/类
@DataProvider(name = "timeBounds")
Object[][] data_timeBounds() {
Instant now = Instant.now();
return new Object[][] {
{null, null, null, true},
{null, now.minusSeconds(20), null, true},
{null, now.plusSeconds(20), null, false},
{null, null, now.minusSeconds(20), false},
{null, null, now.plusSeconds(20), true},
{now, null, null, true},
{now, now.minusSeconds(20), null, true},
{now, now.plusSeconds(20), null, false},
{now, null, now.minusSeconds(20), false},
{now, null, now.plusSeconds(20), true},
{now, now.minusSeconds(20), now.plusSeconds(20), true},
{now, now.minusSeconds(40), now.minusSeconds(20), false},
{now, now.minusSeconds(20), now.minusSeconds(40), false},
{now, now.plusSeconds(20), now.plusSeconds(40), false},
{now, now.plusSeconds(40), now.plusSeconds(20), false},
};
}
示例2: testFinerLock
import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void testFinerLock() {
final ViewExecutionCacheLock locks = new ViewExecutionCacheLock();
final ViewExecutionCacheKey keyA = ViewExecutionCacheKey.of(viewDefinition(), marketDataProvider("A"), null);
final ViewExecutionCacheKey keyB = ViewExecutionCacheKey.of(viewDefinition(), marketDataProvider("B"), null);
final Instant valuationTimeA = Instant.now();
final Instant valuationTimeB = valuationTimeA.plusSeconds(100);
final VersionCorrection resolverVersionCorrectionA = VersionCorrection.of(valuationTimeA.minusSeconds(1), valuationTimeA.minusSeconds(2));
final VersionCorrection resolverVersionCorrectionB = VersionCorrection.of(valuationTimeA.minusSeconds(3), valuationTimeA.minusSeconds(3));
@SuppressWarnings("unchecked")
final Pair<Lock, Lock>[] ls = new Pair[] {locks.get(keyA, valuationTimeA, resolverVersionCorrectionA), locks.get(keyA, valuationTimeA, resolverVersionCorrectionB),
locks.get(keyA, valuationTimeB, resolverVersionCorrectionA), locks.get(keyA, valuationTimeB, resolverVersionCorrectionB),
locks.get(keyB, valuationTimeA, resolverVersionCorrectionA), locks.get(keyB, valuationTimeA, resolverVersionCorrectionB),
locks.get(keyB, valuationTimeB, resolverVersionCorrectionA), locks.get(keyB, valuationTimeB, resolverVersionCorrectionB) };
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if ((i < 4) == (j < 4)) {
assertSame(ls[j].getFirst(), ls[i].getFirst());
} else {
assertNotSame(ls[j].getFirst(), ls[i].getFirst());
}
if (i != j) {
assertNotSame(ls[j].getSecond(), ls[i].getSecond());
}
}
}
assertSame(locks.get(keyA, valuationTimeA, resolverVersionCorrectionB).getSecond(), ls[1].getSecond());
}