package de.accso.flexinale.backoffice.api_in.rest;

import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.io.InputStream;

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

class ExcelHelperTest {

    @Test
    void xlsFileHasExcelFormat() throws IOException {
        // arrange
        String xlsFile = "/testdata/TestDataFilmKinoKinoSaalVorfuehrung.xlsx";
        InputStream stream = this.getClass().getResourceAsStream(xlsFile);

        // act
        boolean result = ExcelHelper.isExcelFile(stream);

        // assert
        assertThat(result).isTrue();
    }

    @Test
    void classFileDoesntHaveExcelFormat() throws IOException {
        // arrange
        String classFile = "/"
                + this.getClass().getCanonicalName().replace('.', '/')
                + ".class";
        InputStream stream = this.getClass().getResourceAsStream(classFile);

        // act
        boolean result = ExcelHelper.isExcelFile(stream);

        // assert
        assertThat(result).isFalse();
    }
}
