@Test(expected = IllegalArgumentException.class) public void testDurationWithValueNotWithinConstraint() { Setting<Long> setting = setting("foo.bar", DURATION, "3s", min(DURATION.apply("3s"))); setting.apply(map(stringMap("foo.bar", "2s"))); }
@Test public void testDuration() { Setting<Long> setting = setting("foo.bar", DURATION, "3s", min(DURATION.apply("3s"))); assertThat(setting.apply(map(stringMap("foo.bar", "4s"))), equalTo(4000L)); }
@Test(expected = IllegalArgumentException.class) public void testDurationWithBrokenDefault() { // Notice that the default value is less that the minimum Setting<Long> setting = setting("foo.bar", DURATION, "1s", min(DURATION.apply("3s"))); setting.apply(map(stringMap())); }