コード例 #1
0
 @Test
 public void testDefaultConstructorSetsCurrentTimeAndZone() {
   TimeEntity aTime = new TimeEntity();
   assertThat(
       "Time should be within a few seconds of now",
       (double) aTime.getTime().getTime(),
       new IsCloseTo((double) (new Date()).getTime(), 2000.0));
   assertEquals(TimeZone.getDefault(), aTime.getTz());
 }
コード例 #2
0
 @Test
 public void testConstructorSavesGivenTime() throws Exception {
   Date now = new Date();
   TimeEntity aTime = new TimeEntity(now);
   assertSame(now, aTime.getTime());
 }