ConfigCoreContext extends ConfigContext { @Override public void register(Class<?>... configurable) { doLookup(); schemaManager.register(configurable); if (cacheManager.isPresent()) { for (Class<?> cls : configurable) { Schema schema = schemaManager.getSchema(cls); cacheManager.get().registerSchema(schema); } } }  @Override void register(Class<?>... configurable); @Override void unregister(Class<?>... configurable); @Override T get(Class<T> configurable); @Override List<T> list(Class<T> configurable); @Override Optional<T> get(String id, Class<T> configurable); @Override ConfigQuery<T> newQuery(Class<T> configurable); @Override void registerObserver(ConfigObserver observer); void doLookup();  }
@Test @SuppressWarnings("unused") public void test_immutable() { config.register(ImmutableConfig.class); Bean b = Bean.create(BeanId.create("1", "immutable")); b.setProperty("test", "something else"); try { admin.set(b); fail("Should not be able to set immutable properties"); } catch (AbortRuntimeException e) { assertThat(e.getEvent().getCode(), is(CFG306)); } try { admin.create(b); fail("Should not be able to set immutable properties"); } catch (AbortRuntimeException e) { assertThat(e.getEvent().getCode(), is(CFG306)); } try { admin.merge(b); fail("Should not be able to set immutable properties"); } catch (AbortRuntimeException e) { assertThat(e.getEvent().getCode(), is(CFG306)); } }
@Test public void test_non_final_static_modifier() { try { config.register(NonFinalStaticPropConfig.class); fail("Non final static properties should not be allowed"); } catch (AbortRuntimeException e) { assertThat(e.getEvent().getCode(), is(CFG108)); } }
@Test public void test_non_final_static_id() { try { config.register(NonFinalStaticIdConfig.class); fail("Non final static properties should not be allowed"); } catch (AbortRuntimeException e) { assertThat(e.getEvent().getCode(), is(CFG108)); } }