@Test public void testGetConfig_withParent_badType() { try { File first = copyResourceTo("/net/morimekta/providence/config/files/base_service.cfg", temp.getRoot()); File second = copyResourceTo("/net/morimekta/providence/config/files/stage_db.cfg", temp.getRoot()); ProvidenceConfig config = new ProvidenceConfig(registry, null, true); Service firstConfig = config.getConfig(first); config.getConfig(second, firstConfig); fail("no exception"); } catch (ProvidenceConfigException e) { assertThat(e.getMessage(), is("Loaded config type config.Service does not match parent config.Database")); assertThat(e.getFile(), is("stage_db.cfg")); assertThat(e.asString(), is("Error in stage_db.cfg: Loaded config type config.Service does not match parent config.Database")); } }
@Nonnull public <M extends PMessage<M, F>, F extends PField> M getConfig(@Nonnull File configFile) throws ProvidenceConfigException { ConfigSupplier<M,F> supplier = resolveConfig(configFile); return supplier.get(); }
ProvidenceConfig implements ConfigResolver { @Nonnull public <M extends PMessage<M, F>, F extends PField> M getConfig(@Nonnull File configFile) throws ProvidenceConfigException { ConfigSupplier<M,F> supplier = resolveConfig(configFile); return supplier.get(); } }
ProvidenceConfig implements ConfigResolver { @Nonnull public <M extends PMessage<M, F>, F extends PField> M getConfig(@Nonnull File configFile) throws ProvidenceConfigException { ConfigSupplier<M,F> supplier = resolveConfig(configFile); return supplier.get(); } ProvidenceConfig(TypeRegistry registry);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher, boolean strict);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher,
                            boolean strict,
                            @Nonnull Clock clock); }
ProvidenceConfig implements ConfigResolver { @Nonnull public <M extends PMessage<M, F>, F extends PField> M getConfig(@Nonnull File configFile) throws ProvidenceConfigException { ConfigSupplier<M,F> supplier = resolveConfig(configFile); return supplier.get(); } ProvidenceConfig(TypeRegistry registry);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher, boolean strict);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher,
                            boolean strict,
                            @Nonnull Clock clock); @Nonnull @Override @SuppressWarnings("unchecked") ConfigSupplier<M, F> resolveConfig(@Nonnull File configFile,
                                       @Nullable ConfigSupplier<M, F> parentConfig); @Nonnull M getConfig(@Nonnull File configFile); @Nonnull M getConfig(@Nonnull File configFile, @Nonnull M parent); }
ProvidenceConfig implements ConfigResolver { @Nonnull public <M extends PMessage<M, F>, F extends PField> M getConfig(@Nonnull File configFile) throws ProvidenceConfigException { ConfigSupplier<M,F> supplier = resolveConfig(configFile); return supplier.get(); } ProvidenceConfig(TypeRegistry registry);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher, boolean strict);  ProvidenceConfig(@Nonnull TypeRegistry registry,
                            @Nullable FileWatcher watcher,
                            boolean strict,
                            @Nonnull Clock clock); @Nonnull @Override @SuppressWarnings("unchecked") ConfigSupplier<M, F> resolveConfig(@Nonnull File configFile,
                                       @Nullable ConfigSupplier<M, F> parentConfig); @Nonnull M getConfig(@Nonnull File configFile); @Nonnull M getConfig(@Nonnull File configFile, @Nonnull M parent);  }