@Override public Integer answeredBy(Actor actor) { Integer total = 0; for (Integer number : listQuestion.answeredBy(actor)) { total = total + number; } return total; } }
@Override protected Boolean evaluatedConditionFor(Actor actor) { return condition.answeredBy(actor); } }
public <ANSWER> ANSWER asksFor(Question<ANSWER> question) { return question.answeredBy(this); }
@Override public void evaluateFor(Actor actor) { questionGroup.answeredBy(actor); // try { // String groupTitle = "consequence group"; // // StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(groupTitle)); // // questionGroup.answeredBy(actor); // // } catch (Throwable error) { // throw error; // } finally { // StepEventBus.getEventBus().stepFinished(); // } }
@Override public T answeredBy(Actor actor) { return Collections.min(listQuestion.answeredBy(actor), comparator); } }
@Override public Integer answeredBy(Actor actor) { return listQuestion.answeredBy(actor).size(); } }
@Override public T answeredBy(Actor actor) { return Collections.max(listQuestion.answeredBy(actor), comparator); } }
@Override public List<T> answeredBy(Actor actor) { List<T> sortedItems = new ArrayList<>(listQuestion.answeredBy(actor)); Collections.sort(sortedItems, comparator); return sortedItems; } }
public static <T> ConditionalPerformable whether(Question<T> question, Matcher<T> matcher) { Question<Boolean> condition = actor -> matcher.matches(question.answeredBy(actor)); return new ConditionalPerformableOnQuestion(condition); } }
@Override public List<T> answeredBy(Actor actor) { return NewList.reverse(listQuestion.answeredBy(actor)); } }
public <ANSWER> ANSWER asksFor(Question<ANSWER> question) { beginPerformance(); ANSWER answer = question.answeredBy(this); endPerformance(); return answer; }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question)); try { assertThat(question.answeredBy(actor), expected); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); assertThat(reason(), question.answeredBy(actor), is(true)); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); Serenity.injectScenarioStepsInto(question); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); assertTrue("predicate failed", expected.test(question.answeredBy(actor))); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); Serenity.injectScenarioStepsInto(question); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); addHints(fromAssertion(expected)).to(question); assertThat(question.answeredBy(actor), expected); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }