package click.kamil.springstatemachineexporter.analysis.service;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

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

class DynamicClasspathResolverTest {

    @Test
    void shouldNeverResolveExternalJarsEvenWhenMavenProject(@TempDir Path tempDir) throws Exception {
        Files.createFile(tempDir.resolve("pom.xml"));
        assertThat(new DynamicClasspathResolver().resolveClasspath(tempDir)).isEmpty();
    }

    @Test
    void shouldNeverResolveExternalJarsEvenWhenGradleProject(@TempDir Path tempDir) throws Exception {
        Files.createFile(tempDir.resolve("build.gradle"));
        assertThat(new DynamicClasspathResolver().resolveClasspath(tempDir)).isEmpty();
    }

    @Test
    void shouldReturnEmptyListIfNoBuildFileFound(@TempDir Path tempDir) {
        List<String> classpath = new DynamicClasspathResolver().resolveClasspath(tempDir);
        assertThat(classpath).isEmpty();
    }
}
