EntityInitializers { public static <T> T resolve(ConfigBag configBag, ConfigKey<T> key) { return resolve(configBag, key, BasicExecutionContext.getCurrentExecutionContext()); }  static EntityInitializer addingTags(Object... tags); static T resolve(ConfigBag configBag, ConfigKey<T> key); static T resolve(ConfigBag configBag, ConfigKey<T> key, ExecutionContext executionContext);  }
@Test public void testResolveSimple() throws Exception { assertEquals(resolve(ImmutableMap.of("mykey", "myval"), keyWithDefault), "myval"); assertEquals(resolve(MutableMap.of("mykey", null), keyWithDefault), null); }
@Test public void testResolveDeferredSupplier() throws Exception { DeferredSupplier<String> supplier = new DeferredSupplier<String>() { @Override public String get() { return "myval"; } }; assertEquals(resolve(ImmutableMap.of("mykey", supplier), keyWithDefault), "myval"); }
@Test public void testResolveUsesDefaultIfAbsent() throws Exception { assertEquals(resolve(ImmutableMap.of(), keyWithDefault), "mydefault"); }