package click.kamil.springstatemachineexporter.analysis.service;

import org.junit.jupiter.api.Test;

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

class FunctionalInterfaceTypesTest {

    @Test
    void shouldRecognizeSupplierParameter() {
        assertThat(FunctionalInterfaceTypes.isFunctionalInterface("java.util.function.Supplier"))
                .isTrue();
    }

    @Test
    void shouldAcceptLambdaIntoSupplierParameter() {
        assertThat(FunctionalInterfaceTypes.isProvablyResolvedCallSiteArgument(
                "() -> OrderEvent.CANCEL", "java.util.function.Supplier"))
                .isTrue();
    }

    @Test
    void shouldRejectNonFunctionalParameter() {
        assertThat(FunctionalInterfaceTypes.isProvablyResolvedCallSiteArgument(
                "OrderEvent.CANCEL", "com.example.OrderEvent"))
                .isFalse();
    }
}
