test_class.declarator: elementIndexPreProcessor
test_class.modifier: private
test_class.original_string: private ElementIndexPreProcessor elementIndexPreProcessor;
test_class.type: ElementIndexPreProcessor
test_class.var_name: elementIndexPreProcessor
test_class.file: plugin-code/src/test/java/com/trivago/cluecumber/json/processors/ElementIndexPreProcessorTest.java
test_class.identifier: ElementIndexPreProcessorTest
test_case.body: @Test
      public void addScenarioIndicesWithoutTimestampTest() {
          List<Report> reports = new ArrayList<>();
          Report report = new Report();
          List<Element> elements = new ArrayList<>();
  
          Element element = new Element();
          element.setName("Scenario 1");
          element.setType("scenario");
          elements.add(element);
  
          element = new Element();
          element.setName("Scenario 2");
          element.setType("scenario");
          elements.add(element);
  
          element = new Element();
          element.setName("Scenario 3");
          element.setType("scenario");
          elements.add(element);
  
          report.setElements(elements);
          reports.add(report);
  
          List<Element> e = reports.get(0).getElements();
          assertThat(e.get(0).getScenarioIndex(), is(0));
          assertThat(e.get(1).getScenarioIndex(), is(0));
          assertThat(e.get(2).getScenarioIndex(), is(0));
  
          elementIndexPreProcessor.addScenarioIndices(reports);
  
          assertThat(e.get(0).getScenarioIndex(), is(1));
          assertThat(e.get(1).getScenarioIndex(), is(2));
          assertThat(e.get(2).getScenarioIndex(), is(3));
      }
test_case.class_method_signature: ElementIndexPreProcessorTest.addScenarioIndicesWithoutTimestampTest()
test_case.full_signature: @Test public void addScenarioIndicesWithoutTimestampTest()
test_case.identifier: addScenarioIndicesWithoutTimestampTest
test_case.invocations: setName setType add setName setType add setName setType add setElements add getElements get assertThat getScenarioIndex get is assertThat getScenarioIndex get is assertThat getScenarioIndex get is addScenarioIndices assertThat getScenarioIndex get is assertThat getScenarioIndex get is assertThat getScenarioIndex get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addScenarioIndicesWithoutTimestampTest()
focal_class.file: plugin-code/src/main/java/com/trivago/cluecumber/json/processors/ElementIndexPreProcessor.java
focal_class.identifier: ElementIndexPreProcessor
focal_class.class_method_signature: ElementIndexPreProcessor.addScenarioIndices(final List<Report> reports)
focal_class.full_signature: public void addScenarioIndices(final List<Report> reports)
focal_class.identifier: addScenarioIndices
focal_class.modifiers: public
focal_class.parameters: (final List<Report> reports)
focal_class.return: void
focal_class.signature: void addScenarioIndices(final List<Report> reports)
focal_method.body: public void addScenarioIndices(final List<Report> reports) {
          List<Element> elements = new ArrayList<>();
          for (Report report : reports) {
              elements.addAll(report.getElements());
          }
  
          List<Element> sortedElements =
                  elements.stream().
                          sorted(Comparator.comparing(Element::getStartTimestamp)).
                          collect(Collectors.toList());
  
          int scenarioIndex = 0;
          for (Element element : sortedElements) {
              if (element.isScenario()) {
                  scenarioIndex++;
                  element.setScenarioIndex(scenarioIndex);
              }
          }
      }
focal_method.class_method_signature: ElementIndexPreProcessor.addScenarioIndices(final List<Report> reports)
focal_method.full_signature: public void addScenarioIndices(final List<Report> reports)
focal_method.identifier: addScenarioIndices
focal_method.invocations: addAll getElements collect sorted stream comparing toList isScenario setScenarioIndex
focal_method.modifiers: public
focal_method.parameters: (final List<Report> reports)
focal_method.return: void
focal_method.signature: void addScenarioIndices(final List<Report> reports)