Enrich YangParserTestUtils with parseYang(String)
[yangtools.git] / parser / yang-test-util / src / main / java / org / opendaylight / yangtools / yang / test / util / YangParserTestUtils.java
index f4e3b9608bbade264061d3416f843253a970cb4b..0aac1c47c64a30bd4763b0f64fd92c762d759e3b 100644 (file)
@@ -369,6 +369,17 @@ public final class YangParserTestUtils {
         }
     }
 
+    /**
+     * Creates a new effective schema context containing the specified YANG sources.
+     *
+     * @param sources list of yang sources in plain string
+     * @return effective schema context
+     */
+    public static EffectiveModelContext parseYang(final String... sources) {
+        return parseSources(YangParserConfiguration.DEFAULT, null,
+            Arrays.stream(sources).map(LiteralYangTextSchemaSource::ofLiteral).toList());
+    }
+
     @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Wrong inferent on listFiles")
     private static Collection<File> getYangFiles(final String resourcePath) {
         final URI directoryPath;