/** * success=true * @return */ public Runnable getTrackDependency() { return customCases.getTrackDependency("AiTestDependency", "TestCommand1", new Duration(789L), true); }
@Test public void testMinNegativeDays() { Duration duration = new Duration(Integer.MIN_VALUE, 0, 0, 0, 0); String minValue = String.valueOf(Integer.MIN_VALUE); verify(duration, Integer.MIN_VALUE, 0, 0, 0, 0, minValue + ".00:00:00"); }
@Test public void testMaxPositiveDays() { Duration duration = new Duration(Integer.MAX_VALUE, 0, 0, 0, 0); String maxValue = String.valueOf(Integer.MAX_VALUE); verify(duration, Integer.MAX_VALUE, 0, 0, 0, 0, maxValue + ".00:00:00"); }
@Test public void testMaxPositiveSeconds() { Duration duration = new Duration(0, 0, 0, 59, 0); verify(duration, 0, 0, 0, 59, 0, "00:00:59"); }
@Test public void testMaxMilliseconds() { Duration duration = new Duration(0, 0, 0, 0, 999); verify(duration, 0, 0, 0, 0, 999, "00:00:00.9990000"); }
@Test public void test250Milli() { Duration duration = new Duration(0, 0, 0, 0, 250); verify(duration, 0, 0, 0, 0, 250, "00:00:00.2500000"); }
@Test public void test1DayAndOneMilliWithMilliCtor() { Duration duration = new Duration(86400001); verify(duration, 1, 0, 0, 0, 1, "01.00:00:00.0010000"); }
@Test public void test99Days23Hours59Min59Sec999Milli() { Duration duration = new Duration(99, 23, 59, 59, 999); verify(duration, 99, 23, 59, 59, 999, "99.23:59:59.9990000"); }
@Test public void testMinusFourteenDays() { Duration duration = new Duration(-14, 0, 0, 0, 0); verify(duration, -14, 0, 0, 0, 0, "-14.00:00:00"); }
@Test public void testMaxPositiveHours() { Duration duration = new Duration(0, 23, 0, 0, 0); verify(duration, 0, 23, 0, 0, 0, "23:00:00"); }
@Test public void test2Days0Hours2Min3Sec() { Duration duration = new Duration(2, 0, 2, 3, 0); verify(duration, 2, 0, 2, 3, 0, "02.00:02:03"); }
@Test public void testMilliCtorWithLongMaxValue() { Duration duration = new Duration(Long.MAX_VALUE); verify(duration, 106751991167L, 7, 12, 55, 807, "106751991167.07:12:55.8070000"); }
@Test public void test3Hours() { Duration duration = new Duration(0, 3, 0, 0, 0); verify(duration, 0, 3, 0, 0, 0, "03:00:00"); }
@Test public void testZero() { Duration duration = new Duration(0); verify(duration, 0, 0, 0, 0, 0, "00:00:00"); }
@Test public void testZeroWithAllArgs() { Duration duration = new Duration(0, 0, 0, 0, 0); verify(duration, 0, 0, 0, 0, 0, "00:00:00"); }
@Test public void testHourDuration() { Duration expected = new Duration(0, 1, 0, 50, 0); String json = getJsonDurationInHolder(expected); System.out.println(json); DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); json = getJsonDurationInHolder(new Duration(3600000L + 50000L)); System.out.println(json); actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); }
@Test public void testDaysAndMilliseconds() { Duration expected = new Duration(5, 0, 1, 0, 213); String json = getJsonDurationInHolder(expected); System.out.println(json); DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); json = getJsonDurationInHolder(new Duration(60213L + 5 * 86400000L)); System.out.println(json); actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); }
@Test public void testMinuteDuration() { Duration expected = new Duration(0, 0, 25, 50, 0); String json = getJsonDurationInHolder(expected); System.out.println(json); DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); json = getJsonDurationInHolder(new Duration(25 * 60000L + 50000L)); System.out.println(json); actual = JsonHelper.GSON.fromJson(json, DurationHolder.class); Assert.assertEquals(expected, actual.getData()); }
@Test public void testTotalMilliseconds() { Duration duration = new Duration(1, 1, 1, 1, 1); // 90061001 ms is 1 day, 1 hour, 1 minute, 1 sec and 1 milliseconds. Assert.assertEquals(90061001, duration.getTotalMilliseconds()); }
@Test public void testDuration() { Duration duration = new Duration(1234); RemoteDependencyTelemetry telemetry = new RemoteDependencyTelemetry(); telemetry.setDuration(duration); assertEquals(duration, telemetry.getDuration()); }