Ejemplo n.º 1
0
 @Test
 public void durationBetween4() {
   Timestamp reference = Timestamp.of(10, 500000000);
   assertThat(
       reference.durationBetween(reference.minus(TimeDuration.ofMillis(600))),
       equalTo(TimeDuration.ofMillis(600)));
 }
Ejemplo n.º 2
0
 @Test
 public void durationBetween2() {
   Timestamp reference = Timestamp.now();
   assertThat(
       reference.durationBetween(reference.minus(TimeDuration.ofNanos(10))),
       equalTo(TimeDuration.ofNanos(10)));
 }
Ejemplo n.º 3
0
 @Test
 public void durationFrom4() {
   Timestamp reference = Timestamp.of(10, 500000000);
   assertThat(
       reference.minus(TimeDuration.ofMillis(600)).durationFrom(reference),
       equalTo(TimeDuration.ofMillis(-600)));
 }
Ejemplo n.º 4
0
 @Test
 public void durationFrom2() {
   Timestamp reference = Timestamp.now();
   assertThat(
       reference.minus(TimeDuration.ofNanos(10)).durationFrom(reference),
       equalTo(TimeDuration.ofNanos(-10)));
 }
Ejemplo n.º 5
0
 @Test
 public void minus3() {
   Timestamp time = Timestamp.of(0, 0);
   Timestamp newTime = time.minus(TimeDuration.ofMillis(100));
   assertThat(newTime, equalTo(Timestamp.of(-1, 900000000)));
 }
Ejemplo n.º 6
0
 @Test
 public void plus4() {
   Timestamp time = Timestamp.of(100, 750000000);
   Timestamp newTime = time.plus(TimeDuration.ofSeconds(-5.750));
   assertThat(newTime, equalTo(Timestamp.of(95, 000000000)));
 }
Ejemplo n.º 7
0
 @Test
 public void plus2() {
   Timestamp time = Timestamp.of(100, 100000000);
   Timestamp newTime = time.plus(TimeDuration.ofNanos(999000000));
   assertThat(newTime, equalTo(Timestamp.of(101, 99000000)));
 }
Ejemplo n.º 8
0
 @Test
 public void plus1() {
   Timestamp time = Timestamp.of(0, 0);
   Timestamp newTime = time.plus(TimeDuration.ofMillis(100));
   assertThat(newTime, equalTo(Timestamp.of(0, 100000000)));
 }