Package org.jbehave.core.model.Lifecycle

Examples of org.jbehave.core.model.Lifecycle.Steps


        Matcher findingLifecycle = patternToPullLifecycleIntoGroupOne().matcher(beforeScenario);
        String lifecycle = findingLifecycle.find() ? findingLifecycle.group(1).trim() : NONE;
        Matcher findingBeforeAndAfter = compile(".*" + keywords.before() + "(.*)\\s*" + keywords.after() + "(.*)\\s*", DOTALL).matcher(lifecycle);
        if ( findingBeforeAndAfter.matches() ){
            String beforeLifecycle = findingBeforeAndAfter.group(1).trim();
      Steps beforeSteps = parseBeforeLifecycle(beforeLifecycle);
            String afterLifecycle = findingBeforeAndAfter.group(2).trim();
      Steps[] afterSteps = parseAfterLifecycle(afterLifecycle);
            return new Lifecycle(beforeSteps, afterSteps);
        }
        Matcher findingBefore = compile(".*" + keywords.before() + "(.*)\\s*", DOTALL).matcher(lifecycle);
        if ( findingBefore.matches() ){
            String beforeLifecycle = findingBefore.group(1).trim();
      Steps beforeSteps = parseBeforeLifecycle(beforeLifecycle);
            return new Lifecycle(beforeSteps, new Steps(new ArrayList<String>()));
        }
        Matcher findingAfter = compile(".*" + keywords.after() + "(.*)\\s*", DOTALL).matcher(lifecycle);
        if ( findingAfter.matches() ){
            Steps beforeSteps = Steps.EMPTY;
            String afterLifecycle = findingAfter.group(1).trim();
      Steps[] afterSteps = parseAfterLifecycle(afterLifecycle);
            return new Lifecycle(beforeSteps, afterSteps);
        }
        return Lifecycle.EMPTY;
View Full Code Here


        }
        return Lifecycle.EMPTY;
    }

  private Steps parseBeforeLifecycle(String lifecycleAsText) {
    return new Steps(findSteps(startingWithNL(lifecycleAsText)));
  }
View Full Code Here

    List<Steps> list = new ArrayList<Steps>();
    for (String stepsByOutcome : lifecycleAsText.split(keywords.outcome()) ){
      if ( stepsByOutcome.trim().isEmpty() ) continue;
      String outcomeAsText = findOutcome(stepsByOutcome);
      List<String> steps = findSteps(startingWithNL(StringUtils.removeStart(stepsByOutcome.trim(), outcomeAsText)));
      list.add(new Steps(parseOutcome(outcomeAsText), steps));
    }
    return list.toArray(new Steps[list.size()]);
  }
View Full Code Here

TOP

Related Classes of org.jbehave.core.model.Lifecycle.Steps

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.