11package smart .vehicle .analytics .timer ;
22
33import static org .junit .Assert .*;
4+ import junitparams .JUnitParamsRunner ;
5+ import junitparams .Parameters ;
46
57import org .junit .After ;
68import org .junit .Before ;
79import org .junit .Test ;
10+ import org .junit .runner .RunWith ;
811
912import smart .vehicle .analytics .exceptions .InvalidInputTypeException ;
1013
14+ @ RunWith (JUnitParamsRunner .class )
1115public class EpochParserTest {
1216
1317 private EpochParser epochParser ;
@@ -22,14 +26,30 @@ public void tearDown() throws Exception {
2226 }
2327
2428 @ Test
25- public void testTimeUnitDetails () throws InvalidInputTypeException {
26- TimeUnit atime = epochParser .convert ("269123" );
29+ @ Parameters ({
30+ "268981, 0, 0, 4, 28, 981, [1st day - 12:04:28 AM]" ,
31+ "269123, 0, 0, 4, 29, 123, [1st day - 12:04:29 AM]" ,
32+ "1089951, 0, 0, 18, 9, 951, [1st day - 12:18:09 AM]"
33+
34+ })
35+ public void validateDetailsOfTimeUnitInstanceReturnedWhenConvertIsInvoked (String millisecondsInString ,
36+ long days , long hours , long minutes , long seconds , long milliseconds , String prettyTimestamp ) throws InvalidInputTypeException {
37+
38+ /*TimeUnit atime = epochParser.convert("269123");
2739 assertEquals(0, atime.getDays());
2840 assertEquals(0, atime.getHours());
2941 assertEquals(4, atime.getMinutes());
3042 assertEquals(29, atime.getSeconds());
3143 assertEquals(123, atime.getMillis());
32- assertEquals ("[1st day - 12:04:29 AM]" , atime .toPrettyString ());
44+ assertEquals("[1st day - 12:04:29 AM]", atime.toPrettyString());*/
45+
46+ TimeUnit atime = epochParser .convert (millisecondsInString );
47+ assertEquals (days , atime .getDays ());
48+ assertEquals (hours , atime .getHours ());
49+ assertEquals (minutes , atime .getMinutes ());
50+ assertEquals (seconds , atime .getSeconds ());
51+ assertEquals (milliseconds , atime .getMillis ());
52+ assertEquals (prettyTimestamp , atime .toPrettyString ());
3353 }
3454
3555}
0 commit comments