Java Code Examples for java.time.Instant.minusMillis()

The following are Jave code examples for showing how to use minusMillis() of the java.time.Instant class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 2
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long_oneMore(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds + 1, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds + 1);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 3
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long_minusOneLess(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds - 1, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds - 1);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 4
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test
public void minusMillis_long_max() {
    Instant i = Instant.ofEpochSecond(MAX_SECOND, 998999999);
    i = i.minusMillis(-1);
    assertEquals(i.getEpochSecond(), MAX_SECOND);
    assertEquals(i.getNano(), 999999999);
}
 
Example 5
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test
public void minusMillis_long_min() {
    Instant i = Instant.ofEpochSecond(MIN_SECOND, 1000000);
    i = i.minusMillis(1);
    assertEquals(i.getEpochSecond(), MIN_SECOND);
    assertEquals(i.getNano(), 0);
}
 
Example 6
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 7
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long_oneMore(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds + 1, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds + 1);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 8
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test(dataProvider="MinusMillis")
public void minusMillis_long_minusOneLess(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
    Instant i = Instant.ofEpochSecond(seconds - 1, nanos);
    i = i.minusMillis(amount);
    assertEquals(i.getEpochSecond(), expectedSeconds - 1);
    assertEquals(i.getNano(), expectedNanoOfSecond);
}
 
Example 9
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test
public void minusMillis_long_max() {
    Instant i = Instant.ofEpochSecond(MAX_SECOND, 998999999);
    i = i.minusMillis(-1);
    assertEquals(i.getEpochSecond(), MAX_SECOND);
    assertEquals(i.getNano(), 999999999);
}
 
Example 10
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 5 votes
@Test
public void minusMillis_long_min() {
    Instant i = Instant.ofEpochSecond(MIN_SECOND, 1000000);
    i = i.minusMillis(1);
    assertEquals(i.getEpochSecond(), MIN_SECOND);
    assertEquals(i.getNano(), 0);
}
 
Example 11
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 4 votes
@Test(expectedExceptions=DateTimeException.class)
public void minusMillis_long_overflowTooBig() {
    Instant i = Instant.ofEpochSecond(MAX_SECOND, 999000000);
    i.minusMillis(-1);
}
 
Example 12
Project: jdk8u-jdk   File: TCKInstant.java   View Source Code Vote up 4 votes
@Test(expectedExceptions=DateTimeException.class)
public void minusMillis_long_overflowTooSmall() {
    Instant i = Instant.ofEpochSecond(MIN_SECOND, 0);
    i.minusMillis(1);
}
 
Example 13
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 4 votes
@Test(expectedExceptions=DateTimeException.class)
public void minusMillis_long_overflowTooBig() {
    Instant i = Instant.ofEpochSecond(MAX_SECOND, 999000000);
    i.minusMillis(-1);
}
 
Example 14
Project: openjdk-jdk10   File: TCKInstant.java   View Source Code Vote up 4 votes
@Test(expectedExceptions=DateTimeException.class)
public void minusMillis_long_overflowTooSmall() {
    Instant i = Instant.ofEpochSecond(MIN_SECOND, 0);
    i.minusMillis(1);
}