HeroicConfig { static Optional<HeroicConfig.Builder> loadConfig(final ObjectMapper mapper, final Path path) { try (final InputStream in = Files.newInputStream(path)) { return loadConfig(mapper, in); } catch (final JsonMappingException e) { final JsonLocation location = e.getLocation(); final String message = String.format("%s[%d:%d]: %s", path, location == null ? null : location.getLineNr(), location == null ? null : location.getColumnNr(), e.getOriginalMessage()); throw new RuntimeException(message, e); } catch (final Exception e) { final String message = String.format("%s: %s", path, e.getMessage()); throw new RuntimeException(message, e); } }  static HeroicConfig create(
        Optional<String> id,
        Duration startTimeout,
        Duration stopTimeout,
        Optional<String> host,
        Optional<Integer> port,
        List<JettyServerConnector> connectors,
        boolean enableCors,
        Optional<String> corsAllowOrigin,
        FeatureSet features,
        ClusterManagerModule cluster,
        MetricManagerModule metric,
        MetadataManagerModule metadata,
        SuggestManagerModule suggest,
        CacheModule cache,
        IngestionModule ingestion,
        List<ConsumerModule> consumers,
        Optional<ShellServerModule> shellServer,
        AnalyticsModule analytics,
        CoreGeneratorModule generator,
        StatisticsModule statistics,
        QueryLoggingModule queryLogging,
        Optional<ConditionalFeatures> conditionalFeatures,
        TracingConfig tracing,
        UsageTrackingModule usageTracking,
        @Nullable String sentryDsn,
        String version,
        String service,
        String commit
    ); abstract Optional<String> id(); abstract Duration startTimeout(); abstract Duration stopTimeout(); abstract Optional<String> host(); abstract Optional<Integer> port(); abstract List<JettyServerConnector> connectors(); abstract boolean enableCors(); abstract Optional<String> corsAllowOrigin(); abstract FeatureSet features(); abstract ClusterManagerModule cluster(); abstract MetricManagerModule metric(); abstract MetadataManagerModule metadata(); abstract SuggestManagerModule suggest(); abstract CacheModule cache(); abstract IngestionModule ingestion(); abstract List<ConsumerModule> consumers(); abstract Optional<ShellServerModule> shellServer(); abstract AnalyticsModule analytics(); abstract CoreGeneratorModule generator(); abstract StatisticsModule statistics(); abstract QueryLoggingModule queryLogging(); abstract Optional<ConditionalFeatures> conditionalFeature(); abstract TracingConfig tracing(); abstract UsageTrackingModule usageTracking(); @Nullable abstract String sentryDsn(); abstract String version(); abstract String service(); abstract String commit(); static Builder builder();  }
@Test public void testConfigEmpty() throws Exception { try (final InputStream in = resource("Config.Empty.yml")) { assertFalse(HeroicConfig.loadConfig(mapper, in).isPresent()); } }