Tabnine Logo
UseCasePart.condition
Code IndexAdd Tabnine to your IDE (free)

How to use
condition
method
in
org.requirementsascode.UseCasePart

Best Java code snippets using org.requirementsascode.UseCasePart.condition (Showing top 7 results out of 315)

origin: bertilmuth/requirementsascode

public <T> FlowlessUserPart<T> on(Class<T> eventOrExceptionClass) {
ConditionPart conditionPart = condition(null);
FlowlessUserPart<T> flowlessUserPart = conditionPart.on(eventOrExceptionClass);
return flowlessUserPart;
}
origin: bertilmuth/requirementsascode

/**
 * Only if the specified condition is true, the event is handled.
 *
 * @param condition
 *            the condition that constrains when the event is handled
 * @return a part of the builder used to define the event's class
 */
public ConditionPart condition(Condition condition) {
return useCase(HANDLES_EVENTS).condition(condition);
}
origin: bertilmuth/requirementsascode

@Test
public void twoFlowlessStepsReactWhenConditionIsTrueInFirstStepWithoutEventButWithModelRunnerArgument() {
Model model = modelBuilder.useCase(USE_CASE)
  .condition(() -> !modelRunner.getLatestStep().isPresent()).system(modelRunner -> displaysConstantText())
  .on(EntersNumber.class).system(displaysEnteredNumber())
.build();
modelRunner.run(model);
Optional<Step> latestStepRun = modelRunner.reactTo(entersNumber());
assertEquals(EntersNumber.class, latestStepRun.get().getEventClass());
}

origin: bertilmuth/requirementsascode

@Test
public void twoFlowlessStepsReactWhenConditionIsTrueInFirstStepWithoutEvent() {
Model model = modelBuilder.useCase(USE_CASE)
  .condition(() -> !modelRunner.getLatestStep().isPresent()).system(displaysConstantText())
  .on(EntersNumber.class).system(displaysEnteredNumber())
.build();
modelRunner.run(model);
Optional<Step> latestStepRun = modelRunner.reactTo(entersNumber());
assertEquals(EntersNumber.class, latestStepRun.get().getEventClass());
}

origin: bertilmuth/requirementsascode

@Test
public void recordsStepWithEvent() {
ReactionAsConsumer reactionAsConsumer = new ReactionAsConsumer();
Model model = modelBuilder.useCase(USE_CASE).condition(new AlwaysTrue()).on(EntersText.class)
  .system(reactionAsConsumer).build();
modelRunner.handleWith(recordStepDetails());
modelRunner.run(model);
modelRunner.reactTo(entersText());
Object condition = optionalCondition.get();
assertTrue(condition instanceof AlwaysTrue);
Object event = optionalEvent.get();
assertTrue(event instanceof EntersText);

assertEquals(reactionAsConsumer, systemReaction);
}
origin: bertilmuth/requirementsascode

@Test
public void twoFlowlessStepsReactWhenConditionIsTrueInFirstStepWithEvent() {
Model model = modelBuilder.useCase(USE_CASE)
  .condition(() -> true).on(EntersText.class).system(displaysEnteredText())
  .on(EntersNumber.class).system(displaysEnteredNumber())
.build();
modelRunner.run(model);

Optional<Step> latestStepRun = modelRunner.reactTo(entersText());
assertEquals(EntersText.class, latestStepRun.get().getEventClass());
latestStepRun = modelRunner.reactTo(entersNumber());
assertEquals(EntersNumber.class, latestStepRun.get().getEventClass());
}

origin: bertilmuth/requirementsascode

@Test
public void twoFlowlessStepsDontReactWhenConditionIsFalseInFirstStep() {
Model model = modelBuilder.useCase(USE_CASE)
  .condition(() -> false).on(EntersText.class).system(displaysEnteredText())
  .on(EntersNumber.class).system(displaysEnteredNumber())
.build();
modelRunner.run(model);
Optional<Step> latestStepRun = modelRunner.reactTo(entersNumber());
assertEquals(EntersNumber.class, latestStepRun.get().getEventClass());
latestStepRun = modelRunner.reactTo(entersText());
assertEquals(EntersNumber.class, latestStepRun.get().getEventClass());
}

org.requirementsascodeUseCasePartcondition

Popular methods of UseCasePart

  • basicFlow
    Start the "happy day scenario" where all is fine and dandy.
  • flow
    Start a flow with the specified name.
  • build
    Returns the model that has been built.
  • getUseCase
  • on
  • <init>
  • getModelBuilder

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now