@Test public void testParseWithUnknownInclude() throws IOException { copyResourceTo("/net/morimekta/providence/config/files/unknown.cfg", temp.getRoot()); File file = copyResourceTo("/net/morimekta/providence/config/files/unknown_include.cfg", temp.getRoot()); Pair<Database, Set<String>> cfg = parser.parseConfig(file.toPath(), null); assertEquals("{\n" + " uri = \"jdbc:h2:localhost:mem\"\n" + " driver = \"org.h2.Driver\"\n" + "}", debugString(cfg.first)); file = copyResourceTo("/net/morimekta/providence/config/files/unknown_field.cfg", temp.getRoot()); cfg = parser.parseConfig(file.toPath(), null); assertEquals("{\n" + " uri = \"jdbc:h2:localhost:mem\"\n" + " driver = \"org.h2.Driver\"\n" + "}", debugString(cfg.first)); file = copyResourceTo("/net/morimekta/providence/config/files/unknown_enum_value.cfg", temp.getRoot()); cfg = parser.parseConfig(file.toPath(), null); assertEquals("{\n" + " uri = \"jdbc:h2:localhost:mem\"\n" + " driver = \"org.h2.Driver\"\n" + "}", debugString(cfg.first)); }
@Nonnull <M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent) throws ProvidenceConfigException { try { configFile = canonicalFileLocation(configFile); } catch (IOException e) { throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile) .setFile(configFile.getFileName() .toString()); } Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent); if (result == null) { throw new ProvidenceConfigException("No config: " + configFile.toString()) .setFile(configFile.getFileName() .toString()); } return result; }
ProvidenceConfigParser { @Nonnull <M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent) throws ProvidenceConfigException { try { configFile = canonicalFileLocation(configFile); } catch (IOException e) { throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile) .setFile(configFile.getFileName() .toString()); } Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent); if (result == null) { throw new ProvidenceConfigException("No config: " + configFile.toString()) .setFile(configFile.getFileName() .toString()); } return result; } }
ProvidenceConfigParser { @Nonnull <M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent) throws ProvidenceConfigException { try { configFile = canonicalFileLocation(configFile); } catch (IOException e) { throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile) .setFile(configFile.getFileName() .toString()); } Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent); if (result == null) { throw new ProvidenceConfigException("No config: " + configFile.toString()) .setFile(configFile.getFileName() .toString()); } return result; } ProvidenceConfigParser(TypeRegistry registry, boolean strict); }
ProvidenceConfigParser { @Nonnull <M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent) throws ProvidenceConfigException { try { configFile = canonicalFileLocation(configFile); } catch (IOException e) { throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile) .setFile(configFile.getFileName() .toString()); } Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent); if (result == null) { throw new ProvidenceConfigException("No config: " + configFile.toString()) .setFile(configFile.getFileName() .toString()); } return result; } ProvidenceConfigParser(TypeRegistry registry, boolean strict);  }
ProvidenceConfigParser { @Nonnull <M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent) throws ProvidenceConfigException { try { configFile = canonicalFileLocation(configFile); } catch (IOException e) { throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile) .setFile(configFile.getFileName() .toString()); } Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent); if (result == null) { throw new ProvidenceConfigException("No config: " + configFile.toString()) .setFile(configFile.getFileName() .toString()); } return result; } ProvidenceConfigParser(TypeRegistry registry, boolean strict);   }