    1   package test.net.sourceforge.pmd;
    2
    3   import junit.framework.TestCase;
    4   import net.sourceforge.pmd.Report;
    5
    6   public class ReadableDurationTest extends TestCase {
    7
    8       public void testMillisSeconds() {
    9           assertEquals("0s", new Report.ReadableDuration(35).getTime());
    10      }
    11
    12      public void testSeconds() {
    13          assertEquals("25s", new Report.ReadableDuration(25 * 1000).getTime());
    14      }
    15
    16      public void testWholeMinutes() {
    17          assertEquals("5m 0s", new Report.ReadableDuration(60 * 1000 * 5).getTime());
    18      }
    19
    20      public void testMinutesAndSeconds() {
    21          assertEquals("5m 10s", new Report.ReadableDuration((60 * 1000 * 5) + (1000 * 10)).getTime());
    22      }
    23
    24      public void testHours() {
    25          assertEquals("2h 0m 0s", new Report.ReadableDuration(60 * 1000 * 120).getTime());
    26      }
    27  }