[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.19, Tue Mar 15 19:47:07 2011 UTC revision 1.20, Fri May 27 19:12:09 2011 UTC
# Line 6  Line 6 
6   * Pat Fisher, Mike Judd.   * Pat Fisher, Mike Judd.
7   */   */
8    
   
9  import junit.framework.*;  import junit.framework.*;
10  import java.util.concurrent.*;  import java.util.concurrent.*;
11  import java.io.*;  import java.io.*;
# Line 49  Line 48 
48                           TimeUnit.SECONDS.convert(1000000000L*t,                           TimeUnit.SECONDS.convert(1000000000L*t,
49                                                    TimeUnit.NANOSECONDS));                                                    TimeUnit.NANOSECONDS));
50    
   
51              assertEquals(1000L*t*60*60*24,              assertEquals(1000L*t*60*60*24,
52                           TimeUnit.MILLISECONDS.convert(t,                           TimeUnit.MILLISECONDS.convert(t,
53                                                    TimeUnit.DAYS));                                                    TimeUnit.DAYS));
# Line 279  Line 277 
277          }          }
278      }      }
279    
   
280      /**      /**
281       * convert saturates positive too-large values to Long.MAX_VALUE       * convert saturates positive too-large values to Long.MAX_VALUE
282       * and negative to LONG.MIN_VALUE       * and negative to LONG.MIN_VALUE
# Line 322  Line 319 
319                       TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3));                       TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3));
320      }      }
321    
   
322      /**      /**
323       * toString returns string containing common name of unit       * toString returns name of unit
324       */       */
325      public void testToString() {      public void testToString() {
326          String s = TimeUnit.SECONDS.toString();          assertEquals("SECONDS", TimeUnit.SECONDS.toString());
         assertTrue(s.indexOf("ECOND") >= 0);  
327      }      }
328    
329        /**
330         * name returns name of unit
331         */
332        public void testName() {
333            assertEquals("SECONDS", TimeUnit.SECONDS.name());
334        }
335    
336      /**      /**
337       * Timed wait without holding lock throws       * Timed wait without holding lock throws
# Line 371  Line 372 
372          t.join();          t.join();
373      }      }
374    
   
375      /**      /**
376       * timedJoin throws InterruptedException when interrupted       * timedJoin throws InterruptedException when interrupted
377       */       */

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8