XenonConfiguration { public static long duration(Class<?> subsystem, String property, Duration defaultValue) { return INSTANCE.getDuration(subsystem, property, defaultValue); } XenonConfiguration(ConfigurationSource source); static double decimal(Class<?> subsystem, String property, double defaultValue); static long number(Class<?> subsystem, String property, long defaultValue); static int integer(Class<?> subsystem, String property, long defaultValue); static long duration(Class<?> subsystem, String property, Duration defaultValue); static long duration(Class<?> subsystem, String property, TimeUnit unit, long duration); static String string(Class<?> subsystem, String property, String defaultValue); static T choice(Class<?> subsystem, String property, Class<T> enumType,
            T defaultValue); static String secret(Class<?> subsystem, String property, String defaultValue); static boolean bool(String subsystem, String property, boolean defaultValue); static boolean bool(Class<?> subsystem, String property, boolean defaultValue);  }
@Test public void duration() throws Exception { prepareConfig("1000000"); assertEquals(1000000, this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofSeconds(33))); assertEquals(2000, this.config.getDuration(XenonConfigurationTest.class, this.undefined, Duration.ofMillis(2))); prepareConfig("alphanumeric"); assertEquals(10000, this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(10))); prepareConfig("sixtym"); assertEquals(10000, this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(10))); prepareConfig("1h"); assertEquals(TimeUnit.HOURS.toMicros(1), this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(2))); prepareConfig("1m"); assertEquals(TimeUnit.MINUTES.toMicros(1), this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(2))); prepareConfig("1ms"); assertEquals(TimeUnit.MILLISECONDS.toMicros(1), this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(2))); prepareConfig("1d"); assertEquals(TimeUnit.DAYS.toMicros(1), this.config.getDuration(XenonConfigurationTest.class, this.foundProperty, Duration.ofMillis(2))); }