DiscoveryConfig { @Config("discovery.max-age") public DiscoveryConfig setMaxAge(Duration maxAge) { this.maxAge = maxAge; return this; }  @NotNull Duration getMaxAge(); @Config("discovery.max-age") DiscoveryConfig setMaxAge(Duration maxAge); @NotNull Duration getStoreCacheTtl(); @Config("discovery.store-cache-ttl") DiscoveryConfig setStoreCacheTtl(Duration storeCacheTtl);  }
@Test public void testValidatesNotNullDuration() { DiscoveryConfig config = new DiscoveryConfig().setMaxAge(null); assertFailsValidation(config, "maxAge", "may not be null", NotNull.class); }