StoreConfig { @Config("store.ttl") StoreConfig setTtl(Duration ttl) { this.ttl = requireNonNull(ttl, "ttl must not be null"); return this; }    }
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(StoreConfig.class) .setTtl(new Duration(1, TimeUnit.HOURS))); }
@Test public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("store.ttl", "2h") .build(); StoreConfig expected = new StoreConfig() .setTtl(new Duration(2, TimeUnit.HOURS)); assertFullMapping(properties, expected); }
@Test public void testMinTtl() { assertValidates(new StoreConfig().setTtl(new Duration(1, TimeUnit.MINUTES))); assertFailsValidation(new StoreConfig().setTtl(new Duration(59, TimeUnit.SECONDS)), "ttl", "must be at least 1m", MinDuration.class); }