コード例 #1
0
 @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")));
 }
コード例 #2
0
 @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));
 }
コード例 #3
0
 @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()));
 }