+ /**
+ * Specific test method for the YAML Extractor test.
+ *
+ * @param toscaFiles
+ * files extracted by the YamlExtractor
+ * @param ymlPayloadsToLoad
+ * the expected YAML files
+ * @throws IOException
+ * if an I/O exception occurs
+ */
+ public void performYmlAsserts(List<Artifact> toscaFiles, List<String> ymlPayloadsToLoad) throws IOException {
+ assertThat("An incorrect number of YAML files have been extracted", toscaFiles.size(),
+ is(equalTo(ymlPayloadsToLoad.size())));
+
+ Map<String, String> ymlMap = new HashMap<>();
+ for (String filename : ymlPayloadsToLoad) {
+ ymlMap.put(filename, loadResourceAsString(filename));
+ }
+
+ for (Artifact artifact : toscaFiles) {
+ String fileName = artifact.getName().replaceFirst("Definitions/", "ymlFiles/");
+ String expectedYaml = ymlMap.get(fileName);
+ assertThat("Missing expected content for " + fileName, expectedYaml, is(not(nullValue())));
+ assertThat("The content of " + fileName + " must match the expected content",
+ convertToString(artifact.getPayload()).replaceAll("\\r\\n?", "\n"), is(equalTo(expectedYaml)));
+ }