Blueprint { public static <T> T create(Class<T> iface, ConfigNode<?> node) { return create(iface, node, new IdentityKeyResolver()); }  static Builder<T> of(Class<T> iface); static T create(Class<T> iface, ConfigNode<?> node); static T create(Class<T> iface, ConfigNode<?> node, KeyResolver keyResolver);  }
@Test @BeforeClass private TestInterface createTestBlueprint() { return Blueprint.create(TestInterface.class, TEST_NODE); }
@Test(expectedExceptions = IllegalArgumentException.class) public void rejectsClasses() throws ConfigurationValidationException { Blueprint.create(Class.class, TEST_NODE); }
@Test public void keyResolution() { TestBeanConfiguration cfg = Blueprint.create(TestBeanConfiguration.class, TEST_NODE, new BeanKeyResolver()); assertEquals(cfg.getServiceName(), "DummyService"); assertTrue(cfg.isActive()); assertEquals(cfg.getBackupHours().size(), 3); assertEquals(cfg.http().get("host"), "localhost"); assertEquals(cfg.db().getImpl(), java.util.Random.class); assertEquals(cfg.protocols().get("telnet").getName(), "Telnet"); }