[cvs] / jsr166 / src / test / tck / TimeUnitTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/TimeUnitTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29, Fri Mar 25 04:53:28 2016 UTC revision 1.30, Sat Mar 26 06:58:47 2016 UTC
# Line 14  Line 14 
14  import static java.util.concurrent.TimeUnit.NANOSECONDS;  import static java.util.concurrent.TimeUnit.NANOSECONDS;
15  import static java.util.concurrent.TimeUnit.SECONDS;  import static java.util.concurrent.TimeUnit.SECONDS;
16    
 import java.time.temporal.ChronoUnit;  
17  import java.util.concurrent.CountDownLatch;  import java.util.concurrent.CountDownLatch;
18  import java.util.concurrent.TimeUnit;  import java.util.concurrent.TimeUnit;
19    
# Line 604  Line 603 
603              assertSame(x, serialClone(x));              assertSame(x, serialClone(x));
604      }      }
605    
     /**  
      * tests for toChronoUnit.  
      */  
     public void testToChronoUnit() throws Exception {  
         assertSame(ChronoUnit.NANOS,   NANOSECONDS.toChronoUnit());  
         assertSame(ChronoUnit.MICROS,  MICROSECONDS.toChronoUnit());  
         assertSame(ChronoUnit.MILLIS,  MILLISECONDS.toChronoUnit());  
         assertSame(ChronoUnit.SECONDS, SECONDS.toChronoUnit());  
         assertSame(ChronoUnit.MINUTES, MINUTES.toChronoUnit());  
         assertSame(ChronoUnit.HOURS,   HOURS.toChronoUnit());  
         assertSame(ChronoUnit.DAYS,    DAYS.toChronoUnit());  
   
         // Every TimeUnit has a defined ChronoUnit equivalent  
         for (TimeUnit x : TimeUnit.values())  
             assertSame(x, TimeUnit.of(x.toChronoUnit()));  
     }  
   
     /**  
      * tests for TimeUnit.of(ChronoUnit).  
      */  
     public void testTimeUnitOf() throws Exception {  
         assertSame(NANOSECONDS,  TimeUnit.of(ChronoUnit.NANOS));  
         assertSame(MICROSECONDS, TimeUnit.of(ChronoUnit.MICROS));  
         assertSame(MILLISECONDS, TimeUnit.of(ChronoUnit.MILLIS));  
         assertSame(SECONDS,      TimeUnit.of(ChronoUnit.SECONDS));  
         assertSame(MINUTES,      TimeUnit.of(ChronoUnit.MINUTES));  
         assertSame(HOURS,        TimeUnit.of(ChronoUnit.HOURS));  
         assertSame(DAYS,         TimeUnit.of(ChronoUnit.DAYS));  
   
         assertThrows(NullPointerException.class,  
                      () -> TimeUnit.of((ChronoUnit)null));  
   
         // ChronoUnits either round trip to their TimeUnit  
         // equivalents, or throw IllegalArgumentException.  
         for (ChronoUnit cu : ChronoUnit.values()) {  
             final TimeUnit tu;  
             try {  
                 tu = TimeUnit.of(cu);  
             } catch (IllegalArgumentException acceptable) {  
                 continue;  
             }  
             assertSame(cu, tu.toChronoUnit());  
         }  
     }  
   
606  }  }

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8