@Test
public void testShouldPersistForBooleanMetrics() throws Exception {
boolean testMetric = false;
long collectionTimeInSecs = 56789;
Metric newMetric = new Metric(otherLocator, testMetric, collectionTimeInSecs,
new TimeValue(2, TimeUnit.DAYS), "unknown");
Assert.assertTrue(newMetric.isBoolean());
boolean shouldPersist = metricsOptimizer.shouldPersist(newMetric);
// shouldPersist should be false as we have the same metric as the one
// in the database
Assert.assertEquals(false, shouldPersist);
testMetric = true;
collectionTimeInSecs++;
newMetric = new Metric(otherLocator, testMetric, collectionTimeInSecs,
new TimeValue(2, TimeUnit.DAYS), "unknown");
shouldPersist = metricsOptimizer.shouldPersist(newMetric);
// shouldPersist should now be true as we do not have the same metric