EtcdFlagFieldUpdater { public void init() { init(Preconditions.checkNotNull(Strings.emptyToNull(directoryFlag.get()))); } EtcdFlagFieldUpdater(FlagFieldRegistry registry);   EtcdFlagFieldUpdater(FlagFieldRegistry registry, List<String> uris, RetryPolicy retryPolicy,
                       ExecutorService executorService); static boolean isEnabled(); void init(); void init(String flagzDirectory); void watchForUpdates(); void stop();  }
@Test public void testNothingInEtcd() throws Exception { etcdUpdater.init(); assertThat(flagInt.get(), is(flagInt.defaultValue())); assertThat(flagString.get(), is("cmdline_overwrite")); assertThat(flagMap.get(), is(flagMap.defaultValue())); }
@Test public void testInitFromEtcd() throws Exception { client.put(FLAGZ_PATH + "etcd_test_int", "101").send().get(); client.put(FLAGZ_PATH + "etcd_test_string", "etcdinit_overwritten").send().get(); etcdUpdater.init(); assertThat(flagInt.get(), is(101)); assertThat(flagString.get(), is("etcdinit_overwritten")); assertThat(flagMap.get(), is(flagMap.defaultValue())); }
@Test public void testInitFromEtcd_CallsListener() throws Exception { client.put(FLAGZ_PATH + "etcd_test_int", "333").send().get(); etcdUpdater.init(); assertThat(flagInt.get(), is(333)); verify(intListener).accept(eq(333)); }
@Test(expected = FlagException.UnknownFlag.class) public void testInitFromEtcd_UnknownFlag_ThrowsException() throws Exception { client.put(FLAGZ_PATH + "etcd_test_some_flag", "123").send().get(); etcdUpdater.init(); }
@Test(expected = FlagException.IllegalFormat.class) public void testInitFromEtcd_IllegalFormat_ThrowsException() throws Exception { client.put(FLAGZ_PATH + "etcd_test_map_int", "random_stuff").send().get(); etcdUpdater.init(); }
@Test(expected = FlagException.BadValue.class) public void testInitFromEtcd_BadValue_ThrowsException() throws Exception { client.put(FLAGZ_PATH + "etcd_test_int", "99").send().get(); etcdUpdater.init(); }