@Test public void collectItemScenarios_should_return_empty_list_if_items_is_null() { List<Scenario> scenarios = cut.collectItemScenarios(null, null, null, null, null); assertThat(scenarios).isEmpty(); }
List<Scenario> collectItemScenarios(ItemWithScripts[] items, Source source, AtomicInteger requestPosition, String parentSeverity, List<Assertion> parentAssertions, String... parentFolders) { List<Scenario> scenarios = new ArrayList<>(); if (items != null) { for (ItemWithScripts item : items) { boolean isRootFolder = (parentFolders.length == 0); boolean isFolder = isRootFolder || item.isSubFolder(); String severity = postmanService.getSeverity(ArrayUtils.addAll(parentFolders, item.getName())); if (StringUtils.isEmpty(severity)) { severity = parentSeverity; } String nameWithoutTag = postmanService.removeSeverityTag(item.getName()); String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag); List<Assertion> assertions = ListUtils.union(extractAssertions(item), parentAssertions); if (isFolder) { scenarios.addAll(collectItemScenarios(item.getChildren(), source, requestPosition, severity, assertions, path)); } else { scenarios.add(toScenario(item, source, requestPosition, severity, assertions, path)); } } } return scenarios; }
PostmanScenarioIndexerService { List<Scenario> collectItemScenarios(ItemWithScripts[] items, Source source, AtomicInteger requestPosition, String parentSeverity, List<Assertion> parentAssertions, String... parentFolders) { List<Scenario> scenarios = new ArrayList<>(); if (items != null) { for (ItemWithScripts item : items) { boolean isRootFolder = (parentFolders.length == 0); boolean isFolder = isRootFolder || item.isSubFolder(); String severity = postmanService.getSeverity(ArrayUtils.addAll(parentFolders, item.getName())); if (StringUtils.isEmpty(severity)) { severity = parentSeverity; } String nameWithoutTag = postmanService.removeSeverityTag(item.getName()); String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag); List<Assertion> assertions = ListUtils.union(extractAssertions(item), parentAssertions); if (isFolder) { scenarios.addAll(collectItemScenarios(item.getChildren(), source, requestPosition, severity, assertions, path)); } else { scenarios.add(toScenario(item, source, requestPosition, severity, assertions, path)); } } } return scenarios; } }
PostmanScenarioIndexerService { List<Scenario> collectItemScenarios(ItemWithScripts[] items, Source source, AtomicInteger requestPosition, String parentSeverity, List<Assertion> parentAssertions, String... parentFolders) { List<Scenario> scenarios = new ArrayList<>(); if (items != null) { for (ItemWithScripts item : items) { boolean isRootFolder = (parentFolders.length == 0); boolean isFolder = isRootFolder || item.isSubFolder(); String severity = postmanService.getSeverity(ArrayUtils.addAll(parentFolders, item.getName())); if (StringUtils.isEmpty(severity)) { severity = parentSeverity; } String nameWithoutTag = postmanService.removeSeverityTag(item.getName()); String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag); List<Assertion> assertions = ListUtils.union(extractAssertions(item), parentAssertions); if (isFolder) { scenarios.addAll(collectItemScenarios(item.getChildren(), source, requestPosition, severity, assertions, path)); } else { scenarios.add(toScenario(item, source, requestPosition, severity, assertions, path)); } } } return scenarios; }  }
PostmanScenarioIndexerService { List<Scenario> collectItemScenarios(ItemWithScripts[] items, Source source, AtomicInteger requestPosition, String parentSeverity, List<Assertion> parentAssertions, String... parentFolders) { List<Scenario> scenarios = new ArrayList<>(); if (items != null) { for (ItemWithScripts item : items) { boolean isRootFolder = (parentFolders.length == 0); boolean isFolder = isRootFolder || item.isSubFolder(); String severity = postmanService.getSeverity(ArrayUtils.addAll(parentFolders, item.getName())); if (StringUtils.isEmpty(severity)) { severity = parentSeverity; } String nameWithoutTag = postmanService.removeSeverityTag(item.getName()); String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag); List<Assertion> assertions = ListUtils.union(extractAssertions(item), parentAssertions); if (isFolder) { scenarios.addAll(collectItemScenarios(item.getChildren(), source, requestPosition, severity, assertions, path)); } else { scenarios.add(toScenario(item, source, requestPosition, severity, assertions, path)); } } } return scenarios; }  List<Scenario> extractScenarios(Source source, File zipFile); }
PostmanScenarioIndexerService { List<Scenario> collectItemScenarios(ItemWithScripts[] items, Source source, AtomicInteger requestPosition, String parentSeverity, List<Assertion> parentAssertions, String... parentFolders) { List<Scenario> scenarios = new ArrayList<>(); if (items != null) { for (ItemWithScripts item : items) { boolean isRootFolder = (parentFolders.length == 0); boolean isFolder = isRootFolder || item.isSubFolder(); String severity = postmanService.getSeverity(ArrayUtils.addAll(parentFolders, item.getName())); if (StringUtils.isEmpty(severity)) { severity = parentSeverity; } String nameWithoutTag = postmanService.removeSeverityTag(item.getName()); String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag); List<Assertion> assertions = ListUtils.union(extractAssertions(item), parentAssertions); if (isFolder) { scenarios.addAll(collectItemScenarios(item.getChildren(), source, requestPosition, severity, assertions, path)); } else { scenarios.add(toScenario(item, source, requestPosition, severity, assertions, path)); } } } return scenarios; }  List<Scenario> extractScenarios(Source source, File zipFile);  }