@Test public void getTimeInterval() { TimeInterval lastMin = TimeParser.getTimeInterval("last min"); Assert.assertEquals("Failed to get TimeInterval for last min", 60, between(lastMin.getStart(), lastMin.getEnd()).getSeconds()); TimeInterval lastHour = TimeParser.getTimeInterval("last hour"); Assert.assertEquals("Failed to get TimeInterval for last hour", (60 * 60), between(lastHour.getStart(), lastHour.getEnd()).getSeconds(), 0); TimeInterval lastDay = TimeParser.getTimeInterval("last day"); Assert.assertEquals( "Failed to get TimeInterval for last day", (60 * 60 * 24), between(lastDay.getStart(), lastDay.getEnd()).getSeconds(), 0); TimeInterval lastWeek = TimeParser.getTimeInterval("last week"); Assert.assertEquals("Failed to get TimeInterval for last week", (60 * 60 * 24 * 7), between(lastWeek.getStart(), lastWeek.getEnd()) .getSeconds(), 0); TimeInterval last5Min = TimeParser.getTimeInterval("last 5 mins"); Assert.assertEquals("Failed to get TimeInterval for last 5 mins", (60 * 5), between(last5Min.getStart(), last5Min.getEnd()) .getSeconds(), 0); TimeInterval last5Hour = TimeParser.getTimeInterval("last 5 hours"); Assert.assertEquals("Failed to get TimeInterval for last 5 hours", (60 * 60 * 5), between(last5Hour.getStart(), last5Hour.getEnd()) .getSeconds(), 0); TimeInterval last5Day = TimeParser.getTimeInterval("last 5 days"); Assert.assertEquals("Failed to get TimeInterval for last 5 days", (60 * 60 * 24 * 5), between(last5Day.getStart(), last5Day.getEnd()) .getSeconds(), 0); TimeInterval last5Week = TimeParser.getTimeInterval("last 5 weeks"); Assert.assertEquals("Failed to get TimeInterval for last 5 weeks", (60 * 60 * 24 * 7 * 5), between(last5Week.getStart(), last5Week.getEnd()) .getSeconds(), 0); TimeInterval oneMinAgo = TimeParser.getTimeInterval("1 min ago"); Assert.assertEquals("Failed to get TimeInterval for 1 min ago", (60), between(oneMinAgo.getStart(), oneMinAgo.getEnd()) .getSeconds(), 0); TimeInterval oneHourAgo = TimeParser.getTimeInterval("1 hour ago"); Assert.assertEquals("Failed to get TimeInterval for 1 hour ago", (60 * 60), between(oneHourAgo.getStart(), oneHourAgo.getEnd()) .getSeconds(), 0); TimeInterval oneDayAgo = TimeParser.getTimeInterval("1 day ago"); Assert.assertEquals("Failed to get TimeInterval for 1 days ago", (60 * 60 * 24), between(oneDayAgo.getStart(), oneDayAgo.getEnd()) .getSeconds(), 0); TimeInterval oneWeekAgo = TimeParser.getTimeInterval("1 week ago"); Assert.assertEquals("Failed to get TimeInterval for 1 week ago", (60 * 60 * 24 * 7), between(oneWeekAgo.getStart(), oneWeekAgo.getEnd()) .getSeconds(), 0); TimeInterval fiveMinsAgo = TimeParser.getTimeInterval("5 mins ago"); Assert.assertEquals("Failed to get TimeInterval for 5 mins ago", (60 * 5), between(fiveMinsAgo.getStart(), fiveMinsAgo.getEnd()) .getSeconds(), 0); TimeInterval fiveHoursAgo = TimeParser.getTimeInterval("5 hours ago"); Assert.assertEquals("Failed to get TimeInterval for 5 hours ago", (60 * 60 * 5), between(fiveHoursAgo.getStart(), fiveHoursAgo.getEnd()) .getSeconds(), 0); TimeInterval fiveDaysAgo = TimeParser.getTimeInterval("5 days ago"); Assert.assertEquals("Failed to get TimeInterval for 5 days ago", (60 * 60 * 24 * 5), between(fiveDaysAgo.getStart(), fiveDaysAgo.getEnd()) .getSeconds(), 0); TimeInterval fiveWeeksAgo = TimeParser.getTimeInterval("5 weeks ago"); Assert.assertEquals("Failed to get TimeInterval for 5 week ago", (60 * 60 * 24 * 7 * 5), between(fiveWeeksAgo.getStart() , fiveWeeksAgo.getEnd()).getSeconds(), 0); TimeInterval last4Min = TimeParser.getTimeInterval("Last 4 Mins"); Assert.assertEquals("Failed to get TimeInterval for Last 4 Mins", (60 * 4), between(last4Min.getStart(), last4Min.getEnd()) .getSeconds(), 0); TimeInterval last4Hour = TimeParser.getTimeInterval("Last 4 Hours"); Assert.assertEquals("Failed to get TimeInterval for Last 4 Hours", (60 * 60 * 4), between(last4Hour.getStart(), last4Hour.getEnd()) .getSeconds(), 0); TimeInterval last4Day = TimeParser.getTimeInterval("Last 4 Day"); Assert.assertEquals("Failed to get TimeInterval for Last 4 Day", (60 * 60 * 24 * 4), between(last4Day.getStart(), last4Day.getEnd()) .getSeconds(), 0); TimeInterval last4Week = TimeParser.getTimeInterval("Last 4 WEEKS"); Assert.assertEquals("Failed to get TimeInterval for Last 4 WEEKS", (60 * 60 * 24 * 7 * 4), between(last4Week.getStart(), last4Week.getEnd()) .getSeconds(), 0); TimeInterval last3Min = TimeParser.getTimeInterval("last 3 min"); Assert.assertEquals("Failed to get TimeInterval for last 3 min", (60 * 3), between(last3Min.getStart(), last3Min.getEnd()) .getSeconds(), 0); TimeInterval last3Hour = TimeParser.getTimeInterval("last 3 hour"); Assert.assertEquals("Failed to get TimeInterval for last 3 hour", (60 * 60 * 3), between(last3Hour.getStart(), last3Hour.getEnd()) .getSeconds(), 0); TimeInterval last3Day = TimeParser.getTimeInterval("last 3 day"); Assert.assertEquals("Failed to get TimeInterval for last 3 day", (60 * 60 * 24 * 3), between(last3Day.getStart(), last3Day.getEnd()) .getSeconds(), 0); TimeInterval last3Week = TimeParser.getTimeInterval("last 3 week"); Assert.assertEquals("Failed to get TimeInterval for last 3 week", (60 * 60 * 24 * 7 * 3), between(last3Week.getStart(), last3Week.getEnd()) .getSeconds(), 0); TimeInterval last2Mins = TimeParser.getTimeInterval("last 2mins"); Assert.assertEquals("Failed to get TimeInterval for last 2mins", (60 * 2), between(last2Mins.getStart(), last2Mins.getEnd()) .getSeconds(), 0); TimeInterval last2Hours = TimeParser.getTimeInterval("last 2hours"); Assert.assertEquals("Failed to get TimeInterval for last 2hours", (60 * 60 * 2), between(last2Hours.getStart(), last2Hours.getEnd()) .getSeconds(), 0); TimeInterval last2Days = TimeParser.getTimeInterval("last 2days"); Assert.assertEquals("Failed to get TimeInterval for last 2days", (60 * 60 * 24 * 2), between(last2Days.getStart(), last2Days.getEnd()) .getSeconds(), 0); TimeInterval last2Weeks = TimeParser.getTimeInterval("last 2weeks"); Assert.assertEquals("Failed to get TimeInterval for last 2weeks", (60 * 60 * 24 * 7 * 2), between(last2Weeks.getStart(), last2Weeks.getEnd()) .getSeconds(), 0); TimeInterval twoMinsAgo = TimeParser.getTimeInterval("2mins ago"); Assert.assertEquals("Failed to get TimeInterval for 2mins ago", (60 * 2), between(twoMinsAgo.getStart(), twoMinsAgo.getEnd()) .getSeconds(), 0); TimeInterval twoHoursAgo = TimeParser.getTimeInterval("2hours ago"); Assert.assertEquals("Failed to get TimeInterval for 2hours ago", (60 * 60 * 2), between(twoHoursAgo.getStart(), twoHoursAgo.getEnd()) .getSeconds(), 0); TimeInterval twoDaysAgo = TimeParser.getTimeInterval("2days ago"); Assert.assertEquals("Failed to get TimeInterval for 2days ago", (60 * 60 * 24 * 2), between(twoDaysAgo.getStart(), twoDaysAgo.getEnd()) .getSeconds(), 0); TimeInterval twoWeeksAgo = TimeParser.getTimeInterval("2weeks ago"); Assert.assertEquals("Failed to get TimeInterval for 2weeks ago", (60 * 60 * 24 * 7 * 2), between(twoWeeksAgo.getStart(), twoWeeksAgo.getEnd()).getSeconds(), 0); }
public static TimeInterval getTimeInterval(String time) { return getTimeInterval(time, "now"); }
TimeParser { public static TimeInterval getTimeInterval(String time) { return getTimeInterval(time, "now"); } }
TimeParser { public static TimeInterval getTimeInterval(String time) { return getTimeInterval(time, "now"); }  }
TimeParser { public static TimeInterval getTimeInterval(String time) { return getTimeInterval(time, "now"); }  static Duration getDuration(String time); static TimeInterval getTimeInterval(String time); static TimeInterval getTimeInterval(String start, String end); static Instant getInstant(String time); }
TimeParser { public static TimeInterval getTimeInterval(String time) { return getTimeInterval(time, "now"); }  static Duration getDuration(String time); static TimeInterval getTimeInterval(String time); static TimeInterval getTimeInterval(String start, String end); static Instant getInstant(String time);  }