All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jbehaviour.impl.JBehaviourScenario Maven / Gradle / Ivy

The newest version!
package org.jbehaviour.impl;

import java.util.ArrayList;
import java.util.List;

import org.jbehaviour.IBehaviourScenario;
import org.jbehaviour.parser.model.IKeywordStatement.statement;
import org.jbehaviour.parser.model.impl.KeywordScenario;
import org.jbehaviour.reflexion.IBehaviourReflexionContext;

public class JBehaviourScenario implements IBehaviourScenario {
	private List contexts = new ArrayList();
	List callers = new ArrayList();;
	private KeywordScenario parsedScenario;

	public JBehaviourScenario(KeywordScenario _parsedScenario) {
		parsedScenario = _parsedScenario;
	}

	@Override
	public List getContexts() {
		return contexts;
	}

	@Override
	public void add(IBehaviourReflexionContext context) {
		contexts.add(context);		
	}

	@Override
	public String getStatement() {
		return parsedScenario.getStatement();
	}

	@Override
	public void setCallers(List scenarios) {
		for(IBehaviourScenario scenario : scenarios) {
			for(IBehaviourReflexionContext context : scenario.getContexts()) {
				if(context.getType() == statement.Call && context.getStatement().contains(getStatement())) {
					callers.add(scenario);
				}
			}
		}
	}

	@Override
	public List getCallers() {
		return callers;
	}

	@Override
	public String toString() {
		return "JBehaviourScenario [getStatement()=" + getStatement() + "]";
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy