### Question:
Metric implements IMetric { public void setTtl(TimeValue ttl) { if (!isValidTTL(ttl.toSeconds())) { throw new InvalidDataException("TTL supplied for metric is invalid. Required: 0 < ttl < " + Integer.MAX_VALUE + ", provided: " + ttl.toSeconds()); } ttlInSeconds = (int) ttl.toSeconds(); } Metric(Locator locator, Object metricValue, long collectionTime, TimeValue ttl, String unit); Locator getLocator(); Object getMetricValue(); int getTtlInSeconds(); long getCollectionTime(); String getUnit(); void setTtl(TimeValue ttl); void setTtlInSeconds(int ttlInSeconds); RollupType getRollupType(); @Override String toString(); @Override boolean equals(Object o);  }### Answer:
@Test public void testTTL() { Locator locator = Locator.createLocatorFromPathComponents("tenantId", "metricName"); Metric metric = new Metric(locator, 134891734L, System.currentTimeMillis(), new TimeValue(5, TimeUnit.HOURS), "Unknown"); try { metric.setTtl(new TimeValue(Long.MAX_VALUE, TimeUnit.SECONDS)); fail(); } catch (Exception e) { Assert.assertTrue(e instanceof RuntimeException); } }