View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.util;
5   
6   import static org.junit.Assert.assertEquals;
7   
8   import java.util.Collection;
9   
10  import net.sourceforge.pmd.ReadableDurationTest;
11  
12  import org.junit.Test;
13  
14  
15  /**
16   * 
17   * @author Brian Remedios
18   */
19  public class DateTimeUtilTest {
20  
21      @Test
22      public void testConversions() {
23      	
24      	Collection<Object[]> stringNumberPairs = ReadableDurationTest.data();
25      	
26      	for (Object[] stringAndNumber : stringNumberPairs) {
27      		String result = (String)stringAndNumber[0];
28      		Integer milliseconds = (Integer)stringAndNumber[1];
29      		
30      		assertEquals(result, DateTimeUtil.asHoursMinutesSeconds(milliseconds));
31      	}
32        
33      }
34  
35  
36      public static junit.framework.Test suite() {
37          return new junit.framework.JUnit4TestAdapter(DateTimeUtilTest.class);
38      }
39  }
40