@Test public void toScenario_should_set_country_all_when_source_has_no_country_in_root_folders() { ItemWithScripts item = new ItemWithScripts(); Source source = new Source().withPostmanCountryRootFolders(false); AtomicInteger requestPosition = new AtomicInteger(); String[] path = { "any" }; final Scenario scenario = cut.toScenario(item, source, requestPosition, "the-severity", Collections.emptyList(), path); assertThat(scenario.getCountryCodes()).isEqualTo("all"); }
Scenario toScenario(ItemWithScripts item, Source source, AtomicInteger requestPosition, String severity, List<Assertion> assertions, String... path) { final String countryCodes; if (source.isPostmanCountryRootFolders()) { countryCodes = extractCountryCodes(path); } else { countryCodes = Tag.COUNTRY_ALL; } final Assertion[] assertionsArray = assertions.toArray(new Assertion[0]); String content = postmanService.buildScenarioContent(item.getRequest(), null, assertionsArray, null, true); Scenario scenario = new Scenario(); scenario.setSource(source); scenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity); scenario.setCountryCodes(countryCodes); scenario.setSeverity(severity); scenario.setName(String.join(PostmanService.FOLDER_DELIMITER, path)); scenario.setLine(requestPosition.incrementAndGet()); scenario.setContent(content); return scenario; }
PostmanScenarioIndexerService { Scenario toScenario(ItemWithScripts item, Source source, AtomicInteger requestPosition, String severity, List<Assertion> assertions, String... path) { final String countryCodes; if (source.isPostmanCountryRootFolders()) { countryCodes = extractCountryCodes(path); } else { countryCodes = Tag.COUNTRY_ALL; } final Assertion[] assertionsArray = assertions.toArray(new Assertion[0]); String content = postmanService.buildScenarioContent(item.getRequest(), null, assertionsArray, null, true); Scenario scenario = new Scenario(); scenario.setSource(source); scenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity); scenario.setCountryCodes(countryCodes); scenario.setSeverity(severity); scenario.setName(String.join(PostmanService.FOLDER_DELIMITER, path)); scenario.setLine(requestPosition.incrementAndGet()); scenario.setContent(content); return scenario; } }
PostmanScenarioIndexerService { Scenario toScenario(ItemWithScripts item, Source source, AtomicInteger requestPosition, String severity, List<Assertion> assertions, String... path) { final String countryCodes; if (source.isPostmanCountryRootFolders()) { countryCodes = extractCountryCodes(path); } else { countryCodes = Tag.COUNTRY_ALL; } final Assertion[] assertionsArray = assertions.toArray(new Assertion[0]); String content = postmanService.buildScenarioContent(item.getRequest(), null, assertionsArray, null, true); Scenario scenario = new Scenario(); scenario.setSource(source); scenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity); scenario.setCountryCodes(countryCodes); scenario.setSeverity(severity); scenario.setName(String.join(PostmanService.FOLDER_DELIMITER, path)); scenario.setLine(requestPosition.incrementAndGet()); scenario.setContent(content); return scenario; }  }
PostmanScenarioIndexerService { Scenario toScenario(ItemWithScripts item, Source source, AtomicInteger requestPosition, String severity, List<Assertion> assertions, String... path) { final String countryCodes; if (source.isPostmanCountryRootFolders()) { countryCodes = extractCountryCodes(path); } else { countryCodes = Tag.COUNTRY_ALL; } final Assertion[] assertionsArray = assertions.toArray(new Assertion[0]); String content = postmanService.buildScenarioContent(item.getRequest(), null, assertionsArray, null, true); Scenario scenario = new Scenario(); scenario.setSource(source); scenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity); scenario.setCountryCodes(countryCodes); scenario.setSeverity(severity); scenario.setName(String.join(PostmanService.FOLDER_DELIMITER, path)); scenario.setLine(requestPosition.incrementAndGet()); scenario.setContent(content); return scenario; }  List<Scenario> extractScenarios(Source source, File zipFile); }
PostmanScenarioIndexerService { Scenario toScenario(ItemWithScripts item, Source source, AtomicInteger requestPosition, String severity, List<Assertion> assertions, String... path) { final String countryCodes; if (source.isPostmanCountryRootFolders()) { countryCodes = extractCountryCodes(path); } else { countryCodes = Tag.COUNTRY_ALL; } final Assertion[] assertionsArray = assertions.toArray(new Assertion[0]); String content = postmanService.buildScenarioContent(item.getRequest(), null, assertionsArray, null, true); Scenario scenario = new Scenario(); scenario.setSource(source); scenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity); scenario.setCountryCodes(countryCodes); scenario.setSeverity(severity); scenario.setName(String.join(PostmanService.FOLDER_DELIMITER, path)); scenario.setLine(requestPosition.incrementAndGet()); scenario.setContent(content); return scenario; }  List<Scenario> extractScenarios(Source source, File zipFile);  }