@Test public void testExtractWrongFunctionalityIds() { List<Functionality> functionalities = Arrays.asList( new Functionality().withId(Long.valueOf(42)), new Functionality().withId(Long.valueOf(43))); assertWrongFunctionalityIds("Functionality 42: OK", functionalities); assertWrongFunctionalityIds("Functionality 42, 43: OK", functionalities); assertWrongFunctionalityIds("Functionality 404: Nonexistent", functionalities, "404"); assertWrongFunctionalityIds("Functionality -42: Nonexistent", functionalities, "-42"); assertWrongFunctionalityIds("Functionality foobar: ______Parsing error", functionalities, "foobar"); assertWrongFunctionalityIds("Functionality foo, 43, bar: Parsing error", functionalities, "foo", "bar"); assertWrongFunctionalityIds("Functionality 42, 43foo: ___Parsing error", functionalities, "43foo"); }
public static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities) { List<String> wrongIds = new ArrayList<>(); for (final String rawMaybeId : maybeIds(scenarioName)) { String maybeId = rawMaybeId.trim(); try { Long longId = Long.valueOf(maybeId); if (functionalities.stream().noneMatch(f -> longId.equals(f.getId()))) { wrongIds.add(maybeId); } } catch (final NumberFormatException e) { wrongIds.add(maybeId); } } return wrongIds; }
ScenarioExtractorUtil { public static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities) { List<String> wrongIds = new ArrayList<>(); for (final String rawMaybeId : maybeIds(scenarioName)) { String maybeId = rawMaybeId.trim(); try { Long longId = Long.valueOf(maybeId); if (functionalities.stream().noneMatch(f -> longId.equals(f.getId()))) { wrongIds.add(maybeId); } } catch (final NumberFormatException e) { wrongIds.add(maybeId); } } return wrongIds; } }
ScenarioExtractorUtil { public static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities) { List<String> wrongIds = new ArrayList<>(); for (final String rawMaybeId : maybeIds(scenarioName)) { String maybeId = rawMaybeId.trim(); try { Long longId = Long.valueOf(maybeId); if (functionalities.stream().noneMatch(f -> longId.equals(f.getId()))) { wrongIds.add(maybeId); } } catch (final NumberFormatException e) { wrongIds.add(maybeId); } } return wrongIds; }  }
ScenarioExtractorUtil { public static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities) { List<String> wrongIds = new ArrayList<>(); for (final String rawMaybeId : maybeIds(scenarioName)) { String maybeId = rawMaybeId.trim(); try { Long longId = Long.valueOf(maybeId); if (functionalities.stream().noneMatch(f -> longId.equals(f.getId()))) { wrongIds.add(maybeId); } } catch (final NumberFormatException e) { wrongIds.add(maybeId); } } return wrongIds; }  static List<Scenario> extractScenarios(Source source, List<Feature> features); static List<Long> extractFunctionalityIds(String scenarioName); static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities); static String removeFunctionalitiesFromScenarioCucumberId(String cucumberId); static String removeFunctionalitiesFromScenarioName(String name); }
ScenarioExtractorUtil { public static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities) { List<String> wrongIds = new ArrayList<>(); for (final String rawMaybeId : maybeIds(scenarioName)) { String maybeId = rawMaybeId.trim(); try { Long longId = Long.valueOf(maybeId); if (functionalities.stream().noneMatch(f -> longId.equals(f.getId()))) { wrongIds.add(maybeId); } } catch (final NumberFormatException e) { wrongIds.add(maybeId); } } return wrongIds; }  static List<Scenario> extractScenarios(Source source, List<Feature> features); static List<Long> extractFunctionalityIds(String scenarioName); static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities); static String removeFunctionalitiesFromScenarioCucumberId(String cucumberId); static String removeFunctionalitiesFromScenarioName(String name);  }