ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/TimeUnitTest.java
(Generate patch)

Comparing jsr166/src/test/tck/TimeUnitTest.java (file contents):
Revision 1.17 by jsr166, Sat Oct 9 19:30:35 2010 UTC vs.
Revision 1.20 by jsr166, Fri May 27 19:12:09 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
8  
9
9   import junit.framework.*;
10   import java.util.concurrent.*;
11   import java.io.*;
# Line 49 | Line 48 | public class TimeUnitTest extends JSR166
48                           TimeUnit.SECONDS.convert(1000000000L*t,
49                                                    TimeUnit.NANOSECONDS));
50  
52
51              assertEquals(1000L*t*60*60*24,
52                           TimeUnit.MILLISECONDS.convert(t,
53                                                    TimeUnit.DAYS));
# Line 279 | Line 277 | public class TimeUnitTest extends JSR166
277          }
278      }
279  
282
280      /**
281       * convert saturates positive too-large values to Long.MAX_VALUE
282       * and negative to LONG.MIN_VALUE
# Line 322 | Line 319 | public class TimeUnitTest extends JSR166
319                       TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3));
320      }
321  
325
322      /**
323 <     * toString returns string containing common name of unit
323 >     * toString returns name of unit
324       */
325      public void testToString() {
326 <        String s = TimeUnit.SECONDS.toString();
331 <        assertTrue(s.indexOf("ECOND") >= 0);
326 >        assertEquals("SECONDS", TimeUnit.SECONDS.toString());
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
# Line 371 | Line 372 | public class TimeUnitTest extends JSR166
372          t.join();
373      }
374  
374
375      /**
376       * timedJoin throws InterruptedException when interrupted
377       */
# Line 384 | Line 384 | public class TimeUnitTest extends JSR166
384              public void realRun() throws InterruptedException {
385                  TimeUnit tu = TimeUnit.MILLISECONDS;
386                  tu.timedJoin(s, MEDIUM_DELAY_MS);
387 <            }});;
387 >            }});
388          s.start();
389          t.start();
390          Thread.sleep(SHORT_DELAY_MS);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines