EnvironmentConfigurationUtils { public static String tryInferContentTypeFromValue(final String value) { if (isBlank(value)) { return null; } char initial = value.trim().charAt(0); switch (initial) { case '[': case '{': return JSON; case '<': throw new MissingEnvironmentException("XML Environment Values are not yet supported."); default: return YAML; } } @Inject  EnvironmentConfigurationUtils(JsonTools jsonTools, EntityLoaderRegistry entityLoaderRegistry,
                                  JsonFileUtils jsonFileUtils, final EntityTypeRegistry entityTypeRegistry); @SuppressWarnings("unchecked") Map<String, String> parseEnvironmentValues(Map providedEnvironmentValues); Pair<String, Map<String, String>> parseBundleMetadata(File metaDataFile, File configFolder); Map<String, String> loadConfigFolder(final File configFolder); @NotNull String loadConfigFromFile(File configFile, String entityType, String entityName); @NotNull Map<String, String> loadConfigFromFile(File configFile, String entityType); static String tryInferContentTypeFromValue(final String value); static DependentBundle generateDependentEnvBundleFromProject(final ProjectInfo projectInfo); static String extractEntityName(final String entityName);  }
@Test void inferContentYaml() { assertEquals(JsonTools.YAML, tryInferContentTypeFromValue("test1:1\ntest1:2")); }
@Test void inferContentJson() { assertEquals(JsonTools.JSON, tryInferContentTypeFromValue("{ 'test1': 1, 'test2': 2 }")); }
@Test void inferContentJsonArray() { assertEquals(JsonTools.JSON, tryInferContentTypeFromValue("[ { 'test1': 1, 'test2': 2 }, { 'test3': 3, 'test4': 4 } ]")); }
@Test void inferContentXMLUnsupported() { assertThrows(MissingEnvironmentException.class, () -> tryInferContentTypeFromValue("<test1>1</test1><test2>2</test2>")); }