org.requirementsascode.flowposition.InsteadOf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of requirementsascodecore Show documentation
Show all versions of requirementsascodecore Show documentation
Enables you to define and run executable use case specifications, in your code.
package org.requirementsascode.flowposition;
import org.requirementsascode.FlowStep;
import org.requirementsascode.ModelRunner;
import org.requirementsascode.UseCase;
public class InsteadOf extends FlowPosition{
private String stepName;
private FlowStep step;
public InsteadOf(String stepName, UseCase useCase) {
super(useCase);
this.stepName = stepName;
}
@Override
protected boolean isRunnerAtRightPositionFor(ModelRunner modelRunner) {
FlowPosition flowPosition = step.getFlowPosition();
return flowPosition.test(modelRunner);
}
public void resolveSteps() {
if(step == null) {
FlowStep resolvedStep = null;
UseCase useCase = getUseCase();
String stepName = getStepName();
if (useCase != null && stepName != null) {
resolvedStep = (FlowStep) useCase.findStep(stepName);
}
this.step = resolvedStep;
}
}
public final String getStepName() {
return stepName;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy