@Test public void ofDate1() { Date date = new Date(123456789); Timestamp time = Timestamp.of(date); assertThat(time.getSec(), equalTo(123456L)); assertThat(time.getNanoSec(), equalTo(789000000)); }
@Test public void ofDate2() { Date date = new Date(-123456789); Timestamp time = Timestamp.of(date); assertThat(time.toDate(), equalTo(date)); assertThat(time.getSec(), equalTo(-123457L)); assertThat(time.getNanoSec(), equalTo(211000000)); }
@Test public void time1() { Timestamp time = Timestamp.of(100, 10000000); assertThat(time.getSec(), equalTo(100L)); assertThat(time.getNanoSec(), equalTo(10000000)); }