@Test public void testGetDuration() { System.out.println("getDuration"); TimePeriod instance = new TimePeriod(time1, time2); long expResult = 36000L; long result = instance.getDuration(); assertEquals(expResult, result); }
public long getDuration() { if (getStartTime() == null || getEndTime() == null) { return -1; } long end = getEndTime().getTime().getTime(); long start = getStartTime().getTime().getTime(); return TimeUnit.MILLISECONDS.toSeconds(end - start); }
TimePeriod implements Comparable<TimePeriod> { public long getDuration() { if (getStartTime() == null || getEndTime() == null) { return -1; } long end = getEndTime().getTime().getTime(); long start = getStartTime().getTime().getTime(); return TimeUnit.MILLISECONDS.toSeconds(end - start); } }
TimePeriod implements Comparable<TimePeriod> { public long getDuration() { if (getStartTime() == null || getEndTime() == null) { return -1; } long end = getEndTime().getTime().getTime(); long start = getStartTime().getTime().getTime(); return TimeUnit.MILLISECONDS.toSeconds(end - start); } TimePeriod(long startTime, long endTime);  TimePeriod(Calendar startTime, Calendar endTime);  TimePeriod(Calendar startTime, long seconds);  TimePeriod(Calendar startTime, int time, TimeUnit sourceUnit);  TimePeriod(int time, TimeUnit sourceUnit); }
TimePeriod implements Comparable<TimePeriod> { public long getDuration() { if (getStartTime() == null || getEndTime() == null) { return -1; } long end = getEndTime().getTime().getTime(); long start = getStartTime().getTime().getTime(); return TimeUnit.MILLISECONDS.toSeconds(end - start); } TimePeriod(long startTime, long endTime);  TimePeriod(Calendar startTime, Calendar endTime);  TimePeriod(Calendar startTime, long seconds);  TimePeriod(Calendar startTime, int time, TimeUnit sourceUnit);  TimePeriod(int time, TimeUnit sourceUnit); long getDuration(); static long convertToMinutes(TimePeriod duration); static long convertToHours(TimePeriod duration); static long convertToDays(TimePeriod duration); Calendar getStartTime(); long getStartTimeInSeconds(); Calendar getEndTime(); long getEndTimeInSeconds(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimePeriod other); @Override String toString(); boolean isValid(); }
TimePeriod implements Comparable<TimePeriod> { public long getDuration() { if (getStartTime() == null || getEndTime() == null) { return -1; } long end = getEndTime().getTime().getTime(); long start = getStartTime().getTime().getTime(); return TimeUnit.MILLISECONDS.toSeconds(end - start); } TimePeriod(long startTime, long endTime);  TimePeriod(Calendar startTime, Calendar endTime);  TimePeriod(Calendar startTime, long seconds);  TimePeriod(Calendar startTime, int time, TimeUnit sourceUnit);  TimePeriod(int time, TimeUnit sourceUnit); long getDuration(); static long convertToMinutes(TimePeriod duration); static long convertToHours(TimePeriod duration); static long convertToDays(TimePeriod duration); Calendar getStartTime(); long getStartTimeInSeconds(); Calendar getEndTime(); long getEndTimeInSeconds(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimePeriod other); @Override String toString(); boolean isValid();  }