本文整理汇总了Java中java.time.Duration.minusMillis方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.minusMillis方法的具体用法?Java Duration.minusMillis怎么用?Java Duration.minusMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.Duration
的用法示例。
在下文中一共展示了Duration.minusMillis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: minusMillis_long
import java.time.Duration; //导入方法依赖的package包/类
@Test(dataProvider="MinusMillis")
public void minusMillis_long(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.ofSeconds(seconds, nanos);
t = t.minusMillis(amount);
assertEquals(t.getSeconds(), expectedSeconds);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
示例2: minusMillis_long_oneMore
import java.time.Duration; //导入方法依赖的package包/类
@Test(dataProvider="MinusMillis")
public void minusMillis_long_oneMore(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.ofSeconds(seconds + 1, nanos);
t = t.minusMillis(amount);
assertEquals(t.getSeconds(), expectedSeconds + 1);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
示例3: minusMillis_long_minusOneLess
import java.time.Duration; //导入方法依赖的package包/类
@Test(dataProvider="MinusMillis")
public void minusMillis_long_minusOneLess(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.ofSeconds(seconds - 1, nanos);
t = t.minusMillis(amount);
assertEquals(t.getSeconds(), expectedSeconds - 1);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
示例4: minusMillis_long_max
import java.time.Duration; //导入方法依赖的package包/类
@Test
public void minusMillis_long_max() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 998999999);
t = t.minusMillis(-1);
assertEquals(t.getSeconds(), Long.MAX_VALUE);
assertEquals(t.getNano(), 999999999);
}
示例5: minusMillis_long_min
import java.time.Duration; //导入方法依赖的package包/类
@Test
public void minusMillis_long_min() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 1000000);
t = t.minusMillis(1);
assertEquals(t.getSeconds(), Long.MIN_VALUE);
assertEquals(t.getNano(), 0);
}
示例6: minusMillis_long_overflowTooBig
import java.time.Duration; //导入方法依赖的package包/类
@Test(expectedExceptions = {ArithmeticException.class})
public void minusMillis_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999000000);
t.minusMillis(-1);
}
示例7: minusMillis_long_overflowTooSmall
import java.time.Duration; //导入方法依赖的package包/类
@Test(expectedExceptions = {ArithmeticException.class})
public void minusMillis_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.minusMillis(1);
}