import interfacemanualmocking.AuthenticationByBiometryService;
import interfacemanualmocking.AuthenticationByPasswordService;
import interfacemanualmocking.MockDirectory;
import interfacemanualmocking.MockStrengthEstimationService;
import org.junit.jupiter.api.*;

import static authentication.Strength.*;
import static authentication.Strength.STRONG;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

public class AuthenticationByBiometryServiceTest {
    private MockDirectory directory;
    private AuthenticationByBiometryService authenticationByBiometryService;

    @BeforeAll
    static void setUpBeforeClass() throws Exception {
        System.out.println("Before all");
    }

    @AfterAll
    static void tearDownAfterClass() throws Exception {
        System.out.println("After all");
    }

    @BeforeEach
    void setUp()  {
        directory = new MockDirectory();
        authenticationByBiometryService = new AuthenticationByBiometryService(directory, STRONG);
        authenticationByBiometryService.setDirectory(directory);
    }


    @AfterEach
    void tearDown() throws Exception {
        System.out.println("After each");
    }

    @Test
    void testIsAMatch() {
        assertThat(authenticationByBiometryService.isAMatch("regix", "azerty")).isTrue();

    }

    @Test
    void testDataStrenth() {
        assertThat(authenticationByBiometryService.dataStrenth("azerty")).isEqualTo(STRONG);
        assertThat(authenticationByBiometryService.dataStrenth("azertyuiopqsdfghjklmwxcvbn1234567890")).isEqualTo(STRONG);
    }
}