本文整理匯總了Java中java.time.Instant.plusNanos方法的典型用法代碼示例。如果您正苦於以下問題:Java Instant.plusNanos方法的具體用法?Java Instant.plusNanos怎麽用?Java Instant.plusNanos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.time.Instant
的用法示例。
在下文中一共展示了Instant.plusNanos方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: plusNanos_long
import java.time.Instant; //導入方法依賴的package包/類
@Test(dataProvider="PlusNanos")
public void plusNanos_long(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Instant t = Instant.ofEpochSecond(seconds, nanos);
t = t.plusNanos(amount);
assertEquals(t.getEpochSecond(), expectedSeconds);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
示例2: thatCalculateLastPassedThresholdThrowsExceptionWhenThresholdsAreEmpty
import java.time.Instant; //導入方法依賴的package包/類
@Test(expected = IllegalArgumentException.class)
public void thatCalculateLastPassedThresholdThrowsExceptionWhenThresholdsAreEmpty() {
Instant start = Instant.now();
Instant current = start.plusNanos(1);
List<Duration> thresholds = Collections.emptyList();
OfflineDevicesJobImpl.calculateLastPassedThreshold(start, current, thresholds);
}
開發者ID:pietvandongen,項目名稱:pure-bliss-with-pure-java-functions,代碼行數:9,代碼來源:OfflineDevicesJobTests.java
示例3: plusNanos_long_overflowTooBig
import java.time.Instant; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void plusNanos_long_overflowTooBig() {
Instant t = Instant.ofEpochSecond(MAX_SECOND, 999999999);
t.plusNanos(1);
}
示例4: plusNanos_long_overflowTooSmall
import java.time.Instant; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void plusNanos_long_overflowTooSmall() {
Instant t = Instant.ofEpochSecond(MIN_SECOND, 0);
t.plusNanos(-1);
}