package click.kamil.springstatemachineexporter.analysis.enricher.matching;

import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import click.kamil.springstatemachineexporter.model.Event;
import org.junit.jupiter.api.Test;

import java.util.List;

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

class StrictFqnMatchingEngineExternalTriggerTest {

    private final StrictFqnMatchingEngine engine = new StrictFqnMatchingEngine();

    @Test
    void shouldMatchExternalTriggerByMainEventWhenPolymorphicEventsAreEmpty() {
        Event machineEvent = Event.of(
                "com.example.order.OrderEvent.PAY",
                "com.example.order.OrderEvent.PAY");

        TriggerPoint trigger = TriggerPoint.builder()
                .event("com.example.order.OrderEvent.PAY")
                .eventTypeFqn("com.example.order.OrderEvent")
                .external(true)
                .polymorphicEvents(List.of())
                .build();

        assertThat(engine.matches(machineEvent, trigger)).isTrue();
    }
}
