use of cn.taketoday.context.annotation.ConditionEvaluationContext in project today-infrastructure by TAKETODAY.
the class ConditionalOnExpressionTests method expressionEvaluationWithNoBeanFactoryDoesNotMatch.
@Test
void expressionEvaluationWithNoBeanFactoryDoesNotMatch() {
OnExpressionCondition condition = new OnExpressionCondition();
MockEnvironment environment = new MockEnvironment();
ConditionEvaluationContext evaluationContext = mock(ConditionEvaluationContext.class);
given(evaluationContext.getEnvironment()).willReturn(environment);
ConditionOutcome outcome = condition.getMatchOutcome(evaluationContext, mockMetaData("invalid-spel"));
assertThat(outcome.isMatch()).isFalse();
assertThat(outcome.getMessage()).contains("invalid-spel").contains("no BeanFactory available");
}
use of cn.taketoday.context.annotation.ConditionEvaluationContext in project today-framework by TAKETODAY.
the class ConditionalOnExpressionTests method expressionEvaluationWithNoBeanFactoryDoesNotMatch.
@Test
void expressionEvaluationWithNoBeanFactoryDoesNotMatch() {
OnExpressionCondition condition = new OnExpressionCondition();
MockEnvironment environment = new MockEnvironment();
ConditionEvaluationContext evaluationContext = mock(ConditionEvaluationContext.class);
given(evaluationContext.getEnvironment()).willReturn(environment);
ConditionOutcome outcome = condition.getMatchOutcome(evaluationContext, mockMetaData("invalid-spel"));
assertThat(outcome.isMatch()).isFalse();
assertThat(outcome.getMessage()).contains("invalid-spel").contains("no BeanFactory available");
}
Aggregations