From b9937002230b93e596145219cd16c179fb7b3bd1 Mon Sep 17 00:00:00 2001 From: Colbert Guan Date: Mon, 10 Jun 2019 15:25:01 -0700 Subject: [PATCH] fix bad LEQ and add assert messages (#476) --- .../service/schema/AbstractSchemaServiceTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArgusCore/src/test/java/com/salesforce/dva/argus/service/schema/AbstractSchemaServiceTest.java b/ArgusCore/src/test/java/com/salesforce/dva/argus/service/schema/AbstractSchemaServiceTest.java index 371b2607d..c41c662d0 100644 --- a/ArgusCore/src/test/java/com/salesforce/dva/argus/service/schema/AbstractSchemaServiceTest.java +++ b/ArgusCore/src/test/java/com/salesforce/dva/argus/service/schema/AbstractSchemaServiceTest.java @@ -230,15 +230,15 @@ public void testNumHoursUntilNextClearBloomFilter() { int hour = calendar.get(Calendar.HOUR_OF_DAY); // Will wait 24 hours before next flush if at same hour boundary int secondsUntil = _esSchemaService.getNumSecondsUntilNthHourOfDay(hour, calendar); - assertTrue(secondsUntil >= 23 * 60 * 60 && secondsUntil <= 24 * 60 * 60); + assertTrue("secondsUntil should be between 23 hours and 24 hours but was " + secondsUntil,secondsUntil >= 23 * 60 * 60 && secondsUntil <= 24 * 60 * 60); calendar.set(Calendar.HOUR_OF_DAY, Math.floorMod(hour - 2, 24)); secondsUntil = _esSchemaService.getNumSecondsUntilNthHourOfDay(hour, calendar); - assertTrue(secondsUntil >= 1 * 60 * 60 && secondsUntil <= 2 * 60 * 60); + assertTrue("secondsUntil should be between 1 hours and 2 hours but was " + secondsUntil,secondsUntil >= 1 * 60 * 60 && secondsUntil <= 2 * 60 * 60); calendar.set(Calendar.HOUR_OF_DAY, Math.floorMod(hour + 2, 24)); secondsUntil = _esSchemaService.getNumSecondsUntilNthHourOfDay(hour, calendar); - assertTrue(secondsUntil >= 21 * 60 * 60 && secondsUntil < 22 * 60 * 60); + assertTrue("secondsUntil should be between 21 hours and 22 hours but was " + secondsUntil, secondsUntil >= 21 * 60 * 60 && secondsUntil <= 22 * 60 * 60); } @Test @@ -254,7 +254,7 @@ public void testNumHoursUntilNextFlushBloomFilter() { int secondsUntil = _esSchemaService.getNumSecondsUntilNthHourOfWeek(nthHour, wedAtSix); int floorHoursUntil = secondsUntil / 60 / 60; int expectedHours = (4 + dayIndex) * 24 - 2; - assertTrue(expectedHours - 1 <= floorHoursUntil && floorHoursUntil <= expectedHours); + assertTrue("hoursUntil should be between " + (expectedHours - 1) + " and " + expectedHours, expectedHours - 1 <= floorHoursUntil && floorHoursUntil <= expectedHours); } // Test Wednesday Thursday, Fri, Sat of this week @ 8 AM for (int dayIndex = 3; dayIndex < 7; dayIndex++) { @@ -262,7 +262,7 @@ public void testNumHoursUntilNextFlushBloomFilter() { int secondsUntil = _esSchemaService.getNumSecondsUntilNthHourOfWeek(nthHour, wedAtSix); int floorHoursUntil = secondsUntil / 60 / 60; int expectedHours = (dayIndex - 3) * 24 + 2; - assertTrue(expectedHours - 1 <= floorHoursUntil && floorHoursUntil <= expectedHours); + assertTrue("hoursUntil should be between " + (expectedHours - 1) + " and " + expectedHours, expectedHours - 1 <= floorHoursUntil && floorHoursUntil <= expectedHours); } } }