package click.kamil.springstatemachineexporter.analysis.resolver;

import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;

class BooleanConstraintEvaluatorBindingTest {

    @Test
    void shouldEvaluateEqualsIgnoreCaseAgainstPathVariableBinding() {
        String constraint = "\"ORDER\".equalsIgnoreCase(machineType)";
        assertThat(BooleanConstraintEvaluator.isCompatibleWithBindings(constraint, Map.of("machineType", "ORDER")))
                .isTrue();
        assertThat(BooleanConstraintEvaluator.isCompatibleWithBindings(constraint, Map.of("machineType", "DOCUMENT")))
                .isFalse();
    }

    @Test
    void shouldEvaluateDocumentBranchAgainstBinding() {
        String constraint = "\"DOCUMENT\".equalsIgnoreCase(machineType)";
        assertThat(BooleanConstraintEvaluator.isCompatibleWithBindings(constraint, Map.of("machineType", "DOCUMENT")))
                .isTrue();
        assertThat(BooleanConstraintEvaluator.isCompatibleWithBindings(constraint, Map.of("machineType", "ORDER")))
                .isFalse();
    }
}
