@Test public void mapFailuresToScenarios_should_match_failures_to_scenarios_if_any() { final Failure failure2 = new Failure().withSource(new Source().withId("id2")); final Failure failure3 = new Failure().withSource(new Source().withId("id3")); List<Failure> failures = Arrays.asList(failure2, failure3); final NewmanScenario newmanScenario1 = new NewmanScenario().withItem(new Item().withId("id1")); final NewmanScenario newmanScenario2 = new NewmanScenario().withItem(new Item().withId("id2")); List<NewmanScenario> newmanScenarios = Arrays.asList(newmanScenario1, newmanScenario2); cut.mapFailuresToScenarios(failures, newmanScenarios); assertThat(newmanScenario1.getFailures()).isEmpty(); assertThat(newmanScenario2.getFailures()).hasSize(1); assertThat(newmanScenario2.getFailures().get(0)).isSameAs(failure2); }
void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) { for (Failure failure : failures) { Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId()); if (newmanScenario.isPresent()) { newmanScenario.get().getFailures().add(failure); } else { log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId()); } } }
PostmanService { void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) { for (Failure failure : failures) { Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId()); if (newmanScenario.isPresent()) { newmanScenario.get().getFailures().add(failure); } else { log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId()); } } } }
PostmanService { void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) { for (Failure failure : failures) { Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId()); if (newmanScenario.isPresent()) { newmanScenario.get().getFailures().add(failure); } else { log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId()); } } }  }
PostmanService { void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) { for (Failure failure : failures) { Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId()); if (newmanScenario.isPresent()) { newmanScenario.get().getFailures().add(failure); } else { log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId()); } } }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); }
PostmanService { void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) { for (Failure failure : failures) { Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId()); if (newmanScenario.isPresent()) { newmanScenario.get().getFailures().add(failure); } else { log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId()); } } }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); static final String FOLDER_DELIMITER; }