本文整理汇总了Java中java.time.Instant.minusNanos方法的典型用法代码示例。如果您正苦于以下问题:Java Instant.minusNanos方法的具体用法?Java Instant.minusNanos怎么用?Java Instant.minusNanos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.Instant
的用法示例。
在下文中一共展示了Instant.minusNanos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: minusNanos_long
import java.time.Instant; //导入方法依赖的package包/类
@Test(dataProvider="MinusNanos")
public void minusNanos_long(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Instant i = Instant.ofEpochSecond(seconds, nanos);
i = i.minusNanos(amount);
assertEquals(i.getEpochSecond(), expectedSeconds);
assertEquals(i.getNano(), expectedNanoOfSecond);
}
示例2: thatCalculateLastPassedThresholdThrowsExceptionWhenCurrentIsBeforeStart
import java.time.Instant; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void thatCalculateLastPassedThresholdThrowsExceptionWhenCurrentIsBeforeStart() {
Instant start = Instant.now();
Instant current = start.minusNanos(1);
List<Duration> thresholds = Collections.singletonList(Duration.ofDays(1));
OfflineDevicesJobImpl.calculateLastPassedThreshold(start, current, thresholds);
}
开发者ID:pietvandongen,项目名称:pure-bliss-with-pure-java-functions,代码行数:9,代码来源:OfflineDevicesJobTests.java
示例3: minusNanos_long_overflowTooBig
import java.time.Instant; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void minusNanos_long_overflowTooBig() {
Instant i = Instant.ofEpochSecond(MAX_SECOND, 999999999);
i.minusNanos(-1);
}
示例4: minusNanos_long_overflowTooSmall
import java.time.Instant; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void minusNanos_long_overflowTooSmall() {
Instant i = Instant.ofEpochSecond(MIN_SECOND, 0);
i.minusNanos(1);
}