private String generateDescriptionPrefix(Callable<Boolean> matcher, String conditionAlias) { String methodDescription = generateMethodDescription(matcher); boolean hasAlias = conditionAlias != null; if (isLambdaClass(matcher.getClass())) { final String prefix; if (hasAlias) { prefix = "Condition with alias " + conditionAlias + " defined as a "; } else { prefix = "Condition defined as a "; } return prefix + generateLambdaErrorMessagePrefix(matcher.getClass(), false) + methodDescription; } return "Callable condition" + (hasAlias ? " with alias " + conditionAlias : "") + methodDescription; }
public ConditionEvaluationResult eval(Duration pollInterval) throws Exception { boolean conditionFulfilled = matcher.call(); if (conditionFulfilled) { conditionEvaluationHandler.handleConditionResultMatch(getMatchMessage(matcher, settings.getAlias()), true, pollInterval); } else { conditionEvaluationHandler.handleConditionResultMismatch(getMismatchMessage(matcher, settings.getAlias()), false, pollInterval); } return new ConditionEvaluationResult(conditionFulfilled); }
ConditionEvaluationWrapper conditionEvaluationWrapper = new ConditionEvaluationWrapper(matcher, settings, conditionEvaluationHandler); conditionAwaiter = new ConditionAwaiter(conditionEvaluationWrapper, settings) { @SuppressWarnings("rawtypes")
private String generateDescriptionPrefix(Callable<Boolean> matcher, String conditionAlias) { String methodDescription = generateMethodDescription(matcher); boolean hasAlias = conditionAlias != null; if (isLambdaClass(matcher.getClass())) { final String prefix; if (hasAlias) { prefix = "Condition with alias " + conditionAlias + " defined as a "; } else { prefix = "Condition defined as a "; } return prefix + generateLambdaErrorMessagePrefix(matcher.getClass(), false) + methodDescription; } return "Callable condition" + (hasAlias ? " with alias " + conditionAlias : "") + methodDescription; }
private String getMismatchMessage(Callable<Boolean> matcher, String conditionAlias) { return generateDescriptionPrefix(matcher, conditionAlias) + " returned false"; }
private String getMatchMessage(Callable<Boolean> matcher, String conditionAlias) { return generateDescriptionPrefix(matcher, conditionAlias) + " returned true"; }
public ConditionEvaluationResult eval(Duration pollInterval) throws Exception { boolean conditionFulfilled = matcher.call(); if (conditionFulfilled) { conditionEvaluationHandler.handleConditionResultMatch(getMatchMessage(matcher, settings.getAlias()), true, pollInterval); } else { conditionEvaluationHandler.handleConditionResultMismatch(getMismatchMessage(matcher, settings.getAlias()), false, pollInterval); } return new ConditionEvaluationResult(conditionFulfilled); }
ConditionEvaluationWrapper conditionEvaluationWrapper = new ConditionEvaluationWrapper(matcher, settings, conditionEvaluationHandler); conditionAwaiter = new ConditionAwaiter(conditionEvaluationWrapper, settings) { @SuppressWarnings("rawtypes")
private String getMismatchMessage(Callable<Boolean> matcher, String conditionAlias) { return generateDescriptionPrefix(matcher, conditionAlias) + " returned false"; }
private String getMatchMessage(Callable<Boolean> matcher, String conditionAlias) { return generateDescriptionPrefix(matcher, conditionAlias) + " returned true"; }